A UK healthcare SaaS company

16× under load test

Hot API routes served up to 16 times more requests per second, with 43 to 89% lower p95, on load tests at production shape.

16×Throughput on hot routes, on load tests

Outcomes

  • 1.7× to 16.3× requests per second on the fixed routes.
  • 43 to 89% lower client p95.
  • Surveys list: 4.5 to 74 requests per second, and 1,110 ms to 122 ms p95.
  • Questions list: 613 to 18 queries per request.

All figures on this page come from load tests at production shape, not from production.

The problem

Hot mobile and web routes were slow, worst in the region furthest from the database.

Spot checks found single requests issuing 2,640 to 3,148 SQL queries.

What I built

  • A local load-test harness at production Puma shape: seeders, a load runner and an aggregator for production route data.
  • Ranked routes by production latency, then fixed serializer N+1 queries and heavy SQL shapes.
  • Regression specs that put an upper bound on query counts, so the fixes stay fixed.
  • An evidence pack with the plan, the results and the reasons not to partition tables yet.
  • One change that did not hold up in staging was reverted rather than shipped.

Architecture and stack

  • Ruby on Rails, Sidekiq, PostgreSQL
  • Custom load harness, k6
  • Cloud Run