httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: setting TZ env var
Date Wed, 16 Nov 2011 10:39:14 GMT
On 15.11.2011 17:06, Paul Querna wrote:
> So, I was looking at all the system calls we make in a single request,
> and comparing it to nginx.
>
> We were actually pretty close, baring supporting our features like
> htaccess, there was only one thing that stood out.
>
> Glibc is opening, calling fstat twice, and then reading /etc/localtime
> for every request:
>
> [pid 31496]      0.000051 open("/etc/localtime", O_RDONLY) = 8<0.000014>
> [pid 31496]      0.000041 fstat(8, {st_mode=S_IFREG|0644, st_size=118,
> ...}) = 0<0.000011>
> [pid 31496]      0.000048 fstat(8, {st_mode=S_IFREG|0644, st_size=118,
> ...}) = 0<0.000010>
> [pid 31496]      0.000048 mmap(NULL, 4096, PROT_READ|PROT_WRITE,
> MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbd87efa000<0.000013>
> [pid 31496]      0.000040 read(8,
> "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0"...,
> 4096) = 118<0.000015>
> [pid 31496]      0.000051 lseek(8, -62, SEEK_CUR) = 56<0.000011>
> [pid 31496]      0.000034 read(8,
> "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0"...,
> 4096) = 62<0.000011>
> [pid 31496]      0.000048 close(8)      = 0<0.000012>
>
>
> One way to fix this, is to set the TZ environment variable.
>
> For example:
>    <https://github.com/pquerna/httpd/commit/37e5815a70e88a733cd088398d016803146b545f>
>
> This specific patch has some issues, but is there any objections to
> the concept of setting the timezone on process startup?

Fine for me.

> This single change gives about a 2% performance boost in my testing.
>
> To merge to trunk I'd like to have it detect your active timezone,
> instead of forcing UTC+0, but if you changed timezones on your
> machine, you will need to restart httpd.

I'd say it is OK. I assume a "apachectl restart" would do?
It should be expected for a long running daemon to signal it to adopt to 
environmental changes like the timezone.

Regards,

Rainer

Mime
View raw message