API Maker

The backend engine for the AI era

Case study 03 · P99 latency

From 2.4 seconds to 38 ms: taming the slowest 1%

LendLoop Finance lends small amounts to 210,000 shop owners through a mobile app. The average answer was fine. The slowest one in a hundred was not, and those were the payment screens. LendLoop moved its busiest APIs to API Maker, and the P99 fell from 2.4 seconds to 38 ms.

  • 38 msP99 of the loan APIswas 2,400 ms
  • 0.01%of payments time outwas 1.8%
  • 6 → 2servers for the same trafficCPU under 35% at peak
  • 4.6star rating on the app storeswas 4.1, five months before

The challenge

Where LendLoop was stuck

Every morning at 10, the shop owners of LendLoop open the app to repay yesterday's loan and take today's. For 99 of them the app answered in a fraction of a second. For the 100th it spun for two or three seconds, and sometimes the payment timed out after the money had left the bank.

Those were the worst minutes for the support team. A payment that timed out meant a customer who had paid, an app that said they had not, and a call to the bank to check. In March 2025 support logged 1,900 such tickets.

The backend team had tried everything they knew in Node.js: bigger servers, a second cache, a queue for the slow reports. The average went down. The P99 did not. Garbage collection pauses, N+1 queries in the loan history and a connection pool that ran dry at 10 am came back every time, in a new form.

  • A long tail on the money screensP50 was 180 ms, but P99 was 2,400 ms, and the slowest calls were the ones that moved money.
  • Retries made it worseThe app retried after 3 seconds. Each timeout became two requests, at the busiest minute of the day.
  • More servers did not helpThey went from 3 to 6 servers in a year. The tail stayed, and the bill doubled.

The solution

What they built with API Maker

The published benchmarks of API Maker show a P99 of about 50 ms on a $5 server with 1 vCPU, at 2,400 requests a second. The CTO ran the same test on LendLoop's own data and a 4 vCPU server before believing it. The engine is written in Rust, so there is no garbage collector to pause it. The team moved the ten busiest APIs first, behind the same URLs, and kept Node.js for the rest.

  1. The ten busiest APIs first

    The load balancer sent /loans and /repayments to API Maker and the rest to the old backend. The app did not change.

    Auto Generated APIs
  2. One call instead of forty queries

    The loan history read each repayment with a query of its own. Deep populate now reads a loan with its repayments and their receipts in one call.

    Deep Populate
  3. A Redis cache that clears itself

    The rate cards and the limits of each shop are cached. A write to a table clears the cache of that table, so nobody ever sees an old limit.

    Automatic Caching
  4. Credit rules in TypeScript, with tests

    The credit checks became custom APIs in TypeScript, with test cases that mock the answers of the bank.

    Custom APIs
  5. Measured, not guessed

    Monitoring shows the time of every API. The team checks the P99 each morning after 10 am, the way they used to check the ticket queue.

    Monitoring and Logs

The numbers

Before and after

Response time of the repayment API at 10 am (ms)

  • Node.js backend, 6 servers
  • API Maker, 2 servers
05001,0001,5002,0002,500P50, Node.js backend, 6 servers: 180 ms180 msP50, API Maker, 2 servers: 9 ms9 msP50P90, Node.js backend, 6 servers: 620 ms620 msP90, API Maker, 2 servers: 17 ms17 msP90P95, Node.js backend, 6 servers: 1,150 ms1,150 msP95, API Maker, 2 servers: 24 ms24 msP95P99, Node.js backend, 6 servers: 2,400 ms2,400 msP99, API Maker, 2 servers: 38 ms38 msP99
05001,0001,5002,0002,500P50, Node.js backend, 6 servers: 180 ms180P50, API Maker, 2 servers: 9 ms9P50P90, Node.js backend, 6 servers: 620 ms620P90, API Maker, 2 servers: 17 ms17P90P95, Node.js backend, 6 servers: 1,150 ms1,150P95, API Maker, 2 servers: 24 ms24P95P99, Node.js backend, 6 servers: 2,400 ms2,400P99, API Maker, 2 servers: 38 ms38P99

The same API, the same database, the same hour of the day.

P99 of the loan APIs, week by week (ms)

05001,0001,5002,0002,500W1W2W3W4W5W6W7W8W9W10W11W12First APIs movedW1, P99: 2,410 msW2, P99: 2,380 msW3, P99: 2,290 msW4, P99: 1,720 msW5, P99: 1,350 msW6, P99: 960 msW7, P99: 640 msW8, P99: 310 msW9, P99: 140 msW10, P99: 62 msW11, P99: 41 msW12, P99: 38 ms2,410 ms38 ms
05001,0001,5002,0002,500W1W3W5W7W9W12First APIs movedW1, P99: 2,410 msW2, P99: 2,380 msW3, P99: 2,290 msW4, P99: 1,720 msW5, P99: 1,350 msW6, P99: 960 msW7, P99: 640 msW8, P99: 310 msW9, P99: 140 msW10, P99: 62 msW11, P99: 41 msW12, P99: 38 ms2,41038

Each drop is an API moved to API Maker.

The results

What changed for LendLoop

  • Payments that do not hangTimed-out payments fell from 1.8% to 0.01%. Tickets about them went from 1,900 a month to 14.
  • Two servers instead of sixThe same traffic runs on two 4 vCPU servers, each under 35% CPU at 10 am. The old backend is switched off.
  • Happier shop ownersThe rating of the app rose from 4.1 to 4.6 in five months. The most common word in new reviews is "fast".
  • A P99 worth showingThe P99 is now on the board report every month, next to the loan book.
Averages lie. Our customers do not live in the average, they live in the slowest second of their day. API Maker gave us a P99 we are proud to put on a slide.
CTOLendLoop Finance

What comes next. LendLoop is moving the last reports off the old backend. Then the whole API will run on the two servers.

Have a problem like LendLoop?

Try API Maker on your own computer for free, or tell us about your project.