Sunday, January 23, 2011

Have I pushed the limits of my current VPS or is there room for optimization?

I am currently on a mediatemple DV server (basic) 512mb dedicated ram, this is a CentOS based VPS with Plesk and Virtuozzo. My experience with it from day 1 has been bad and I only could sooth my server issues with several caching "Band-aids," but my sites are not as small as they were a year ago either so the issues have worsen.

I have 3 Drupal installs running on separate (plesk) domains, 1 of those drupal installs is a multisite, that consists of 5-6 sites 2 of those sites are bringing in actual traffic. Those caching "Band-aids" I mentioned are APC, which seemed to help alot initially, and Drupal's Boost, which is considered a poorman's Varnish, it makes all my pages static for anonymous users. Last 30day combined estimate on Google Ananlytics: 90k visitors 260k pageviews.

Issue: alot of downtime, I am continually checking if my sites are up, and lately I have been finding it down more than 3 times daily. Restarting Apache will bring it back up, for some time. I have google search every error message and looked up ways to optimize my DV server, and I am beyond stump what is my next move. Is this server bad, have I hit a impossibly low restriction such as the 12mb kernel memory barrier (kmemsize), is it on my end, do I need to optimize some more?

*I have provided as much information as I can below, any help or suggestions given will be appreciated

Common Error messages I see in the log:

[error] (12)Cannot allocate memory: fork: Unable to fork new process
[error] make_obcallback: could not import mod_python.apache.\n
Traceback (most recent call last):
 File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 21, in ?
 import traceback
 File "/usr/lib/python2.4/traceback.py", line 3, in ?
 import linecache
 ImportError: No module named linecache
[error] python_handler: no interpreter callback found.
[warn-phpd] mmap cache can't open /var/www/vhosts/***/httpdocs/*** - Too many open files in system (pid ***)
[alert] Child 8125 returned a Fatal error... Apache is exiting!
[emerg] (43)Identifier removed: couldn't grab the accept mutex
[emerg] (22)Invalid argument: couldn't release the accept mutex

cat /proc/user_beancounters:

Version: 2.5
       uid  resource           held    maxheld    barrier      limit    failcnt
     41548: kmemsize        4582652    5306699   12288832   13517715   21105036
            lockedpages           0          0        600        600          0
            privvmpages       38151      42676     229036     249036          0
            shmpages          16274      16274      17237      17237          2
            dummy                 0          0          0          0          0
            numproc              43         46        300        300          0
            physpages         27260      29528          0 2147483647          0
            vmguarpages           0          0     131072 2147483647          0
            oomguarpages      27270      29538     131072 2147483647          0
            numtcpsock           21         29        300        300          0
            numflock              8          8        480        528          0
            numpty                1          1         30         30          0
            numsiginfo            0          1       1024       1024          0
            tcpsndbuf        648440     675272    2867477    4096277    1711499
            tcprcvbuf        301620     359716    2867477    4096277          0
            othersockbuf       4472       4472    1433738    2662538          0
            dgramrcvbuf           0          0    1433738    1433738          0
            numothersock         12         12        300        300          0
            dcachesize            0          0    2684271    2764800          0
            numfile            3447       3496       6300       6300       3872
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            dummy                 0          0          0          0          0
            numiptent            14         14        200        200          0

TOP: (In January the load avg was really high 3-10, I was able to bring it down where it is currently is by giving APC more memory play around with)

top - 16:46:07 up  2:13,  1 user,  load average: 0.34, 0.20, 0.20
Tasks:  40 total,   2 running,  37 sleeping,   0 stopped,   1 zombie
Cpu(s):  0.3% us,  0.1% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    916144k total,   156668k used,   759476k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

MySQLTuner: (after optimizing every table and repairing any table with overage I got the fragmented count down to 86)

[--] Data in MyISAM tables: 285M (Tables: 1105)
[!!] Total fragmented tables: 86

[--] Up for: 2h 44m 38s (409K q [41.421 qps], 6K conn, TX: 1B, RX: 174M)
[--] Reads / Writes: 79% / 21%
[--] Total buffers: 58.0M global + 2.7M per thread (100 max threads)
[!!] Query cache prunes per day: 675307
[!!] Temporary tables created on disk: 35% (7K on disk / 20K total)
  • You're out of memory (RAM).

    Upgrading to 1 or 2 GB should give a massive performance boost.

    It looks like that doubles or triples your costs, so you may want to look at other VPS providers.

    From LapTop006
  • If you're only using the VPS for Drupal sites then you might be better off running Aegir rather than a full-blown control panel like Plesk. No idea if or how much that would save in resources, but it might be worth considering.

    There are quite a few articles on the best way of optimising Drupal, but they usually involve throwing quite a bit of ram at it. This collection is a good start. But first, make sure you aren't running any modules you don't need to.

    You may also want to consider whether to move MySQL to a separate server (though probably not for Drupal since it tends to use the database quite heavily). And if most of your traffic is for anonymous users then it might be worth considering getting an extra server to run a caching forward proxy and/or memcached.

    But extra memory on this server is probably the easiest and best solution. 512Mb isn't a lot for a combined web/MySQL server running some fairly big Drupal sites.

    From kaerast

0 comments:

Post a Comment