Reactor pattern

The reactor software design pattern is an event handling strategy that can respond to many potential service requests concurrently.

[1] By relying on event-based mechanisms rather than blocking I/O or multi-threading, a reactor can handle many concurrent I/O bound requests with minimal delay.

[1] With its balance of simplicity and scalability, the reactor has become a central architectural element in several server applications and software frameworks for networking.

[1][2] From a design standpoint, both approaches tightly couple the general demultiplexer with specific request handlers too, making the server code brittle and tedious to modify.

These considerations suggest a few major design decisions: Combining these insights leads to the reactor pattern, which balances the advantages of single-threading with high throughput and scalability.

[citation needed] However, the reactor pattern does have limitations, a major one being the use of callbacks, which make program analysis and debugging more difficult, a problem common to designs with inverted control.

[2] Another way to maximize throughput is to partly reintroduce the approach of the "thread per connection" server, with replicated dispatchers / event loops running concurrently.