Recently I’ve been fighting with memory consumption on my server and have been looking for ways that I can reduce the overall load. After some research I found that Apache opens up a file descriptor for each VHosts log file, and keeps this descriptor open all the time. So when I had a bunch of sites that I didn’t mind if their log files were combined, I did some work by using the vhost_combined logging format, which groups a set of vhosts into a single log file.

I verified that first, my /etc/apache2/apache2.conf file had a CustomLog entry for vhost_combined:

LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined

Once this was confirmed I went into each of the config files in the sites-available directory and modified a single line:

CustomLog /var/log/apache2/groupofsites-access.log vhost_combined

Notice that I added that ‘vhost_combined’ to the end of this line, meaning that it will use the log format from above and for each vhost assigned to use this log file, only keep 1 file descriptor open instead of 6.

So far I’ve actually noticed a quicker response from my webserver as well as lower memory usage. Hopefully this helps you out as well!

If you’re searching for a hosting provider, I recommend ChunkHost. They have great uptime, a very responsive support staff, and their prices are hard to beat. See my review of ChunkHost.

Posted by Chris Klosowski

Chris Klosowski is the Director of Technology at Sandhills Development, LLC, creators of fine WordPress plugins, and ecommerce solutions.

33 Comments

  1. Good post Chris! Viva Arizona, thanx from Brussels – Belgium.

    They key has been the LogFormat line for vhost_combined in the apache2.conf file

    Now I can keep my virtualhosts in each site-available. Cheers!

    Reply

  2. i am having the same problem but when i add your logformat code into my apache config apache wont start

    Reply

    1. @rater,

      Do you have a specific error that would show up in your /var/log/messages or Apache logs?

      I’ve moved to a different configuration since this original post, but if you have specific error messages that might help you discover why this isn’t working for you.

      Reply

  3. Thank you. Helped me.

    Reply

  4. Hey! This is kind of off topic but I need some advice from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but I
    can figure things out pretty fast. I’m thinking about making my own but
    I’m not sure where to begin. Do you have any tips or suggestions?
    With thanks

    Reply

  5. Hello exceptional blog! Does running a blog like this take a great deal of work?

    I’ve absolutely no expertise in programming however I was hoping to start my own blog soon. Anyhow, if
    you have any recommendations or techniques for
    new blog owners please share. I understand this is off
    subject however I just had to ask. Cheers!

    Reply

  6. viagra order autsralia on line viagra questionarre – generic viagra walmart

    Reply

  7. overnight generic viagras can i buy viagra without a prescription – when is the best time to take viagra

    Reply

  8. generic viagra blogs best viagra deals from india – viagra sildenafil

    Reply

  9. generic zithromax 500mg zithromax prescription in canada – zithromax online usa

    Reply

  10. how much is prednisone 10mg prednisone for sale – purchase prednisone no prescription

    Reply

  11. can you buy amoxicillin over the counter canada cheap amoxicillin – amoxicillin order online

    Reply

  12. buy stromectol stromectol for sale – ivermectin 12 mg

    Reply

  13. stromectol uk ivermectin for sale humans – ivermectin 6mg dosage

    Reply

  14. ivermectin tablets generic stromectol – where to buy stromectol online

    Reply

  15. ivermectin 3 mg tabs stromectol 3 mg tablets price – ivermectin cost

    Reply

  16. buy stromectol online uk stromectol tablets – buy stromectol online uk

    Reply

  17. buy prescription drugs from canada prescription drugs without doctor approval – ed causes and cures

    Reply

  18. ed drugs over the counter prescription drugs without prior prescription – best ed pill

    Reply

  19. best ed medications pet meds without vet prescription – viagra without a prescription

    Reply

  20. erectile dysfunction remedies canada ed drugs – ed clinics

    Reply

  21. lexapro online prescription lexapro 10mg – lexapro generic brand name

    Reply

  22. lipitor 80 mg price buy lipitor – lipitor 20mg price australia

    Reply

  23. ivermectin where to buy ivermectin tablets for humans for sale – stromectol otc

    Reply

  24. ivermectin 12 mg generic stromectol – п»їorder stromectol online

    Reply

  25. ivermectin 12 mg stromectol – how much does ivermectin cost

    Reply

  26. Hi, i think that i saw you visited my website so i came to “return the
    favor”.I’m attempting to find things to improve
    my site!I suppose its ok to use some of your ideas!!

    Reply

  27. lexapro 10 mg lexaprognr – generic for lexapro

    Reply

  28. Hi! I simply would like to offer you a big thumbs up for
    your excellent info you have got right here on this post.
    I will be coming back to your blog for more soon.

    Reply

  29. cost of viagra viagra over the counter – buy generic 100mg viagra online

    Reply

  30. This article will assist the internet people for building up
    new webpage or even a blog from start to end.

    Reply

  31. ed pills cheap buy cheap prescription drugs online – ed meds online without prescription or membership

    Reply

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.