CodexBloom - Programming Q&A Platform

Inconsistent Behavior in CI/CD Pipeline with Weighted Round Robin Load Balancing

πŸ‘€ Views: 0 πŸ’¬ Answers: 1 πŸ“… Created: 2025-09-28
ci-cd nginx load-balancing

I'm optimizing some code but Hey everyone, I'm running into an issue that's driving me crazy... I'm relatively new to this, so bear with me. I've looked through the documentation and I'm still confused about Building a CI/CD pipeline for our microservices architecture, we've integrated a weighted round robin load balancing mechanism using NGINX. However, we're noticing some inconsistencies in how requests are being distributed among the services. Specifically, we expect requests to be directed more heavily to a service with a higher weight, but the distribution seems uneven. Here's an excerpt from our NGINX configuration: ```nginx upstream backend { server service_a:80 weight=3; server service_b:80 weight=1; server service_c:80 weight=1; } server { location / { proxy_pass http://backend; } } ``` Despite this configuration, when we run load tests using a tool like JMeter, the request counts for each service reveal an almost equal distribution, unlike the expected 3:1 ratio for `service_a` compared to the others. I've tried adjusting the weights and re-running the tests, but the result remains the same. Additionally, I've verified that the upstream server instances are healthy and responsive. The JMeter setup seems fine, using a simple HTTP request sampler targeting the service endpoint. Interestingly, the issue appears more pronounced under heavy loads. During testing with 1000 concurrent users, the logs show that `service_a` is not processing requests as expected, while the other services are receiving a disproportionate number. Looking into NGINX’s documentation, it mentions that the context of upstream configuration can impact how weights are applied. Could this behavior be influenced by other configurations in NGINX? Is there something in the load test configuration that I might be missing? Any insights on verifying or adjusting the load balancing strategy would be greatly appreciated. This is part of a larger API I'm building. Has anyone else encountered this? Thanks in advance! My development environment is macOS. For reference, this is a production desktop app. I'd love to hear your thoughts on this. I'm using Nginx 3.9 in this project. Am I missing something obvious?