From dgaudet@arctic.org Sat Apr 18 13:47:30 1998 Date: Sat, 18 Apr 1998 13:46:09 -0700 (PDT) From: Dean Gaudet To: new-httpd@apache.org Cc: "David S. Miller" Subject: pthread update X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. Reply-To: new-httpd@apache.org Ok, I'm successfully running zeusbench against it, 10 simultaneous clients, for 60 seconds without crashes. Performance is slightly worse than a non-threaded apache (they're both right around 1200r/s on this p-ii 266Mhz, 128Mb SDRAM system, across loopback, 6k file, linux 2.0.34pre8). I'm not sure why yet -- that's what I'll be working on next. I was getting so confused wandering around http_main.c that I decided to just create an os/pthread directory and move http_main.c to it, and tear out anything I wasn't needing. It would be excellent if http_main could be split up into win32 specific stuff, unix specific stuff, and common stuff. Here's a list of what has needed attention so far: - ap_get_time() cannot be made thread-safe without putting the ctime result into thread local store... I didn't care to do that. Instead I changed it to pass in a buffer, and use ctime_r(). (This is probably needed by WIN32) - ap_ht_time(), ap_gm_timestr_822(), and ap_get_gmtoff() need to use the localtime_r() and gmtime_r() functions to be threadsafe. (These are probably needed by WIN32.) - http_main.c stuff: - a bunch of crud needs to be in thread local store, so I moved it there... and I created the tls() macro to access thread local store. - ptrans has two incompatible uses -- during configuration in the parent it's used for the temporary pool that is deleted at the end of config. In child_main it's used for the per-transaction pool. I split up the two uses, and made "ptrans" a local to child_main. This was the major bug that held me back a few days ago. - skip detach() because I'm not sure the fork() works right with the threads - alloc.c: there's a race in clear_pool() that needs to be cleaned up, I removed the locks that the win32 port uses to deal with it... because I'm going to be doing the full lockless solution Ben Hyde and I talked about. I'm working on a redhat 5.0 system with the latest updates installed, plus I installed a 2.0.34pre8 kernel with one tweak that lets gdb attach to threads. Here's the Configuration settings I'm using: EXTRA_CFLAGS=-Wall -Wshadow -Wmissing-prototypes -pipe -fno-common -DTOP_FUEL -DLTHREAD -D_REENTRANT -DDEBUG_SIGSTOP EXTRA_LDFLAGS=-g -Wl,-Map -Wl,httpd.map EXTRA_LIBS=-lpthread The rest is stock Configuration. I'm using conf/highperformance.conf and have no intention of trying the default configuration for some time... I'm only thinking about serving static content at the moment. The patch can be found at: http://www.arctic.org/~dgaudet/apache/1.3/threaded_fuel-3.patch Remember to use the -p option to patch to create the os/pthread directory. The patch should work fine against current cvs HEAD. Time to enjoy some sunshine! Dean