Re: Strange problem while epoll handling after fork&exec



On Dec 28, 7:23 pm, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:


Hi, Thanks for your reply.

On Dec 27, 1:03 am, Elanoir <Taehwan.W...@xxxxxxxxx> wrote:

For faster processing massive TCP connection requests, I am using
epoll.

Okay, so you are dealing with a high rate of connection establishment.

For serialized call to accept from multiple processes, I am using file
lock similar to apache's one.

But you are serializing 'accept', which slows things down.

I think so, but almost same model seems to be used in apache.
For faster access, if one process has the right(exactly lock) to
accept,
it can accept up to 10 pending connection requests at one time.

Can you explain you architecture more clearly? Is there only one
listening socket that is shared by multiple processes? Do you ever
have any preference on which process accepts connections?

Yes, you are right. I am made one listening port shared by more than
two
processes. There is no preference on which process accept connections.
Only one of the processes can accept the incoming connections if it is
idle.


You don't want more than one process calling 'epoll' on the same
listening socket because you will get a thundering herb. But
serializing 'accept' is not the solution, since it's not 'accept'
that's the problem but discovery on the listening socket.

If you only have one listening socket, I would recommend only having
one process that accepts connections on it. This process can hand off
connections to other processes as desired, based on load or whatever.

DS
If accept-and-handover is possible in linux, it would be the best
solution to me.
Could you please let me get any hint of that?
In my implementation,
I have one 'master' process.
when it started up, it makes a socket bound to a service port,
and forks several processes which come to listen the bound socket.
In this processing flow, is it possible to do 'accept-and-handover' an
accepted socket to
child processes after forked?

If you let me know any hint, I would be really really appreciated.
Thanks in advance.

THW


.



Relevant Pages