Scaling Services with Stateful Event Flow
Intent Modern services are designed to be stateless, meaning a server processes requests only based on the information provided without having to rely on information from earlier requests. This is the ideal scenario but real-life processing flows do not always comply with that principle, such as: There are more than one processing server available to process an event flow that relies on the knowledge of previous executions; Scaling up server instances amid processing of large volumes of events; Use of sharding architecture; All this requires a stateful approach to routing so that the API calls and events contain sufficient data with each request to ensure proper routing and application behaviour. This is required to maintain the lineage of the flow to prevent: accidental loss of information; or worse, race conditions due to the events being processed in the wrong order by different instances of service. Following are some approaches for mitigation. Sticky Session Load ...