Re: epoll,threading

From: Ingo Oeser
Date: Sat May 26 2007 - 09:15:25 EST


Hi Arunachalam,

On Saturday 26 May 2007, Arunachalam wrote:
> I want to know in detail about , what the events (epoll or /dev/poll or
> select ) achieve in contrast to thread per client.
>
> i can have a thread per client and use send and recv system call directly
> right? Why do i go for these event mechanisms?

Try 30.000 clients or more on a x86 32bit box.
That will show you the difference quite nicely :-)

More seriously: Thread per client scales only to a certain amount of clients
per RAM. If you like to scale beyond that to like to minimize your state
per client. If you have a thread then you have a task structure as
unswappable memory in kernel, a per-thread stack, which is reducing
your virtual memory per process (you have only around 3GB of virtual
memory per process in Linux x86 32bit).

So one uses a process or thread pool to scale beyond that.
Pool size is typically related to the amount of CPU cores in the system.

Regards

Ingo Oeser

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/