Support me on Patreon to write more tutorials like this!

I run a worker that refreshes post statistics for a large dataset of creators on a social platform. It reads from the platform's app endpoint, computes aggregates, and writes them to Elasticsearch. I wanted it faster. For several days it refused to get faster, and I spent them blaming things.
This post is the list of things I blamed, in order, with the measurement that ended each one. Most of the theories were reasonable. None of them was the answer.
TL;DR
- More fetchers per pod helped about threefold, up to eight. After that it stopped helping, and the per-pod yield halved.
- Two pods with disjoint exit IPs collapsed together. The ceiling is not per IP.
- Fetching fewer posts per request changed nothing. Identities the platform issues itself were far worse than the ones I generate.
- A pod that has been up for a day or so degrades, and a restart fixes it. I don't know why, and I only have a couple of days of data on the restart schedule I put in place.
- The headline number was a peak. The sustained rate was about half of it.
The ladder
Every row below used the same queue and population. The windows were 8 to 12 minutes long.
| Shape | Written / min | Per-pod yield |
|---|---|---|
| 1 pod × 4 fetchers | 12.2 | 0.70 |
| 1 pod × 8 fetchers | 38.1 | 0.78 |
| 2 pods × 8, no identity rotation | 30.2 | 0.37 / 0.055 |
| 2 pods × 8, rotate identity on an empty answer | 46.6 | 0.295 / 0.36 |
| 2 pods × 12 fetchers, 500 ms spacing | 87.4 | 0.185 / 0.305 |
Yield here is the share of recent fetch attempts that produced a write. A breaker watches it and stops the worker when it falls too low.
One caveat before the theories. A 10-minute window can't resolve a difference under about 25% when the platform's throttle drifts. My own notes record the same two-pod, eight-fetcher configuration at 46.6 written a minute in one window and 36.0 in the next. So I trust the yield column more than the throughput column, and I trust the very large gaps (12.2 to 38.1) and the very small yields (0.055) more than anything in between.
Theory 1: it's my own machinery
The first thing to check was whether my side was the bottleneck. Going from four fetchers to eight on one pod tripled the write rate, so the pod had room. At the 12-fetcher step the worker was using 33 to 398 millicores of a one-core limit, and my 500 ms spacing allowed 120 fetch starts a minute per pod while the pods ran about 54.
So CPU and pacing were not the limit.
Theory 2: add pods
If one pod does 38 a minute, two should do more. The two-pod row above wrote 30.2. That drop is inside the window noise, so I won't call it a regression. The yields are what I'd point at: 0.37 and 0.055. Both pods degraded together, despite running on different nodes with different node IPs.
What helped was changing the client identity and retrying when a fetch came back empty. That took the two-pod shape to 46.6. Without that step, a second pod looked worse than none.
Theory 3: it's per exit IP
This was my best theory. My notes listed two candidates for the limit, "the proxy exit IP / shared app constants", and the first was the one I could test. If it was per exit IP, giving the two pods separate exit pools should let each run at full yield.
On 2026-10-26 I tried it. One pod stayed on the default pool and a second drew from a disjoint set. I let it run for 30.4 minutes. The first pod wrote 1,028 aggregates with rolling yield sliding from 0.265 to 0.065. The second wrote 1,150 with yield falling from 0.215 to 0.03. Both collapsed together while the fleet as a whole wrote 71.7 a minute with zero errors and closed breakers.
If the cap were per exit IP, the two pods shouldn't have degraded at the same time. I reverted the split. The notes now say the cap is "app-level", meaning something shared that I don't see. That is an inference from elimination, not something I demonstrated, and I'll come back to it.
Theory 4: send less data
If the limit is about volume, a smaller payload should help. I cut the sample from 35 posts per creator to 25, which dropped the per-fetch payload from about 1.1 MB to about 0.8 MB.
Both pods stayed in the same low yield band (0.15 and 0.265), and the fleet stayed at about 47 to 51 written a minute, exactly as at 35. I removed the override and went back to the deeper sample.
Theory 5: better identities
The worker generates a client identity locally. The platform can also issue one itself, which looked like a more legitimate thing to present. I ran one pod that way, with the same concurrency, spacing and sampling as the others.
Registration worked. Over 24 minutes the pod wrote 5 aggregates against 571 empty pages, a rolling yield of zero. The pods using generated identities, at the same concurrency, sat at 0.15 to 0.27. I deleted the canary. Platform-issued identities were worse than the ones I make up, for this endpoint.
What did help
Three things moved the number, and I only fully understand one.
Concurrency up to eight fetchers per pod gave about threefold. Going to twelve fetchers (and tightening the spacing to 500 ms) bought 27% more and roughly halved the yield.
Rotating the identity on an empty answer took the two-pod shape from 30.2 to 46.6. That one I follow: an empty page often means a single identity has been throttled, and a fresh one recovers.
Restarting pods daily is the one I can't explain. On 2026-10-28 I found that pods drift into throttled episodes after roughly a day of uptime. One 44-hour pod sat at 0.005 yield, and its replacement reached 0.75 within nine minutes. Its sibling had already slid from 0.19 to 0.04. Rotation on empty doesn't clear it, and a fresh process does. A daily restart job at 04:30 UTC now does that.
The notes guess that a new process gets a new set of egress connections. That is a reading, not a test. I haven't verified it, and I have only a couple of days of data on whether the daily restart holds.
The peak and the table that flattered the winner
The 87.4 a minute in the ladder was a peak. A 24-hour check on the same shape measured about 47 to 51 written a minute sustained. The 87.4 was the first window after the rollout, and I'd have written it up as the result if I hadn't kept measuring.
The same check found the two pods wildly asymmetric: one at 0.72 yield and one at 0.135. The low pod was nearly idle on CPU. It was answering empty pages, not doing work.
There is one more way I almost fooled myself. When I compared the app-endpoint path against the older web path over 24 hours, the app path wrote 34.7 a minute and the web path wrote 20.6, with 0.07% hard errors against 14.4%. That looks like a throughput win. But the app path ran 2 pods × 8 fetchers and the web path ran 1 pod × 4: sixteen fetchers against four. Per fetcher that is about 2.2 written a minute against 5.2. The app path won on reliability. In the equal-concurrency window it actually wrote about 20% fewer a minute, with zero errors against 45 in a roughly ten-minute window.
What I don't know
- Why the ceiling exists. "App-level" is what's left after I removed the other explanations. It could be an account budget, shared constants, or something I haven't thought of. I haven't shown which.
- Whether the disjoint pools were really disjoint from the platform's point of view. My notes say so; I haven't independently checked.
- Whether the daily restart works over a week. I have one measurement of a stale pod against a fresh one, and a couple of days of the schedule.
- Whether a longer window changes any of the small differences above. Several of my rows are within the noise I measured.
What I'd keep from this is cheap: when a number won't move, write down what you're blaming and give each theory one experiment that could kill it. My favorite, the exit-IP theory, was already half-written into my notes as the explanation. A 30-minute test took it out.