Re: Many threads in Linux
- From: Scott Gifford <sgifford@xxxxxxxxxxxxxxxx>
- Date: Wed, 12 Dec 2007 17:42:17 -0500
Scott Gifford <sgifford@xxxxxxxxxxxxxxxx> writes:
Eric Sosman <Eric.Sosman@xxxxxxx> writes:
[...]
[ ... extremely helpful information elided ... ]
The rest of your post was extremely helpful, and I very much
appreciate all the time you've put into responding to my posts! I
will try some of your suggestions and report back what I find.
OK, here is what I found.
The limitation I was hitting was running out of PIDs. I increased the
maximum PIDs in the system and recompiled, and was able to get up to
about 60,000 threads before the Linux out-of-memory killer killed my
process. It happened when my process reached about 1GB of VM, and I
have my kernel configured with a 3G/1G memory split, so I will try
with a 2G/2G split and see if that makes a difference.
The test I'm doing is a very simple echo server. The server is in C
and uses pthreads, one thread per client. The client is in perl and
uses epoll. I've posted the code I used here (I modified it somewhat
to improve clarity, including increasing the stack size by 4KB to
allow printing error messages, so results will not be identical),
along with a description of the changes I made to my system and the
benchmark results:
http://www.suspectclass.com/~sgifford/manythreads/
Here are the results I saw:
THREADS VIRT MEM RES MEM REQ/S
------- -------- ------- -----
1000 18m 9m 35218
10000 159m 79m 35216
20000 317m 159m 33659
30000 474m 238m 33733
40000 632m 318m 35183
50000 789m 398m 28864
60000 947m 477m 28018
It does start to slow down a bit, but overall the performance is
not too bad.
The client and server ran on the same machine, which kept network
latency to a minimum, but meant they shared the system's 2 cores. I
didn't try to determine whether the performance was limited by the
client or server, but top reported that the client was using about 10%
more of the CPU than the server on all runs.
I will report back if I have luck with the 2G/2G split. In the
meantime, any thoughts are welcome, particularly if you see flaws in
my methodology or code.
----Scott.
.
- Follow-Ups:
- Re: Many threads in Linux
- From: Hallvard B Furuseth
- Re: Many threads in Linux
- From: Eric Sosman
- Re: Many threads in Linux
- From: Scott Gifford
- Re: Many threads in Linux
- From: David Schwartz
- Re: Many threads in Linux
- References:
- Many threads in Linux
- From: Scott Gifford
- Re: Many threads in Linux
- From: David Schwartz
- Re: Many threads in Linux
- From: Scott Gifford
- Re: Many threads in Linux
- From: Marcel Müller
- Re: Many threads in Linux
- From: Scott Gifford
- Re: Many threads in Linux
- From: Eric Sosman
- Re: Many threads in Linux
- From: Scott Gifford
- Many threads in Linux
- Prev by Date: Re: Many threads in Linux
- Next by Date: Re: Design Questions on Termination
- Previous by thread: Re: Many threads in Linux
- Next by thread: Re: Many threads in Linux
- Index(es):
Relevant Pages
|