O'Reilly logo

Web Performance Tuning, 2nd Edition by Patrick Killelea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

System Calls Made by a Web Server

Here’s a system call trace (to trace all requests made of the operating system) on Linux 2.0 of what Apache 1.2.4 does in response to a request from a browser. To make this trace, I simply started Apache with one child process and traced that one process while making a request from a browser. You usually can’t tell why an application decided to make a particular system call, but this is still a very valuable technique for figuring out where a server is spending its time. I used a similar trace by Dean Gaudet to decipher what is happening here.

(The lines are numbered to simplify the discussion afterwards.)

1  # strace -p1147 2 accept(16, {sin_family=AF_INET, sin_port=htons(1034), sin_addr=inet_addr("127.0.0. 1")}, [16]) = 3 3 fcntl(18, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 4 rt_sigaction(SIGUSR1, {SIG_IGN}, {0x80596c0, [], SA_INTERRUPT|0x4000000}, 8) = 0 5 getsockname(3, {sin_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("127.0. 0.1")}, [16]) = 0 6 setsockopt(3, IPPROTO_TCP1, [1], 4) = 0 7 brk(0x80b3000) = 0x80b3000 8 read(3, "GET / HTTP/1.0\r\nIf-Modified-Sinc"..., 4096) = 336 9 rt_sigaction(SIGUSR1, {SIG_IGN}, {SIG_IGN}, 8) = 0 10 time(NULL) = 988240305 11 stat("/home/httpd/html", {st_mode=S_IFDIR|0777, st_size=2048, ...}) = 0 12 lstat("/home", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0 13 lstat("/home/httpd", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0 14 lstat("/home/httpd/html", {st_mode=S_IFDIR|0777, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required