New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provisioning apache2 prefork replacement killed my server(s) performance #89
Comments
Wow, you're right. With the current release, you can set those settings in your You can see how this is all calculated here:
It looks like our low-end is severely off. The one issue we do know exists is Do you happen to know of a good resource for performance-tuning Apache based on box memory size? |
Sorry, I don't know of any offhand. |
I know that we are currently calculating We can instead have a final check to give it a minimum value of...let's say between 2 and 5? |
I'm having trouble with this issue again, I think. I have a digital ocean vps that is 1Gb/1 core/30Gb ubuntu 12.04 and the genesis provisioning sets the prefork at:
MaxClients and ServerLimit (well, really all but the MaxRequestsPerChild) seem too low. Would you say so? Is there a good reference for fine tuning the prefork that gives reasonable estimates based on box size? As it is, my server is very pokey and wasn't like this before we started calculating the prefork settings. As the original shows up top, those value seem more in line, but I don't want to change well known values to configs that may result in memory issues. Thanks! |
@EvanK @ericclemmons Suggestions on optimal settings? Thanks! |
@mcheck I'm currently digging into the best configuration for a server. The The problem with pretuning it out of the box (and I'll do my best to create some type of equation or logic) is that each application works differently and takes up a different amount of RAM. Here's a good equation to follow:
The last bit (size per apache process) is the crucial one to get the best results. Generally this size can range between 12mb - 30mb per process. Let's try to be average and say that your site takes up 20mb per process and MySQL takes up 70mb (based on my own site results). For a 1gb machine that'd be:
That leaves you with a prefork For the rest of the values, it all depends on how you use your server. Is your server ONLY for serving web (ie. you're not running any other services on it)? I've seen a lot of advice on the topic but it's hard to tell what the number should be. From what I've read, anywhere from leaving it to defaults to setting all the numbers close to the
Hope that helps! I'll be researching more into this and #92 should change the size of apache processes so that will impact your tuning in the future. |
@mcheck I should probably also let you know that you should test and monitor your server when you change these values. If things get out of hand, lower the |
I just realized that it's not really possible to provision the server with the correct amount of Once the server (and final application) is running, THEN we can estimate the MaxClients since they're based off the amount of RAM each process will consume. The reason the original prefork config ran faster is because it kept spinning up new processes for users. The end results (given enough traffic) would have been what's called |
So, what's the best course of action? Only set sane defaults and encourage the user to change the settings after monitoring application performance? |
@AntJanus Thanks for all the work and info.
But the server is far too slow. It is a 1G server without varnish and my apache is at 62m and mysql 159m ! Basically double yours! So my numbers according to your calcs would be:
I am not running anything else on the server, really. I have it all locked down and is specific to only apache, php and mysql. I do not use varnish because the I could never get it to reliably run with ssl. We're running an ecomm shop and the ssl, obviously, is required. But as you see above, my mem numbers are double yours. Can you help me determine a reason for that? I was starting to look down the path of PHP-FPM and nginx because of the mem sizes and the voodoo that seems to be the MacClients due to the size of these processes. A long rabbit hole.... What do you use for monitoring the system? I would like something that would allow me to react to apache and mysql performance. @ericclemmons I think that sane defaults makes sense then encourage changes based on application monitoring. My $0.02. |
@mcheck I think you're looking at the parent apache process, not the child processes which are under: The best thing for monitoring would be New Relic because it will give you even the number of processes you use (it'll show @ericclemmons sane defaults would work best. Anything else will need proper tuning. |
@AntJanus Just wanted to say 'thanks' for the guidance and advice on the MaxClients. Using your revised formula, and my RES mem from
And the server is noticeably snappier. Fantastic.
Thanks again. |
One thing I have been chasing after for several weeks now, is the performance of apache and varnish. Turns out where I was looking at varnish being so finicky, it was apache2 when the changes from @EvanK were merged into master at (I think) 0.2.29.
When the prefork.conf file was broken out to determine values from calculations, my 1G server provisioning performance was horrendous. 30s to load a jquery file. Once I isolated and found that it was the prefork settings, I changed them to those set with a version BEFORE 0.2.29 and performance was restored.
I'm no ansible or apache2 expert, so I can't understand why less requests per child will give better results. But overall, I can tell you the results is that prefork.conf 1 is TERRIBLE compared to prefork 2, below.
So, 1G server (as well as other current settings) with 0.2.29 and later:
So, 1G server (as well as other current settings) with 0.2.28 and earlier:
The text was updated successfully, but these errors were encountered: