Graceful: stat64 DocumentRoot directories

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

 



Hi,

 

I have a couple of questions about the inner workings of the apachectl graceful command and I can’t seem to find the answer anywhere so maybe you can help.

 

Normally with a graceful the following happens.

I issue a graceful.

With strace I see something like this:

stat64("/usr/local/apache/conf/sites/www.blah.com", {st_mode=S_IFREG|0644, st_size=680, ...}) = 0

open("/usr/local/apache/conf/sites/www.blah.com", O_RDONLY) = 4

fstat64(4, {st_mode=S_IFREG|0644, st_size=680, ...}) = 0

read(4, "ServerRoot /usr/local/apache\n###"..., 4096) = 680

stat64("/usr/local/apache", {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, ...}) = 0

read(4, "", 4096)                       = 0

etc.etc.

Then I see this:

            stat64("/usr/home/ws/blah/www.blah.com/www/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

etc.etc.

 

So my config is read and the DocumentRoots from the VHost are ‘statted’ on the disc.

This process/pid is done rather quickly after which I see that this process terminates. During this time Apache functions fine!

Next I can see with strace that the main Apache thread is “taking over”. So in this case 25527.

25527 ?        Ss    10:01 /usr/local/apache/bin/httpd -k start  

 5371 ?        S      0:15  \_ /usr/local/apache/bin/httpd -k start

 

According to strace this happens:

stat64("/usr/home/ws/blah/www.blah.nl/www/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

etc.etc.

Apache is “statting” all the DocumentRoot directories on disk.

This usually takes a long time and at this point Apache stops accepting new threads! This is really painful.

 

My question based on my observations are:

I did a little research on the stat64 function and this seems to be a function that causes a lot of IO. From what I gather all extended file attributes for all dirs are processed. This seems like of lot of attributes.

1. It seems Apache does an stat64 of my DocumentRoots twice! Why? This doesn’t make sense. First with the graceful command and next the Apache process itself.

2. Is there a way to get rid of stat64 or use a lighter/less intense stat function?

3. Further it seems when Apache is actually restarting/gracefulling that Apache stops accepting new threads. This isn’t very convenient. What can I do about this?

 

I run my Apache server from a NFS storage mount. Statting files by querying their (extended) attributes is very costly/slow/inefficient. So I’m running into problems; are there ways to speed this up (apart from the obvious NFS and other filesystem optimizations I have done).

I seems Apache is statting the directories because it wants to make sure it exists. But should I care whether a DocumentRoot from a Virtual Host exists? I’ve tested deleting directories and this doesn’t crash Apache. So what’s the reason behind this.

 

Hope someone can provide some insight.

 

Cheers.

 

Jan van den Berg

 

 

 

 


[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