Thank you for your time. I did what you suggest, and I've noticed two strange things.
1. Compiling showed me the following warnings:
gcc -o mytest mytest.c -lpthread
mytest.c: In function ‘child’:
mytest.c:83: warning: format ‘%3d’ expects type ‘int’, but argument 4 has type ‘ clock_t’
mytest.c:83: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘c lock_t’
mytest.c:83: warning: format ‘%d’ expects type ‘int’, but argument 6 has type ‘c lock_t’
and so on ...
2. I was not able to test it with 500threads - it is production server, so ... I did it with 16.
### Test:
looptype : cont
samplesleep : no
## start ##
## done. ##
loop total:
user : 8800 ms
system : 80 ms
elapse : 4000 ms
error : 0
result: GOOD
Segmentation fault
^^^
Result is good - but there is a segmentation fault.
Furthermore, testing with apache, I found that the source of the problem are the threads that are dying - because if I leave MaxSpareServers=MaxClients and MaxRequestsPerChild=0 ( so no thread is killed) then CPU usage seems normal.
Hi Scott,
Thank you for your time. I did what you suggest, and I've noticed two strange things.
1. Compiling showed me the following warnings:
gcc -o mytest mytest.c -lpthread
mytest.c: In function ‘child’:
mytest.c:83: warning: format ‘%3d’ expects type ‘int’, but argument 4 has type ‘ clock_t’
mytest.c:83: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘c lock_t’
mytest.c:83: warning: format ‘%d’ expects type ‘int’, but argument 6 has type ‘c lock_t’
and so on ...
2. I was not able to test it with 500threads - it is production server, so ... I did it with 16.
Here is the result:
./mytest 16
### Prep:
loops_per_tick: 289017
threads : 16
### Test:
looptype : cont
samplesleep : no
## start ##
## done. ##
loop total:
user : 8800 ms
system : 80 ms
elapse : 4000 ms
error : 0
result: GOOD
Segmentation fault
^^^
Result is good - but there is a segmentation fault.
Furthermore, testing with apache, I found that the source of the problem are the threads that are dying - because if I leave MaxSpareServers =MaxClients and MaxRequestsPerC hild=0 ( so no thread is killed) then CPU usage seems normal.