httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <p...@querna.org>
Subject setting TZ env var
Date Tue, 15 Nov 2011 16:06:29 GMT
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?

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.

Thoughts?

Thanks,

Paul

Mime
View raw message