[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Fwd: [Libevent-users] Using libevent in multi-threaded server





On 2017-12-08 12:03, Azat Khuzhin wrote:
On Fri, Dec 8, 2017 at 1:36 PM, Leif Thuresson <leif.thuresson@xxxxxxxx> wrote:
Hi Azat,
Thanks for your reply.
Using one event_base per thread is an idea I haven't thought of -
Interesting.
One drawback that comes to mind with this design is that a network
connection
will stay with the same thread forever.
If you need, you can move it into another event_base later, just
remove all active events, and then re-add that events into another
event_base.
Yes you are right. The connections can be moved.
I'll have to think about how smoothly it can work with the backend server functions.

About bufferevents and built-in openssl support.
Yes I looked at this and it would certainly simply my code, but with
my original design idea all the SSL encryption would have been done in the
thread running the event_base so that's why I ruled it out.
Do you have any pros for this idea?
The main advantage of having the event_base thread only watch for events and then hand out I/O ops to a work queue serviced by the thread pool is that it automatically distributes
the load to all threads in the pool.
Also I earlier worked with an in-house server framework that operated in this way so I guess I was a bit biased
when coming up with ideas for this new server.

   Azat.

P.S. please do not use top-posting.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.