Asynchronous and Synchronous together!
https://github.com/cppexecutor/gexecutor
Finally completed framework that solves pressing problems in many high transactions applications in real world scenarios.I love asynchronous architectures and applications. But, every now and then there is a requirement to make synchronous API calls like third party API, or do a database call for configuration information that is synchronous.
GExecutor provides a unified way to handle synchronous and asynchronous tasks by abstracting them from underlying thread and process architecture. It is a C++ library which offers similar capabilities like Executor framework in Java and Twisted in Python.
One of the well studied patterns for implementing a High performance I/O bound applications is to use asynchronous processing of client requests. Multiple client requests can be served without the cost of context switching thus achieving better performance at lower CPU and memory requirements. Such a design pattern is also referred as reactor pattern. Libraries like libevent or boost::asio make it easy to implement reactor patterns built on lower level APIs like kqueue, epoll, select etc.
Multi-threaded or multi-process performance can outperform a single threaded systems by using concurrent data structures or shared memory in spite of added context switches and locking overheads in a reactor pattern. However, such systems may not perform well due to bad locking design (coarse), deadlocks, and complex data structures based on shared memory. More details on this discussion can be found at C10K Problem.
GExecutor offers a hybrid solution to take advantage of both paradigms and make it simple to use appropriate pattern for different aspects of application without loss of performance. It is a hybrid event loop based task processing framework which handles and routes tasks between async event loops and worker threads for processing synchronous tasks. It is designed as a utility that can be layered on top of libevent or asio.
Existing applications can continue to use their current bindings to native interfaces and just use GExecutor for deferred task processing.
cheers!