Why Threads media sends were slow
When Instagram launched Threads in 2019, media sends reused a lot of existing server infrastructure that wasn’t tuned for low-latency messaging. Posts to Feed have a more forgiving delivery timeline; for direct messaging, send latency directly affects how quickly users can engage. The Media Infrastructure and Threads teams set a goal to halve Threads send latency, targeting the server-side media ingestion path.
The critical piece was the “configure” endpoint, which writes the ingestion metadata needed to render media for recipients. Because this endpoint sits on the critical send path, any reduction in its execution time translates directly to faster end-to-end sends.
Finding the bottleneck in regional writes
Profiling showed the configure endpoint took four times longer in one region’s data centers than in another.
The initial suspicion was an unnecessary round trip between regions. A breakdown of execution time confirmed the endpoint was spending most of its time waiting on I/O from the database that stores media metadata.
The cause traced back to the database’s architecture: it is a write-through cache optimized for reads. Reads hit the cache, but every write must propagate to a backing store to keep the cache consistent. For the slower region, that backing store lived in the faster region, so each write in the configure endpoint triggered an inter-region round trip. The per-write cost was high enough to account for the fourfold difference.
Moving backing stores into every data center wasn’t viable. The practical alternative was to route the initial configure request to the faster region, where the write propagation would be local and effectively batch those round trips away.
A/B testing with header-based routing
Validating the theory required an A/B test with a quick rollback path. The routing layer didn’t support user-aware experimentation, so the team built a workaround:
- The client’s existing A/B test infrastructure added a special HTTP header to configure requests when the user was in the treatment group.
- A routing rule watched for that header and force-routed matching requests to the faster region.
This setup safely exposed a subset of users to the change while allowing immediate revert if needed.
Results
The test confirmed the hypothesis, showing average send-latency improvements of roughly 29 percent overall. That win came from a single server-side routing change. With millions of media sends flowing through the system daily, the team sees further headroom in the same class of optimizations as Instagram’s infrastructure continues to evolve.



