0

I am running a drupal 7 website on a Linux server (with 4 cores and 12GB RAM) with LEMP (nginx+php5-fpm+mysql). The drupal installation has a large number of modules enabled(all of which are needed). I also use apc + boost + memcache + authcache for caching. The caching seems to be working (i see pages being served from cache) and the site has a reasonable response time. I have run stress tests with the website running in a url like www-1.example.com. (www-1.example.com points to the ip of my webserver, let's say x.x.x.x) and the results are fine (for up to 100 concurrent users) The problem starts when I change the dns so that www.example.com also points to x.x.x.x. Then the cpu of my webserver (all 4 cores) reach 100% at short time. I have been expereimenting with the following parameters on the www.conf file with no luck:

Configuration 1:

pm.max_children = 100
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.max_requests = 200

result: 100% cpu usage, low memory usage

Configuration final:

pm.max_children = 300
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.max_requests = 200

result: low cpu usage, 100% memory usage

Can anyone guide me to find the optimal comfiguration or has any idea on what can cause the 100% cpu usage? How do i culculate the maximum number of concurrent usages that can run without problem based on server parameters?

1 Answer 1

0

Cpu usage, in a classic lemp VM is sometime caused by php waiting for mysql to elaborate script, inserts and querys. Also, a typical cms like Magento, a php fpm child can eat up to 300mb of ram, so 100 child or 300 will result in a sluggish and swapping VM.

You should first lower (max 20/25 php child in my opinion) childs then strace php mysql calls and profile query taling much time to execute. 80% of the problems are there...

1
  • Thank you for your response! I'll try that and I'll let you know how it goes!
    – mirto
    Commented Jan 12, 2017 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .