Messages in this thread Patch in this message | | | Date | Thu, 6 May 1999 17:35:53 -0700 (PDT) | From | Dean Gaudet <> | Subject | Re: Overscheduling DOES happen with high web server load. |
| |
On Fri, 7 May 1999, Alan Cox wrote:
> Why do you use fcntl locks not System5 semaphores - which oddly enough I > think on Linux do have wake one semantics...
I didn't switch to sysvsems because I was worried about them not working in older kernels... whereas we've been using fcntl() for a long time.
I actually did some (crude) timings before apache 1.3.x on linux 2.0.35 -- fcntl() versus flock() versus sysvsem(). I found flock() was the fastest, by some small amount. I bit the bullet and switched to using flock(), because I figured mail clients had it tested well. But then a few random bug reports came in which were solved by the user switching back to fcntl(), so for 1.3.6 I switched linux back to fcntl(). (Interested folks can visit bugs.apache.org, search for flock.)
SysVSem on other platforms have some annoying limitations, such as a small max# of folks that can attach to a semaphore. Plus sysvsems aren't cleaned up on process exit... whereas a fcntl()-locked file can be unlink()ed as long as everyone already has the fd.
In theory you can edit src/include/ap_config.h, search for LINUX, and change the USE_FCNTL_SERIALIZED_ACCEPT to USE_SYSVSEM_SERIALIZED_ACCEPT ... rebuild, and try again.
Ah, you might want this patch, the sysvsem code isn't as well tested as the other code.
Dean
Index: src/include/ap_config.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.257 diff -u -r1.257 ap_config.h --- ap_config.h 1999/05/04 02:57:13 1.257 +++ ap_config.h 1999/05/07 00:33:38 @@ -498,7 +498,7 @@ * folks to tweak their Configuration to get flock. */ #ifndef USE_FLOCK_SERIALIZED_ACCEPT -#define USE_FCNTL_SERIALIZED_ACCEPT +#define USE_SYSVSEM_SERIALIZED_ACCEPT #endif #define SYS_SIGLIST _sys_siglist Index: src/main/http_main.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.435 diff -u -r1.435 http_main.c --- http_main.c 1999/05/05 20:42:58 1.435 +++ http_main.c 1999/05/07 00:33:39 @@ -741,17 +741,21 @@ static void accept_mutex_on(void) { - if (semop(sem_id, &op_on, 1) < 0) { - perror("accept_mutex_on"); - clean_child_exit(APEXIT_CHILDFATAL); + while (semop(sem_id, &op_on, 1) < 0) { + if (errno != EINTR) { + perror("accept_mutex_on"); + clean_child_exit(APEXIT_CHILDFATAL); + } } } static void accept_mutex_off(void) { - if (semop(sem_id, &op_off, 1) < 0) { - perror("accept_mutex_off"); - clean_child_exit(APEXIT_CHILDFATAL); + while (semop(sem_id, &op_off, 1) < 0) { + if (errno != EINTR) { + perror("accept_mutex_off"); + clean_child_exit(APEXIT_CHILDFATAL); + } } }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |