NGINX-FPM configuration settings for magento

2019-02-20 18:52发布

I am running a ecommerce website developed in magento. I have 512mb RAM and 2.6 core2duo on the server. When I send 50 requests at a time on my website it does not respond except for a few requests. I have installed varnish too. I want to know the optimal settings that i want to do for my website. I have seen that PHP-FPM is taking too much memory and cpu usage.

2条回答
对你真心纯属浪费
2楼-- · 2019-02-20 19:08

You should increase memory more than 512m, because nginx + php-fpm and varnish run use more than memory of system. i conduct overflow and php process can not enough ram to excute

查看更多
神经病院院长
3楼-- · 2019-02-20 19:12

Background

We use nginx and php5-fpm on ubuntu 12 on our production machine (VCenter Virtual Machine, 4 cores, 8 GB ram). Our magento installation is heavily themed and extended. Just for kicks the other day I installed everything from scratch on a VMWare box with a default installation of Magento 1.12 EE (I needed to call them out on a bug). I just say this so you know that we've got nginx and php5-fpm in a production environment.

What you are asking is something I think everyone struggles with using nginx and php fpm... Squeezing more performance from it. I mean, we could just use apache and php if we weren't trying to get the site performance increase right? There are a lot answers, opinions, and case base solutions, but I'll point you to the guide I used to configure my system...

http://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips-and-tricks/

Taken from the blog comments:

...However, the problem is indeed Magento, rather than the configuration of the server. Magento is just too large and too heavy to any environment. Magento hosting is really tedious and unpleasant task.

It may not answer every question you have, but there are a lot of good things to make sure you do... Like setting worker_processes = how many cores you have etc.

Personally one thing I still have trouble with is if server load gets really high (more than 5 - 10 hits per seconds) the processors are hammered. I haven't fully nailed down the problem, but adding a core and bumping the ram made a significant dent. I may increase the ram more, but at this time our user base is not seeing any site performance problems.

(Found from another site blog post:)

Magento makes heavy use of the disk subsystem for many of its operations. Disk I/O is the biggest bottleneck, next to CPU’s (cores), to optimal Magento performance.

This is why Magento performs so poorly in cloud environments where the storage is on a SAN shared with countless other users and under stress at random times causing inconsistent performance.

SSD’s (Solid State Drives) configured in a RAID1+0 disk array locally outperforms 15.5K SAS drives in the same RAID configuration.

A local Database is also the key to peak performance with Magento

A remote database introduces latency due system calls and network saturation. If you must use a remote database you should make sure you are on a private VLAN and not sharing an over saturated network connection, which is common for even the largest hosting providers. In the best of network environments, remote database will NOT be as fast as local database for a variety of reasons.

CPU speed and the number of CPU’s is also incredibly important to optimal Magento performance. You can get an idea of the power of the high end CPU that you are using at the following URL - if the CPU is not listed here it is not considered ‘high end‘ by the benchmark “PassMark Software“;

http://www.cpubenchmark.net/high_end_cpus.html

Performance based web servers, such as LiteSpeed, make use of multiple CPU’s (cores) as does the MySQL server, with a proper configuration. Using a performance based web server can significantly improve your applications performance against the Apache web server software.

Trying to rewrite or convert/compile Magento is not a solution - it’s a bandaid at best. You will be locked out of any future upgrades (without a significant amount of development time to rewrite and test your changes) and with each upgrade we continue to see speed improvements. Core changes to Magento should NEVER be performed, core changes to Magento should NEVER be performed - this defeats the OOP model that Magento employs.

In the end, as we have said before, Magento can not achieve optimal performance without a significant investment in the infrastructure on which the application runs. If you are considering running Magento and are wanting to do so on a budget hosting provider understand that you simply can not and will not achieve peak performance with this application.

Magento requires resources due to it’s complex nature - you can not provide the necessary resources on a budget hosting provider as the costs for this type of hardware system is not inexpensive.

查看更多
登录 后发表回答