1

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.

2
  • 1
    start gathering stats [eg install munin + munin node]. can it be it's mysql that is the choke-point? maybe number of parallel connections from zenphoto to sql?]
    – pQd
    Jun 26, 2012 at 19:02
  • First things I would check are the state of the opcode cache (ZOP+ doesn't reclaim memory, it re-initializes when full) and contention on the session files. If that doesn't help, try HPROF
    – symcbean
    Dec 28, 2014 at 16:32

2 Answers 2

0

Check your database for errors and make sure the database(s) aren't too large. Also, look at your database logs and Apache error logs when you start seeing a slow down.

5
  • I checked the SQL database using phpMyAdmin tool. Total size of table was about 38 MB and one table, search cache table, used for caching search results had 5 MB of size, and more 18 MB of overhead. I run optimize table and removed that overhead, also I emptied that table and removed more 5 MB of temporary search cache queries. So now table is about 15MB. But I am not sure if that was problem (but for sure your note was helpful), one hour ago I needed to restart apache again, and I will monitor site to see how it will be during higher traffic hours. I will update latter. Jun 27, 2012 at 12:47
  • If it's still getting slow, what ukautz mentioned can definitely cause some problems. It sounds like you're hitting some resource limits somewhere, and then it's crashing. What does your php.ini file look like? Jun 27, 2012 at 15:43
  • It is still getting slow from time to time, in hours with more visitors is more often, I restarted two more time apache today. What confuses me most is that only php generated pages (CMS, which is Zenphoto on that site, and other simple PHP scripts, like contact and guest book forms which are without SQL data base and outside Zenphoto) getting slow, while other static .html pages are working fine at that site. And like I said only on one site on that VPS, while other sites even some are using same CMS or same PHP contact form are working fine at the same time. Jun 27, 2012 at 22:54
  • What about php.ini file, you are interested in all values or in some particular value(s)? Some values are: memory_limit 96MB, register_globals off, upload_max_filesize 32mb, max_execution_time 30, max_input_time 60, safe_mode off... Jun 27, 2012 at 23:00
  • Where I can find or look at that "open file(/sock) limits"? Jun 27, 2012 at 23:02
0

In my experience with VPS, i would look into open file(/sock) limits. Those can lead to strange effects, especially hanging/denied i/o (eg your communication error) whilst having apparently lots of free resources available.

3

You must log in to answer this question.

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