Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm relatively new to server issues, having a site of mine that I started early in the year grow beyond my capabilities of managing it. I need help.

I recently moved out of my shared hosting environment onto a dedicated virtual server from Mediatemple.

Each week, I run a script that fetches data from my DB, fetches data from's API and then tweets information to Twitter.

My server uses Virtuozzo and when the script runs, Apache crashes every 5min. I checked and saw that the 'kmemsize' parameter reaches its cap (its 13mb).

I realise my problem. The MySQL process stays open for long while Apache needs to handle lots of incoming links (about 200 000 pageviews for that day according to my previous host's AWSTATS). Yes, I'm quite unexperienced in this, and I'm clearly killing the server with too many incoming links while it has to manage the updating of the DB.

So that is the precedent: I want a few answers.

1) Why did my shared hosting environment not crash apache every 5min? It ran fine, the site only slowed a lot. Clearly, it must be the virtual container and the kmemsize limit?

2) Where do I go from here? Would a physical server (not a virtual container) encounter the same problems?

I sent a support request to Mediatemple as well. I need all the help I can get.

share|improve this question

This could be as simple as tuning mySQL.

Your old host / server may have had a unique /etc/my.cnf file vs plain vanilla.

Start with some basic MySQL monitoring - a few tools that may help here are:

top, mtop and innotop

(top is default in linux) mtop - innotop -

You can also resort to the MySQL monitoring tool from the command line (cli)

mysqladmin processlist / mysqladmin proc

Sadly - many folks will use the default templates made available under /usr/share/mysql

I HIGHLY RECOMMEND SKIPPING THEM - they are old and not worth using for the following reasons:

Invalid settings for some OS or MySQL versions (e.g., thread_concurrency and skip-locking) Adding huge array variables that you might not understand what they are Performance from testing them against other settings are more than just questionable After running those - and doing some tuning - let mysql run for at least 24-48 hours and then use the following diagnostic tools:

MySQL tuner (just type wget in linux to download then chmod755 and run it by doing ./ ;-) mysqlidxchk (Install by wget chmod 755 mysqlidxchk* mv mysqlidxchk* mysqlidxchk ) then run by doing something like this: ( ./mysqlidxchk --general /var/lib/mysql/ general.log ) If you need some help installing those as well please let me know

PS - most of these are linux only scripts - but will help a huge amount with the tuning and management of your mySQL server.

As well as a good log parsing tool like mysqlsla and mysqlreport for status reporting

Are you using a control panel by chance?

share|improve this answer

vzctl set 101 --kmemsize 2211840:2359296 --save

Try that, it will increase the kmemsize

share|improve this answer
Your Answer assumes you know what his limits and id were previously. This is incorrect. For a better example, visit this link: – JM4 Sep 26 '11 at 19:36

The way that VZ technology works, it imposes limits on various resources. If your beancounter shows that you are exceeding your memory limits, you have a few options.

  1. Upgrade your hosting package so that it has more resources.
  2. Replace apache with a light-weight web-server such as lighttpd or nginx.
  3. Configure mysql to use less resources by referring to the my-small.cnf file that comes with it.
  4. Configure your application to use less memory (e.g. memory_limit in PHP).

There are various tutorials out there that show how you can configure a light-weight LAMP-like stack for various small VPS options.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.