You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Adi Linden <ad...@adis.on.ca> on 2004/01/17 04:16:15 UTC

[users@httpd] VirtualHost and Memory Consumption

Hi,

I am running a server with many VirtualHost sections (6058 right now). 
Each httpd process on the server starts out with using about 61MB of 
memory. If the VirtualHosts are removed, httpd uses only about 3MB, much 
more reasonable.

How can I host this many VirtualHosts on a single server without having 
such significant memory usage per process?

Thanks,
Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Virtual Name-based Hosts and DNS

Posted by Ted <te...@KI5U.net>.
Hello to all.

I see a lot of posts addressing virtual name-based hosts on this 
forum.  Yet most domain forwarders do not support the proper format to use 
them.  A helpful domain expert indicated that the issue could be addressed 
in the server (locally) by setting up DNS to point to domains and 
sub-domains.  I'm running RedHat 9 which has a GUI for configuring DNS, but 
extremely incomplete instructions.  Could someone please point me to a good 
step-by-step tutorial to configure DNS to get named-based virtual hosts 
working?

Thanks in advance.

Ted


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 16 Jan 2004, Adi Linden wrote:
> I had a look at the mod_vhost_alias description. I doesn't look like it
> will do what I need. Here is an example VirtualHost section:
>
>     <VirtualHost *:80>
>         ServerName adilinden.example.org
>         ServerAlias www.adilinden.example.org
>         DocumentRoot /home/adilinden/public_html
>         ScriptAlias  /cgi-bin/  /home/adilinden/public_html/cgi-bin/
>     </VirtualHost>
>
> As you can see, both adilinden.example.org and www.adilinden.example.org
> need to go to the same /home/adilinden/public_html directory.

This can be done either using symbolic links in the filesystem or using
mod_rewrite to catch those cases.  (But mixing mod_rewrite and
mod_vhost_alias is a tricky business, so a possible alternative is to do
the whole thing with mod_rewrite.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Adi Linden <ad...@adis.on.ca>.
On Sat, 17 Jan 2004, Joshua Slive wrote:
> In addition to what has been mentioned about getting more accurate memory
> usage info, you should consider using mod_vhost_alias, which is designed
> to handle thousands of vhosts without giving each a (memory-consuming)
> <VirtualHost> section.

I had a look at the mod_vhost_alias description. I doesn't look like it 
will do what I need. Here is an example VirtualHost section:

    <VirtualHost *:80>
        ServerName adilinden.example.org
        ServerAlias www.adilinden.example.org
        DocumentRoot /home/adilinden/public_html
        ScriptAlias  /cgi-bin/  /home/adilinden/public_html/cgi-bin/
    </VirtualHost>

As you can see, both adilinden.example.org and www.adilinden.example.org 
need to go to the same /home/adilinden/public_html directory.

Thanks,
Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Joshua Slive <jo...@slive.ca>.
On Fri, 16 Jan 2004, Adi Linden wrote:

> Hi,
>
> I am running a server with many VirtualHost sections (6058 right now).
> Each httpd process on the server starts out with using about 61MB of
> memory. If the VirtualHosts are removed, httpd uses only about 3MB, much
> more reasonable.
>
> How can I host this many VirtualHosts on a single server without having
> such significant memory usage per process?

In addition to what has been mentioned about getting more accurate memory
usage info, you should consider using mod_vhost_alias, which is designed
to handle thousands of vhosts without giving each a (memory-consuming)
<VirtualHost> section.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Aaron W Morris <aa...@mindspring.com>.
Adi Linden wrote:
>>Also ... why do you need 6058 virtual host ? all on one server ? 
> 
> 
> Thought it would be great to have users access their page via 
> username.server.tdl instead of server.tdl/~username. The service proved a 
> tremendous success. So now I am struggling to tune server performance to 
> keep up with demand.
> 
> Adi


Assuming that you do not have a bad script somewhere, eating too much 
memory, it sounds like you have reached capacity for the server. 
Frankly, 1GB of RAM is a little low for your setup.


-- 
Aaron W Morris <aa...@mindspring.com> (decep)




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


AW: [users@httpd] VirtualHost and Memory Consumption

Posted by SH Solutions <in...@sh-solutions.de>.
Hi

> Thought it would be great to have users access their page via
username.server.tdl instead of server.tdl/~username. The service proved a
tremendous success. So now I am struggling to tune server performance to
keep up with demand.

So maybe it would help not to have 6058 virtual hosts but only 1 ?

Maybe you could use mod_rewrite to change username.server.tld to
server.tld/~username and let everything else be done by the module that
handles user's home pages ?

cu
  Steffen


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Adi Linden <ad...@adis.on.ca>.
> Also ... why do you need 6058 virtual host ? all on one server ? 

Thought it would be great to have users access their page via 
username.server.tdl instead of server.tdl/~username. The service proved a 
tremendous success. So now I am struggling to tune server performance to 
keep up with demand.

Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Michael Gale <mi...@bluesuperman.com>.
Also ... why do you need 6058 virtual host ? all on one server ? 

Michael.

On Fri, 16 Jan 2004 22:52:27 -0500
Aaron W Morris <aa...@mindspring.com> wrote:

> Adi Linden wrote:
> 
> > Hi,
> > 
> > I am running a server with many VirtualHost sections (6058 right
> > now). Each httpd process on the server starts out with using about
> > 61MB of memory. If the VirtualHosts are removed, httpd uses only
> > about 3MB, much more reasonable.
> > 
> > How can I host this many VirtualHosts on a single server without
> > having such significant memory usage per process?
> > 
> > Thanks,
> > Adi
> 
> 
> Each process is probably not taking 61MB each.  The problem with top
> and ps is it does not take into account shared memory.  Some of that
> memory is being shared between processes.
> 
> If you are using linux, the best way to see how much memory is really 
> being used (at startup) is shutdown the instances and look at the 2nd 
> number under the used column in the "free" command.  Start apache and 
> look at the number again.  Take the difference and you should have 
> reasonable idea of how much memory apache is using.
> 
> NOTE:  Don't look at the first number in the used column....that 
> includes file cache and some miscellaneous items.  On a well utilized 
> server, this number will almost always be 100% of memory.
> 
> 
> -- 
> Aaron W Morris <aa...@mindspring.com> (decep)
> 
> 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


-- 
Hand over the Slackware CD's and back AWAY from the computer, your geek
rights have been revoked !!!

Michael Gale
Slackware user :)
Bluesuperman.com 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Michael Gale <mi...@bluesuperman.com>.
Well then maybe you have another issue, like a PHP script that gets
stuck in a loop or poor memory management caused by PHP or CGI / PERL
pages.

Michael.


On Sat, 17 Jan 2004 20:41:41 -0600 (CST)
Adi Linden <ad...@adis.on.ca> wrote:

> > Correct.  Which actually comes out to just over 2MB per process
> > which is not all that bad.
> 
> The server has 1GB of physical memory and consistently locks up with 
> MaxClients set larger than about 150. With locks up I mean extremely
> slow, using up all available memory and swap space. 
> 
> Adi
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


-- 
Hand over the Slackware CD's and back AWAY from the computer, your geek
rights have been revoked !!!

Michael Gale
Slackware user :)
Bluesuperman.com 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Adi Linden <ad...@adis.on.ca>.
> Correct.  Which actually comes out to just over 2MB per process which is 
> not all that bad.

The server has 1GB of physical memory and consistently locks up with 
MaxClients set larger than about 150. With locks up I mean extremely slow, 
using up all available memory and swap space. 

Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Aaron W Morris <aa...@mindspring.com>.
Adi Linden wrote:
> On Fri, 16 Jan 2004, Aaron W Morris wrote:
> 
> 
>>If you are using linux, the best way to see how much memory is really 
>>being used (at startup) is shutdown the instances and look at the 2nd 
>>number under the used column in the "free" command.  Start apache and 
>>look at the number again.  Take the difference and you should have 
>>reasonable idea of how much memory apache is using.
> 
> 
> Ok, this is free after httpd has been shutdown:
>              total       used       free     shared    buffers     cached
> Mem:       1030684     243724     786960          0       9956     144908
> -/+ buffers/cache:      88860     941824
> Swap:       273024      31844     241180
> 
> And this is free immediately after httpd has been started:
>              total       used       free     shared    buffers     cached
> Mem:       1030684     310008     720676          0      10012     148996
> -/+ buffers/cache:     151000     879684
> Swap:       273024      31844     241180
> 
> After a while, with about 154 httpd processes serving requests, free looks 
> like this:
>              total       used       free     shared    buffers     cached
> Mem:       1030684     823800     206884          0      12280     351356
> -/+ buffers/cache:     460164     570520
> Swap:       273024      31836     241188
> 
> Does this mean apache is likely using 460164kB minus 88860kB for 154 httpd 
> processes that show up in `ps axuw' like this:
>   nobody   29211  0.0  6.0 66544 62344 ?       S    22:05   0:00 httpd
> 
> Thanks,
> Adi

Correct.  Which actually comes out to just over 2MB per process which is 
not all that bad.

You could lower this further by unloading any unnecessary apache modules 
as well as not compiling all of the PHP modules statically and only 
loading the ones you need.  Although, I don't know if I would put that 
much work into it.  :-)


-- 
Aaron W Morris <aa...@mindspring.com> (decep)




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Adi Linden <ad...@adis.on.ca>.
On Fri, 16 Jan 2004, Aaron W Morris wrote:

> If you are using linux, the best way to see how much memory is really 
> being used (at startup) is shutdown the instances and look at the 2nd 
> number under the used column in the "free" command.  Start apache and 
> look at the number again.  Take the difference and you should have 
> reasonable idea of how much memory apache is using.

Ok, this is free after httpd has been shutdown:
             total       used       free     shared    buffers     cached
Mem:       1030684     243724     786960          0       9956     144908
-/+ buffers/cache:      88860     941824
Swap:       273024      31844     241180

And this is free immediately after httpd has been started:
             total       used       free     shared    buffers     cached
Mem:       1030684     310008     720676          0      10012     148996
-/+ buffers/cache:     151000     879684
Swap:       273024      31844     241180

After a while, with about 154 httpd processes serving requests, free looks 
like this:
             total       used       free     shared    buffers     cached
Mem:       1030684     823800     206884          0      12280     351356
-/+ buffers/cache:     460164     570520
Swap:       273024      31836     241188

Does this mean apache is likely using 460164kB minus 88860kB for 154 httpd 
processes that show up in `ps axuw' like this:
  nobody   29211  0.0  6.0 66544 62344 ?       S    22:05   0:00 httpd

Thanks,
Adi


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] VirtualHost and Memory Consumption

Posted by Aaron W Morris <aa...@mindspring.com>.
Adi Linden wrote:

> Hi,
> 
> I am running a server with many VirtualHost sections (6058 right now). 
> Each httpd process on the server starts out with using about 61MB of 
> memory. If the VirtualHosts are removed, httpd uses only about 3MB, much 
> more reasonable.
> 
> How can I host this many VirtualHosts on a single server without having 
> such significant memory usage per process?
> 
> Thanks,
> Adi


Each process is probably not taking 61MB each.  The problem with top and 
ps is it does not take into account shared memory.  Some of that memory 
is being shared between processes.

If you are using linux, the best way to see how much memory is really 
being used (at startup) is shutdown the instances and look at the 2nd 
number under the used column in the "free" command.  Start apache and 
look at the number again.  Take the difference and you should have 
reasonable idea of how much memory apache is using.

NOTE:  Don't look at the first number in the used column....that 
includes file cache and some miscellaneous items.  On a well utilized 
server, this number will almost always be 100% of memory.


-- 
Aaron W Morris <aa...@mindspring.com> (decep)




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org