0

I have a WordPress site running on my VPS which is quite high-specced (3520MB RAM, 4 Cores). The server runs Nginx and php5-fpm.

Although the site is responsive on the front end, the backend tends to be pretty slow with some admin pages taking several seconds to load. The site runs WooCommerce but I have WP Total Cache running as well as APC object cache.

My question is really about php5-php config as I think I may not have set it up optimally to make use of the server's resources. Here is my www.conf in php5 pool:

pm.max_children = 10

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 2

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3

; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500

I also have define('WP_MEMORY_LIMIT', '196M'); in wp-config.

Are there any obvious steps I can take to improve the speed of the admin area?

Edit

Examining the log I see quite a few of these:

[01-Oct-2014 20:56:38] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 7 total children

Anything I can do to solve?

Edit2:

top command when loading an admin page. Are these values reasonable?:

  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
23237 www-data  20   0  381m  45m  31m S  10.3  1.4   0:03.52 php5-fpm
23229 www-data  20   0  385m  76m  60m S   5.0  2.3   0:09.54 php5-fpm
23230 www-data  20   0  613m  58m  39m S   4.7  1.7   0:06.38 php5-fpm
 1425 www-data  20   0  121m 7000 2292 S   1.3  0.2  87:43.85 nginx
  • 2
    Admin pages are not cached and are generally slow. – user9517 Oct 2 '14 at 10:04
  • 1
    Indeed, but there must be more that can be done to optimise the backend so that it utilizes the server's resources more. It seems the VPS is not being stretched (RAM and CPU are never near 100%) – harryg Oct 2 '14 at 10:16
  • You may find wordpress.stackexchange.com more helpful – user9517 Oct 2 '14 at 10:17
  • Well I thought that but the question is really about server configuration more than WordPress itself. This issue could apply to the backend of any php web application. – harryg Oct 2 '14 at 10:23
  • 2
    Give up. The WordPress backend really is very heavyweight and there's almost nothing you can do about it. – Michael Hampton Oct 2 '14 at 14:02
1

OK I posted this ages ago and sort of gave up. Then I decided to revisit and did some research.

My server uses APC opcode caching to improve php performance. I put an apc.php file in my site's root which allows me to see the stats of the cache. Fragmentation was at 100% and ti was getting over 50% misses.

In the /etc/php5/conf.d/apc.ini file I just had to update the config setting to have the following:

apc.shm_size = 256
apc.max_file_size = 12M
apc.ttl=0

The restart php

sudo service php5-fpm restart

My server has a decent amount of memory (around 3.5GB) so this wouldn't use up much and has brought fragmentation to near-zero and misses to around 3-4%. Speed improvement is dramatic, pages now load in 1-2 seconds rather than 6-8 as before.


Sources and further detail:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.