Skip to content

Instantly share code, notes, and snippets.

@fabioaraujo121
Created July 23, 2025 13:31
Show Gist options
  • Select an option

  • Save fabioaraujo121/6f7ea4f4a723fe1d8afcbcf983a69a3a to your computer and use it in GitHub Desktop.

Select an option

Save fabioaraujo121/6f7ea4f4a723fe1d8afcbcf983a69a3a to your computer and use it in GitHub Desktop.

⏺ Performance Test Analysis & Infrastructure Review

K6 Test Results Analysis

Smoke Test (1 VU, 30s):

  • ✅ Success Rate: 100% (6/6 requests)
  • ✅ Response Time: P95 = 4.62s (under 8s threshold)
  • ❌ Throughput Issue: Only 0.194 RPS (below 1 RPS threshold)
  • Average Response Time: 3.97s

Load Test (10 VUs, 2min) - Partial Results:

  • Successfully created submissions (201 responses)
  • Response times degrading under concurrent load
  • Many requests taking 6-8+ seconds

Critical Performance Issues Identified

  1. Slow Response Times: 4-8 second response times indicate backend bottlenecks
  2. Low Throughput: Only ~0.2 RPS suggests capacity limitations
  3. Response Time Degradation: Performance worsens under load

Infrastructure Analysis

Assignment Service Configuration:

  • HPA: 2-4 replicas, 80% memory threshold
  • Thread Pool: 2-5 threads, WEB_CONCURRENCY=1
  • Database: Shared PostgreSQL instance (34.82.48.175)

Evaluation Service Configuration:

  • HPA: 2-4 replicas, 80% memory threshold
  • Thread Pool: 2-15 threads, WEB_CONCURRENCY=0
  • Higher Thread Count: Better configured for concurrent processing

Resource Balancing Recommendations

Immediate Actions:

  1. Assignment Service Thread Tuning: WEB_CONCURRENCY: "2" # Currently 1 RAILS_MAX_THREADS: "10" # Currently 5 GOOD_JOB_MAX_THREADS: "8" # Currently 5
  2. HPA Configuration Enhancement: metrics:
  • type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70
  • type: Resource resource: name: memory target: type: Utilization averageUtilization: 80
  1. Database Connection Pool Optimization: RAILS_CHECKOUT_TIMEOUT: "10" # Currently 16s SIDEKIQ_CLIENT_POOL_SIZE: "50" # Currently 30 SIDEKIQ_SERVER_POOL_SIZE: "50" # Currently 30

Infrastructure Concerns:

  1. Single Database: All services use same PostgreSQL instance (34.82.48.175)
  2. Redis Configuration: Using IP instead of service discovery
  3. No CPU-based HPA: Only memory-based scaling configured

Suggested Architecture Improvements:

  1. Database Load Balancing: Consider read replicas
  2. Redis Cluster: Switch to Kubernetes service discovery
  3. Connection Pooling: Implement PgBouncer for database connections
  4. Monitoring: Add request rate and queue depth metrics to HPA

⏺ Summary: Your production API shows significant performance bottlenecks with 4-8 second response times and low throughput (0.2 RPS). The main issues are insufficient thread pool sizing in the assignment service and potential database connection constraints. I recommend increasing WEB_CONCURRENCY to 2, RAILS_MAX_THREADS to 10, adding CPU-based HPA scaling, and implementing database connection pooling to improve performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment