On busy web servers, the process of writing to the access_log can sometimes overwhelm the spindles in a server. In Apache 2.0.41, the developers added the experimental “BufferedLogs” directive to buffer access_log entries in memory, and write them out as a single group. The documentation indicates that setting “BufferedLogs” to “On” enables buffered logging, but I couldn’t find anything that described how to configure the size of the buffer. After a bit of poking around in mod_log_config.c, I noticed that the size of the buffer was controlled by the LOG_BUFSIZE macro:
if (len + buf->outcnt > LOG_BUFSIZE) {
flush_log(buf);
}
if (len >= LOG_BUFSIZE) {
apr_size_t w;
str = apr_palloc(r->pool, len + 1);
for (i = 0, s = str; i < nelts; ++i) {
memcpy(s, strs[i], strl[i]);
s += strl[i];
}
w = len;
rv = apr_file_write(buf->handle, str, &w);
}
To see what LOG_BUFSIZE was set to, I searched for the value in mod_log_config.c. This is what my search turned up:
#ifdef PIPE_BUF
#define LOG_BUFSIZE PIPE_BUF
#else
#define LOG_BUFSIZE (512)
#endif
Nifty! So if PIPE_BUF is defined, that will be used as the size. Now to see what the value of PIPE_BUF is set to on my CentOS 4.4 server:
$ cd /usr/include && find . | xargs grep PIPE_BUF
./linux/limits.h:#define PIPE_BUF 4096
So PIPE_BUF is set to a 4k buffer on my CentOS 4.4 server, and this value will be used if it exists. I am curious to see if there are any downsides to using extremely large buffers (hosting providers might be interested in using something larger than 4k). More testing is needea.
While debugging a problem a few weeks back, I needed to generate a core file from a hung process. I typically use the gcore utility to generate core files from running processes, but in this case I was already attached to the process with gdb, so gcore failed:
$ gcore 2575
ptrace: Operation not permitted.
You can't do that without a process to debug.
Gak! I remembered reading about a gdb option that would dump core, so I wandered off to read through my gdb notes. Sure enough, gdb has a “generate-core-file” command to create a core file:
$ gdb -q - 2575
Attaching to process 2575
Reading symbols from /usr/sbin/gpm...(no debugging symbols found)...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Reading symbols from /lib/tls/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/tls/libc.so.6...
(no debugging symbols found)...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
0x0046e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) generate-core-file
Saved corefile core.2575
(gdb) detach
Detaching from program: /usr/sbin/gpm, process 2575
(gdb) quit
$ ls -al core.
-rw-r--r-- 1 root root 2468288 Dec 11 13:49 core.2575
Nifty! I am starting to wonder if there is anything gdb can’t do. :)
I grew up listening to hard rock in the 80s, and to this day, this is still my favorite decade for music. The music was hard, the lyrics were original, and the stage antics at most hair band concerts was itself worth the price of admission. One band that was right in the middle of the 1980s music revolution was The Cult.
A few months ago I got the chance to see The Cult play at a small local venue. I had no idea what to expect, but the minute Billy Duffy and Ian Astbury took the stage, I knew I was in for a treat. The show started with the song “Lil’ Devil,” and was followed by a slew of hits, including “Here comes The Rain,” “The Witch,” “Edie (Ciao Baby),” “Revolution, “Fire Woman, “Rise,” “Sweet Soul Sister,” “Spiritwalker,” “Wild Flower,” “Star,” and their biggest hit, “She Sells Sanctuary.”
Not only did the band sound incredible, but you could tell they were there for the fans. This was clearly shown when members of the audience jumped on stage to sing along with the band. Not only did the band members push security out of the way to let the individuals stay, but they brought them close to their microphones to involve them in the show. The members of The Cult are truly world class performers, and they put on one heck of a show!
A year or so ago, I modified my ldap-ping.pl script to create a script (http-ping.pl) that would measure the time it took to retrieve a specific URI from a web server. While scouring the OpenBSD ports collection for website monitoring tools, I came across http_ping. This is a great tool for measuring the time it takes to retrieve a URI, and is a far superior tool to the one I wrote. Here is an example of http_ping in action:
$ http_ping http://prefetch.net/
6220 bytes from http://prefetch.net/: 290.232 ms (79.652c/89.816r/120.764d)
6220 bytes from http://prefetch.net/: 281.06 ms (70.564c/90.036r/120.46d)
6220 bytes from http://prefetch.net/: 281.274 ms (70.968c/89.61r/120.696d)
6220 bytes from http://prefetch.net/: 290.858 ms (80.459c/89.81r/120.589d)
^C
--- http://prefetch.net/ http_ping statistics ---
4 fetches started, 4 completed (100%), 0 failures (0%), 0 timeouts (0%)
total min/avg/max = 281.06/285.856/290.858 ms
connect min/avg/max = 70.564/75.4108/80.459 ms
response min/avg/max = 89.61/89.818/90.036 ms
data min/avg/max = 120.46/120.627/120.764 ms
There are all kinds of nifty pieces of software stashed away in the OpenBSD ports collection, and I am on a mission to locate and blog about each and every one of them! :)
After almost four years with my current employer, I have decided to move on. I found leaving my current job somewhat difficult, since I work with some incredibly talented people (I worked with people that could tell you the history of the world, how to make the perfect spinache quiche, and several individuals that could recite from memory the layout of the memory map that is passed between the BIOS/EFI and the kernel on x86 platforms). It is also hard leaving an environment you poured lots of nights and weekends into, but at the end of the day I guess you shouldn’t become attached to the bits you helped change. Testing new waters should be awesome, and I can’t wait to get back into the trenches in my new role. I think the positive slogan goes something like “onwards and upwards?” Viva!