Disbalanced traffic distribution with CF load balancer and session affinity


We have load balancing with Cloudflare. We have 1 pool, 2 origins with the same weight, and session affinity is enabled with the cookie + IP option.

In load balancing analytics, we observe that the traffic distribution between these 2 origins is something like 75% to the first origin and 25% to the second.

Is there a way to fix that? We would like to split traffic equally, and we need session affinity due to the nature of our applications.
Thanks for your answer.

The issue of “Disbalanced traffic distribution with CF load balancer and session affinity” suggests that there may be an uneven distribution of incoming network traffic among the servers behind the Cloudflare (CF) load balancer, despite the use of session affinity. Here are some steps you can take to address this issue:

  1. Check Load Balancer Configuration:
  • Ensure that your load balancer is correctly configured. Double-check the settings related to load balancing algorithms and session affinity (also known as sticky sessions). Different load balancers have different settings, so consult the documentation for your specific load balancer.
  1. Session Affinity Configuration:
  • Verify that session affinity is enabled and configured correctly. Session affinity ensures that requests from the same client are consistently directed to the same server. This is important for applications that rely on server-side session state.
  1. Load Balancer Algorithm:
  • Review the load balancing algorithm being used. Different algorithms distribute traffic in various ways (e.g., round-robin, least connections, IP hash). Consider adjusting the algorithm based on your application’s needs.
  1. Server Health Checks:
  • Confirm that all servers are healthy and responding to health checks. Load balancers often use health checks to determine the availability of servers. If a server is marked as unhealthy, the load balancer will reduce or stop sending traffic to that server.
  1. Monitoring and Logging:
  • Implement monitoring and logging to track the traffic distribution and identify any patterns or anomalies. This can help you pinpoint when and where the traffic distribution becomes disbalanced.
  1. Adjust Load Balancer Settings:
  • If the issue persists, you may need to adjust the load balancer settings based on the observed traffic patterns. This could involve tweaking parameters such as weights, thresholds, or timeouts.
  1. Review Network Topology:
  • Examine your network topology to ensure that there are no network issues causing traffic imbalances. For example, check for network bottlenecks or misconfigurations.
  1. Cloudflare Support:
  • If you are using Cloudflare, consider reaching out to Cloudflare support for assistance. They can provide insights into your specific setup and help troubleshoot any issues.
  1. Scale Resources:
  • Evaluate whether the current number of servers is sufficient to handle the incoming traffic. Scaling up or down based on demand can help ensure that resources are utilized optimally.
  1. Review Application Design:
  • Assess the design of your application to ensure that it is compatible with the load balancing and session affinity mechanisms in place. Some applications may require specific considerations for effective load balancing.

By systematically reviewing and adjusting these aspects, you should be able to identify and resolve the disbalanced traffic distribution issue with your CF load balancer and session affinity.