Zbr's days.
February
Sun Mon Tue Wed Thu Fri Sat
       
10
     
2007
Months
Feb

About TODO Blog RSS Old blog Projects Gallery Notes

Sat, 10 Feb 2007

Test which shows how broken is thread-like AIO design.


Linus has proposed yet another way to do async syscalls.
It is a bit similar to fibrils, but different in that regard, that Linus' patch just creates a new real thread if async call blocks. So, when syscall blocks, system returns to user as a different thread.

There is a huge problem with that - per syscall thread creation/destruction. Linus, why do you think people do not create new thread each time new client has connected to web server?

Artificial example with sys_stat64() does not count - try to have thousands of such threads.

That approach sucks even more than fibrils, imho, althogh Zach's one has a problem, that fibril is always created no matter if call does not block.

Rescheduling is a problem.

To prove that this is a huge problem I've setup a simple test - I changed all sockets allocation from process context (actually only TCP sending functions) to GFP_ATOMIC, so when they will fail, and thus process will put into sleep, since previous allocation policy was GFP_KERNEL, a new thread would be created.
So, I got following results:

tcp_sendmsg: sock: ffff810038e57900, wait: 562.
tcp_sendmsg: sock: ffff810038e57340, wait: 563.
tcp_sendmsg: sock: ffff810038e56d80, wait: 564.
tcp_sendmsg: sock: ffff810038e567c0, wait: 565.
tcp_sendmsg: sock: ffff810038e56200, wait: 566.
printk: 20458 messages suppressed.
tcp_sendmsg: sock: ffff81003363d300, wait: 21025.
and the like...

That was a simple couple of seconds test run of ab benchmark against 2.6.20 kernel with lighttpd web server - about 4k connections per second, 80k connections total, trivial index page (got from debian installer) on athlon64 with 1gb of ram connected over 1gbit link.

And during that simple test system would created 21k threads?
No way, it is just broken design. It is wrong.

So, read my lips - ev-e-ry-thing con-nec-ted to the net-work sle-eps.

Linus, if you read this (although I doubt), please, do not make terrible mistake.
Do not include kevent, if you do not want, but please think about above test before it is too late.

/devel/kevent/aio :: Link / Comments (0)

Please solve this captcha to be allowed to post (need to reload in a minute): 57 + 57

Comments are closed for this story.