Hi,I've developed a script that uses gevent and urllib3 to stress a web server.
I was expecting that the bottleneck of this script to be the user-cpu or the system load but I was surprised with a completely different behaviour.When the number of parallel requests increases, I've noticed that the soft interrupts rate increases dramatically. At the same time, a process called ksoftirqd becomes very active (I'am on linux/debian).I've used mpstat to monitor cpus and remarked that when the soft interrupts rate reaches 100% of one of the cpu cores, the machine freezes for about 20 to 60 seconds. This behaviour is very annoying for my tests.So my questions are :1. Do you think gevent (0.13) or libvent can cause these soft interrupts ?2. If yes, do you think things can be better with gevent 1.0/libev ?3. What function calls should I avoid to use if I want to improve things ?Thanks,
Hi,I'am still having the problem. I've tried to monitor the soft interrupts in /proc/interrupts. When the number of "local timer interrupts" exceeds 250 per second, and one of the cpu cores is completely busy treating these interrupts (100%), I start having socket errors (Errno 133, no route to host and Errno 110 operation timed out).The system freeze is caused by the fact that when the crawlers encounter an error, they retry after some time which results in more interrupts (snowball effect).Is anyone having similar issues ?Cheers,On Sat, Jul 14, 2012 at 10:45 AM, Rayene Ben Rayana <rayene.b...@gmail.com> wrote:
Hi,I've developed a script that uses gevent and urllib3 to stress a web server.
I was expecting that the bottleneck of this script to be the user-cpu or the system load but I was surprised with a completely different behaviour.When the number of parallel requests increases, I've noticed that the soft interrupts rate increases dramatically. At the same time, a process called ksoftirqd becomes very active (I'am on linux/debian).I've used mpstat to monitor cpus and remarked that when the soft interrupts rate reaches 100% of one of the cpu cores, the machine freezes for about 20 to 60 seconds. This behaviour is very annoying for my tests.So my questions are :1. Do you think gevent (0.13) or libvent can cause these soft interrupts ?2. If yes, do you think things can be better with gevent 1.0/libev ?3. What function calls should I avoid to use if I want to improve things ?Thanks,
Hi,I once had a similar problem where the amount of context switches/interrupts went up. After some investigation i found some faulty code that tried to recv on a socket when there was no more data. Might be unrelated but it crossed my mind.
Code was doing something like:while True:data = sock.recv()buffer += dataif len(buffer) >= expected:break
And regarding your 100% cpu usage, i assume you are using threads or fork() to utilize the other cores?