1

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 last.fm'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.

warren
  • 17,829
  • 23
  • 82
  • 134

4 Answers4

1

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 - http://mtop.sourceforge.net innotop - http://innotop.sourceforge.net

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 mysqltuner.pl in linux to download then chmod755 mysqltuner.pl and run it by doing ./mysqltuner.pl ;-) mysqlidxchk (Install by wget hackmysql.com/scripts/mysqlidxchk-1.1 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?

Glenn Kelley
  • 1,294
  • 6
  • 10
0

I know this is a pretty old question, but thought following will be useful:

If its a matter of MySQL server tuning, I use http://tools.percona.com Its a free service, just register, login, fill in server details and it gives you the settings that need to be incorporated into my.ini file

I have seen performance improvements , like an import that was taking 20 minutes could execute in 7 seconds flat after tuning.

Sudhir
  • 21
  • 3
0

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

Try that, it will increase the kmemsize

Stephen Thompson
  • 1,482
  • 9
  • 10
  • Your Answer assumes you know what his limits and id were previously. This is incorrect. For a better example, visit this link: http://wiki.openvz.org/Resource_shortage – JM4 Sep 26 '11 at 19:36
0

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.

sybreon
  • 7,357
  • 1
  • 19
  • 19