Live data from Hacker News

How setting the TZ environment variable avoids thousands of system calls

blog.packagecloud.io

1–10 of 148 posts

Re: How setting the TZ environment variable avoids thousands of system calls

#2
Good blog post explaining the behavior of glibc, I also saw this first hand when profiling Apache awhile back too:

http://mail-archives.apache.org/mod_mbox/httpd-dev/201111.mb...

https://github.com/apache/httpd/blob/trunk/server/util_time....

The internals of glibc can often be pretty surprising sometimes, I'd really encourage people to go spelunking into the glibc source when they are profiling applications.

Re: How setting the TZ environment variable avoids thousands of system calls

#6

does anyone know if this impacts docker images as well ?

Yes, at least the Docker images that use glibc as their libc. (eg, most Debian/Ubuntu images)

It looks like musl, which is used on Alpine Linux images for example, will only read it once, and then cache it:

https://github.com/esmil/musl/blob/master/src/time/__tz.c#L1...

It has a mutex/lock around the use of the TZ info, but avoids re-stat'ing the localtime file.

Re: How setting the TZ environment variable avoids thousands of system calls

#9
post #7

Side note - why do some sites completely hide information about who is behind them? I couldn't find a single thing about that on their blog or main site.

Maybe it's just that I use packagecloud and follow people in their circle on Twitter, but Joe Damato is the CEO and founder: https://twitter.com/joedamato

I'm under the impression that he may also write a lot these himself? Not entirely certain, though.

Post reply on HN