Re: vhosts conf file efficiency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-02-14 at 12:18 -0500, Sean Conner wrote:
It was thus said that the Great Tom Evans once stated:
> On Tue, Feb 14, 2012 at 4:32 PM, Sean Conner <spc@xxxxxxxxxx> wrote:
> >  And really, how often is Apache restarted?  On a graceful restart, it can
> > still serve requests.
> >
> 
> It's clear you have a strong opinion on this. I prefer my mission
> critical systems not take longer than necessary to start up, whilst
> you don't seem to mind. Each to their own.

  What I dislike are statements like "it's faster to put all vhosts in your
main configuration file" without anything to back it up.  Noel Butler at
least provided some numbers (1 second for 400 files) so people have *some*
benchmark to go by.  

  So I can live with 5 seconds for 2,000 files if it makes administration
easier on the rare occasions that Apache needs to be fully restarted (not
just a graceful restart).  You prefer to save those five seconds, but don't
mind editing a file with 2,000 vhosts.

I got bored again, using my dev box,
Note, being a dev box, I can afford the luxury of rebooting before each test to ensure no caching...
The VH segments we use in the real world are twice as big with suexec, rewrites, php flags and Dir specific options, but this should give you some sort of idea using a very, very, plain and bare bones config...

If the OP is that worried, he can use the script to do a dummy run using all his real world config sections, which likely are two or three times bigger than the bare test below...

Created 2000 files (see below)

time /etc/rc.d/rc.httpd start

real    0m7.490s
user    0m1.044s
sys     0m0.584s

ls -la /usr/local/apache/conf/vhosts/2000test.com.conf
-rw-r--r-- 1 root root 524 Feb 15 13:25 /usr/local/apache/conf/vhosts/2000test.com.conf



Slightly changed the "open" to send to all one conf file

time /etc/rc.d/rc.httpd start

real    0m5.623s
user    0m0.976s
sys     0m0.444s


ls -lah /usr/local/apache/conf/vhosts/hosts.conf
-rw-r--r-- 1 root root 1.6M Feb 15 13:19 /usr/local/apache/conf/vhosts/hosts.conf



Test script used -

for ($count = 2000; $count >= 1; $count--) {
$DOMAIN = $count ."test.com";
$htroot ="/var/www/vhosts/".$DOMAIN;
mkdir($htroot);
mkdir("$htroot/logs");
mkdir("$htroot/web");
mkdir("$htroot/cgi");
open (STUFF, ">/usr/local/apache/conf/vhosts/$DOMAIN.conf");
print STUFF <<EOF;

<VirtualHost 10.10.0.222>
        ServerName      www.$DOMAIN
        ServerAlias     $DOMAIN
        ServerAdmin     webmaster\@$DOMAIN
        DocumentRoot    $htroot/web
        ScriptAlias     /cgi-bin/ $htroot/cgi/
        CustomLog       $htroot/logs/access_log combined
        ErrorLog        $htroot/logs/error_log
        UserDir disabled
</VirtualHost>

EOF
close STUFF;
}


Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux