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 have some serious problems with my production server running Ubuntu 11.10 with 48GB RAM. The setup of my webserver (Apache 2.1) is configured to use approximately 18 GB of RAM. I tried to calculate this value by setting

  • max_clients 800

with each child process taking nearly 23MB ram

  • max_spare_servers 200
  • keepAlive on
  • keepalivetimeout 3

Apache MPM is set to prefork module

Additionally we are using

  • php 5.3.2
  • PDO to connect to database

I made similar changes to my MySQL server (v5.1) by changing max_used_connections to 800 with

  • key_buffer to 4Gb (Myisam as default engine with 3 tables of innodb)
  • key_buffer_size + (read_buffer_size + sort_buffer_size ) * max_connections = 5.4Gb

Now max_used_connection is increasing rapidly and after a couple of hours it stopped at 595 and again it climbed to its max value of 800. I even tried changing to default mysql configuration but still no change.

For some reason changing to Apache's default configuration solves the problem now max_used_connections is steady at around 57.

Does anyone have an idea about this behavior? Can Apaches configuration impact Mysql performance?

share|improve this question
What do you want to achieve? You talk about serious problems which are...? Does your server crash, quit services? Please be more precise. – Chris Mar 20 '12 at 9:31

This is a horrible way to run apache on a large server.

Please consider running the worker MPM (lightweight threading model), and proxy dynamic requests (PHP) to a fastCGI backend via the official apache mod_fcgid module.

Also make SURE you set a static number of PHP -> mysqli connections, and re-use this pool.

You could trivially support 5000 concurrent clients with the above setup.

share|improve this answer
To switch to the worker MPM like suggest by adaptr, ensure all your PHP modules are thread safe, or you run into other problems. – Chris Mar 20 '12 at 9:33
I specifically advised him to run PHP on fastCGI. That does not have threading issues, since every connection is single-threaded. – adaptr Mar 20 '12 at 9:43
You are right, i skipped reading. My bad – Chris Mar 20 '12 at 10:00

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.