architecture of high performance an tcp server

c, epoll, tcp

Solution

There is no simple answer. What type of server do you want ?

- many parallel short connections (standard www)

- many parallel quite long connections (small to medium uploads)

- mix of 1 and 2

- very long heavy connections (big uploads)

What server(machine) will you use (128 x weak cpu/8 x powerful cpu ) ?

More universal is: one dispatcher, some workers, the dispatcher listen on all connections using epoll and dispatches incoming datas to workers, workers handle no IO event

Problem

I am working on a project to develop an high performance tcp server and I decided to use epoll and multi-threading. But I find it difficult in designing server and now I am quite puzzled with this two designs: one dispatcher, some workers, the dispatcher listen on all connections using epoll and dispatches incoming datas to workers, workers handle no IO event. one listener, only deal with listening event, and when a new connection is coming, it accepts it and dispatch it to a worker, every worker has an epoll fd and then listen to this new socket. witch one is better, or any better designs ? thanks!

Original source