Skip to main content
coding advanced

Configure Production Load Balancer Architecture

Get step-by-step load balancer configuration for high-availability systems. Includes Nginx, HAProxy, and cloud solutions.

Works with: chatgptclaudegemini

Prompt Template

You are a senior DevOps engineer specializing in high-availability infrastructure. I need to set up a production-grade load balancing solution with the following requirements: **System Details:** - Application type: [APPLICATION_TYPE] - Expected traffic: [EXPECTED_TRAFFIC] - Backend servers: [BACKEND_SERVERS] - Infrastructure: [INFRASTRUCTURE_TYPE] - Budget constraints: [BUDGET_RANGE] **Requirements:** - High availability with failover - SSL termination - Health checks - Session persistence if needed - Monitoring and logging Please provide: 1. **Architecture recommendation** with diagram description 2. **Detailed configuration files** for the recommended load balancer 3. **Health check setup** with appropriate endpoints 4. **SSL certificate configuration** including renewal automation 5. **Monitoring setup** with key metrics to track 6. **Failover procedures** and disaster recovery steps 7. **Performance tuning** recommendations 8. **Security considerations** including DDoS protection 9. **Cost optimization** strategies 10. **Step-by-step deployment guide** with testing procedures Include specific commands, configuration snippets, and explain any trade-offs between different approaches. Consider both on-premises and cloud-native solutions.

Variables to Customize

[APPLICATION_TYPE]

Type of application being load balanced

Example: Node.js REST API with PostgreSQL database

[EXPECTED_TRAFFIC]

Expected traffic volume and patterns

Example: 10,000 requests/minute peak, 2,000 concurrent users

[BACKEND_SERVERS]

Number and specifications of backend servers

Example: 4 servers, 8GB RAM, 4 CPU cores each, running on port 3000

[INFRASTRUCTURE_TYPE]

Infrastructure platform and constraints

Example: AWS EC2 instances with Application Load Balancer option

[BUDGET_RANGE]

Budget constraints for the solution

Example: $500-1000/month including monitoring and backup

Example Output

## Architecture Recommendation For your Node.js API with high traffic requirements, I recommend a multi-tier load balancing approach using AWS Application Load Balancer (ALB) with Nginx as reverse proxy. **Architecture:** ``` Internet → CloudFlare CDN → AWS ALB → Nginx (2 instances) → Node.js Apps (4 instances) ``` ## ALB Configuration ```yaml Type: AWS::ElasticLoadBalancingV2::LoadBalancer Properties: Type: application IpAddressType: ipv4 SecurityGroups: [!Ref ALBSecurityGroup] Subnets: [!Ref PublicSubnet1, !Ref PublicSubnet2] ``` ## Health Check Setup ```javascript // Health check endpoint app.get('/health', (req, res) => { // Check database connection db.query('SELECT 1', (err) => { if (err) return res.status(503).json({status: 'unhealthy'}); res.json({status: 'healthy', timestamp: new Date()}); }); }); ``` ## Nginx Configuration ```nginx upstream backend { least_conn; server 10.0.1.10:3000 max_fails=3 fail_timeout=30s; server 10.0.1.11:3000 max_fails=3 fail_timeout=30s; } server { listen 80; location / { proxy_pass http://backend; proxy_set_header X-Real-IP $remote_addr; } } ``` **Monitoring:** Use CloudWatch with custom metrics for response time <200ms and error rate <1%. **Estimated cost:** $650/month including ALB, monitoring, and SSL certificates.

Pro Tips for Best Results

  • Test your load balancer configuration in a staging environment that mirrors production traffic patterns
  • Implement gradual traffic shifting when deploying new backend versions to minimize risk
  • Set up automated health checks that test actual application functionality, not just server availability
  • Configure session stickiness only when necessary, as it can impact load distribution efficiency
  • Monitor both technical metrics (response time, error rates) and business metrics (conversion rates) to measure true performance impact

Tags

Want 500+ Expert Prompts?

Get the Premium Prompt Pack — organized, tested, and ready to use.

Get it for $29

Related Prompts You Might Like