Application Load Balancer Affinity Routing for Stateful Services
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Load balancers often inefficiently route communications for stateful services, leading to increased workload and resource waste due to the need for recalculating persisted state when switching instances, as they are not aware of the persisted state maintained by other instances.
Innovation Solution
An application load balancer assigns a specified identifier to messages based on their characteristics and maps them to specific instances using a load balancing algorithm, ensuring that messages in a sequence are routed to the same instance that persisted the state, thereby maintaining state consistency and reducing workload.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a load balancer routes new communication to a different instance based on current workload, then workload distribution is improved, but state consistency deteriorates because the new instance must recalculate persisted state
Solution Approach 1:
The load balancer performs preliminary actions by tracking and monitoring the persisted state of each service instance before routing decisions are made. This advance knowledge allows the system to proactively route communications to instances that already have the required state, preventing the need for state recalculation and maintaining state consistency while still achieving workload distribution.
Solution Approach 2:
The system implements feedback mechanisms where the load balancer continuously monitors which instances have persisted state for specific communications. This feedback information is used to make informed routing decisions, ensuring that subsequent communications are directed to instances with the necessary state already available, thereby maintaining state consistency across the distributed system.
2Productivity
If communication is switched from one instance to another instance, then load balancing is improved, but resource efficiency deteriorates due to unnecessary state recalculation
Solution Approach 1:
The load balancer performs preliminary monitoring to identify which instances have persisted state for specific communications before routing decisions are made. This advance knowledge allows the system to proactively route communications to instances that already have the required state, preventing the need for state recalculation and maintaining state consistency while still achieving workload distribution.
Solution Approach 2:
Service instances autonomously persist their own state and the load balancer tracks this self-reported state information. This self-service approach allows instances to manage their own state while the load balancer uses this information to make efficient routing decisions, reducing unnecessary state recalculation and improving resource efficiency.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
The present invention extends to methods, systems, and computer program products for load balancing for services. Embodiments of the invention facilitate load balancing between instances of a service based on affinitization of messages, based on content of the message. For example, messages in the same session can be dispatched to the same service instance. A sequence or series of related messages associated with long running and/or stateful services are more likely to be dispatched to the same instance of the service. Thus, if the service instance has persisted client state, there is an increased likely of utilizing the persisted client state and not having another service instance recreate the client state.