PHP pages working slow from time to time
Posted
by
user1038179
on Server Fault
See other posts from Server Fault
or by user1038179
Published on 2012-06-26T18:48:02Z
Indexed on
2012/06/27
9:17 UTC
Read the original article
Hit count: 670
I have VPS with limit of 2GB of ram and 8 CPU cores.
I have 5 sites on that VPS (one of them is just for testing, no visitors exept me). All 5 sites are image galleries, like wallpaper sites. Last week I noticed problem on one site (main domain, used for name servers, and also with most traffic, visitors). That site has two image galleries, one is old static html gallery made few years ago and another, main, is powered by ZENPhoto CMS. Also I have that same gallery CMS on another two sites on that same VPS (on one running site and on one just for testing site). On other two sites I have diferent PHP driven gallery.
Problem is that after some time (it vary from 10 minutes to few hours after apache restart), loading of pages on main site becomes very slow, or I get 503 Service Temporarily Unavailable error. So pages becomes unavailable. But just that part with new CMS gallery, old part of site with static html pages are working fast and just fine. Also other two sites with same CMS gallery and other two with different PHP driven gallery are working fine and fast at the same time. I thought it must be something with CMS on that main site, because other sites are working nice. Then I tryed to open contact and guest book pages on that main site which are outside of that CMS but also PHP pages, and they do not load too, but that same contact php scipts are working on other sites at the same time.
So, when site starts to hangs, ONLY PHP generated content is not working, like I said other static pages are working. And, ONLY on that one main site I have problems. Then I need to restart Apache, after restart everything is vorking nice and fast, for some time, than again, just PHP pages on main site are becomming slower. If I do not restart apache that slowness take some time (several minutes, hours, depending ot traffic) and during that time PHP diven content is loading very slow or unavailable on that site. After sime time, on moments everything start to work and is fast again for some time, and again. In hours with more traffic PHP content is loading slowly or it is unavailable, in hours with less traffic it is sometimes fast and sometimes little bit slower than usually. And ones again, only on that main site, and only PHP driven pages, static pages are working fast even in most traffic hours also other sites with even same CMS are working fast.
Currently I have about 7000 unique visitors on that site but site worked nice even with 11500 visitors per day. And about 17000 in total visitors on VPS, all sites ( about 3 pages per unique visitor).
When site start to slow down sometimes in apache status I can see something like this:
mod_fcgid status:
Total FastCGI processes: 37
Process: php5 (/usr/local/cpanel/cgi-sys/php5)Pid Active Idle Accesses State
11300 39 28 7 Working
11274 47 28 7 Working
11296 40 29 3 Working
11283 45 30 3 Working
11304 36 31 1 Working
11282 46 32 3 Working
11292 42 33 1 Working
11289 44 34 1 Working
11305 35 35 0 Working
11273 48 36 2 Working
11280 47 39 1 Working
10125 133 40 12 Exiting(communication error)
11294 41 41 1 Exiting(communication error)
11277 47 42 2 Exiting(communication error)
11291 43 43 1 Exiting(communication error)
10187 108 43 10 Exiting(communication error)
10209 95 44 7 Exiting(communication error)
10171 113 44 5 Exiting(communication error)
11275 47 47 1 Exiting(communication error)
10144 125 48 8 Exiting(communication error)
10086 149 48 20 Exiting(communication error)
10212 94 49 5 Exiting(communication error)
10158 118 49 5 Exiting(communication error)
10169 114 50 4 Exiting(communication error)
10105 141 50 16 Exiting(communication error)
10094 146 50 15 Exiting(communication error)
10115 139 51 17 Exiting(communication error)
10213 93 51 9 Exiting(communication error)
10197 103 51 7 Exiting(communication error)
Process: php5 (/usr/local/cpanel/cgi-sys/php5)Pid Active Idle Accesses State
7983 1079 2 149 Ready
7979 1079 11 151 Ready
Process: php5 (/usr/local/cpanel/cgi-sys/php5)Pid Active Idle Accesses State
7990 1066 0 57 Ready
8001 1031 64 35 Ready
7999 1032 94 29 Ready
8000 1031 91 36 Ready
8002 1029 34 52 Ready
Process: php5 (/usr/local/cpanel/cgi-sys/php5)Pid Active Idle Accesses State
7991 1064 29 115 Ready
When it is working nicly there is no lines with "Exiting(communication error)"
Active and Idle are time active and time since last request, in seconds.
Here are system info.
Sysem info:
Total processors: 8
Processor #1 Vendor GenuineIntel Name Intel(R) Xeon(R) CPU E5440 @ 2.83GHz Speed 88.320 MHz Cache 6144 KB
All other seven are the same.
System Information
Linux vps.nnnnnnnnnnnnnnnnn.nnn 2.6.18-028stab099.3 #1 SMP Wed Mar 7 15:20:22 MSK 2012 x86_64 x86_64 x86_64 GNU/Linux
Current Memory Usage total used free shared buffers cached Mem: 8388608 882164 7506444 0 0 0 -/+ buffers/cache: 882164 7506444 Swap: 0 0 0 Total: 8388608 882164 7506444
Current Disk Usage Filesystem Size Used Avail Use% Mounted on /dev/vzfs 100G 34G 67G 34% / none
System Details:
Running on: Apache/2.2.22 System info: (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fcgid/2.3.6 Powered by: PHP/5.3.10
Current Configuration
Default PHP Version (.php files) 5
PHP 5 Handler fcgi PHP 4 Handler suphp
Apache suEXEC on
Apache Ruid2 off
PHP 4 Handler suphp
Apache suEXEC on
Apache Configuration
The following settings have been saved:
fileetag: All
keepalive: On
keepalivetimeout: 3
maxclients: 150
maxkeepaliverequests: 10
maxrequestsperchild: 10000
maxspareservers: 10
minspareservers: 5
root_options: ExecCGI, FollowSymLinks, Includes, IncludesNOEXEC, Indexes, MultiViews, SymLinksIfOwnerMatch
serverlimit: 256
serversignature: Off
servertokens: Full
sslciphersuite: ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP:!kEDH
startservers: 5
timeout: 30
I hope, I explained my problem nicely.
Any help would be nice.
© Server Fault or respective owner