Software Development

What is the best Load Balancing algorithm to prevent server overload for long-lived sessions?

ST Asked by Steven Clark · 08-07-2025
0 upvotes 9,866 views 0 comments
The question

I am managing a pool of servers where the processing time for each request varies significantly. We currently use Round Robin, but some servers are getting overwhelmed while others stay idle because some sessions take 30 minutes to complete. Should I switch to Least Connections or Weighted Round Robin? How do these algorithms handle session persistence (sticky sessions) in a production cluster?

3 answers

0
MA
Answered on 11-07-2025

If your request times vary, Round Robin is definitely the wrong choice because it assumes all requests are equal. You should switch to "Least Connections." This algorithm tracks how many active sessions each server is currently handling and sends new traffic to the server with the lowest count. This naturally balances the "heavy" 30-minute sessions across your fleet. For session persistence, you'll need to enable "Sticky Sessions" using cookies. This ensures that once a user is assigned to a server, they stay there for the duration of their task, preventing state loss in the middle of a transaction.

0
TH
Answered on 13-07-2025

Have you checked if your backend servers have different hardware specs, or are they all running on identical virtual machine instances?

CH 14-07-2025

Thomas, if the hardware is different, he should definitely look into "Weighted Least Connections." It allows you to assign a higher weight to more powerful servers so they can handle a larger portion of the active sessions. It's a lifesaver when you're in a transition period moving from older on-premise hardware to newer, faster cloud instances without decommissioning the old ones.

0
SU
Answered on 15-07-2025

Least Connections is the standard for long-lived tasks. Round Robin is only good when all your tasks take roughly the same amount of time to finish.

ST 16-07-2025

I agree with Susan. We had the same issue with our data export service until we switched. Round Robin was killing our "unlucky" nodes that got hit with multiple heavy jobs.

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session