Network Server - proactive vs reactive pattern

390 Views Asked by At

Context (C++): I need to develop a network server, which can handle more than 1000 clients per second, with more than 100 requests per second. Each request starts a state machine between the client and server, wherein the client and server exchange further data, before the server sends a final response.

Problem : Some of the processing is done by a third party library that requests callbacks from us and calls these callbacks when it requires some data from the client. So, we dont controll this thread and must wait for the data from client before we can process further.

Question: With such a high amount of messages, we decided we would use libevent or some of its derivatives e.g. https://github.com/facebook/wangle or https://github.com/Qihoo360/evpp.

The problem is that libevent is based on reactor pattern and we do not have a way to leave processing in a thread as soon as it enters the state machine.

So, my question is if the proactor pattern would be better here, and is there any library that can give us this behavior?

[Edit1]

OK, so after much deliberation, we decided that we should go ahead and make a "proxy" in front of our application. this proxy can then distribute the load to multiple running instances of our application using this 3rd party. Then we can use reactor pattern.

Any other suggestions are welcome..

0

There are 0 best solutions below