Travel API latency: what you can fix and what you can't

The ticket says "search is slow". You open the trace for a Dubai–London round trip and your own code is a thin sliver at the start and another at the end. Everything in between is waiting: on a GDS, on two NDC airlines, on a hotel aggregator that answers whenever it feels like it. Travel API latency is the one performance problem where the profiler keeps pointing at code you did not write and cannot deploy. That changes what "fixing it" means, and most of the effort teams spend on it goes to the wrong half.
Where travel API latency actually goes on a multi-supplier search
A single flight search on a booking engine is not one request. It is a fan-out. The engine takes the origin, destination, dates and passenger mix, builds a supplier-specific request for every source it is allowed to query for that route, sends them all at once, and then waits. Each supplier has its own clock: a GDS session that was warm or was not, an NDC gateway that is re-pricing on the airline's side, a bedbank that is itself fanning out to channel managers behind it. The response you can show the user is bounded below by the slowest supplier you chose to wait for, not by the average.
That is the first thing to internalise. Adding a supplier never makes a complete search faster. It only ever adds another lane that has to clear before the whole result set is "done".
Then the responses come back and the work you do own begins: parsing a large XML or JSON payload per supplier, mapping their airport, airline and fare codes onto yours, deduplicating the same itinerary that three sources returned at three prices, applying the markup rules for whichever tenant is asking, converting currency, and sorting. On a busy route this phase is not free, and it is the one place a profiler will tell you something actionable. We wrote about the hotel side of this in designing a hotel availability client for slow suppliers; the flight side has the same shape with more codes to map.
So the honest breakdown of a slow search is three buckets:
- Supplier wait — the longest single supplier response. You do not control it.
- Your post-processing — parse, map, dedupe, price, sort. You control all of it.
- Delivery — serialising the merged result and getting it to the browser. Usually small, occasionally the surprise.
The half you can fix, and the half you should stop trying to
Start with the second bucket, because it is yours. The usual findings, in the order they tend to appear: a mapping step that looks up every airport code against the database one at a time instead of loading the table once; a currency conversion that calls a rate service per fare instead of per search; a dedupe routine that compares every itinerary against every other; serialisation that re-walks the object graph for each tenant. None of this is exotic. All of it is fixable in a sprint, and the fix survives.
Connection handling is the other place the win is real. A fresh TLS handshake to a supplier on every search is pure overhead; a pool of warm connections, kept alive across searches, removes it. GDS sessions in particular are expensive to open and cheap to reuse, which is why session management is a product feature in that world and not an implementation detail.
Now the half to stop fixing. You cannot make a supplier answer faster. You can shout at your account manager, and sometimes a route gets moved to a faster node, but the response time of someone else's system is not a variable in your deployment. Teams that forget this spend quarters shaving their own post-processing from a sliver to a thinner sliver while the supplier wait, which was most of the total, has not moved. The profiler was honest with them. They just kept optimising the part it said was fine.
What you can do about a slow supplier is decide how long you are prepared to wait for it, and what the user sees while you do. Which is the rest of this piece.
Progressive rendering is the honest answer
If the complete result set is bounded by the slowest supplier, then the only way to show the user something sooner is to stop waiting for the set to be complete. Show results from the first supplier that answers. Add the next supplier's results when they land. Let the user start reading, filtering and comparing while the stragglers are still in flight. This is progressive rendering, and it is not a trick; it is an accurate representation of what is actually happening on the server.
It has consequences that are worth designing for rather than discovering:
- Sort stability. A list sorted by price that re-sorts every time a supplier lands will move the fare the user was about to click. Insert new results in place, or batch them and let the user pull them in, but do not reshuffle under a cursor.
- "Cheapest" is provisional. Until the last supplier is in, any claim of lowest fare is a claim about the suppliers that have answered. The interface should make that state visible rather than pretend completeness.
- The booking step must re-check. A fare shown from an early response may be gone by the time the user clicks. That is true in non-progressive designs too, but progressive rendering makes the window larger. The booking integration piece covers the re-price step; it is not optional here.
- Caching gets simpler, not harder. Per-supplier results can be cached with per-supplier lifetimes. A bedbank's static rates can live for hours; an NDC offer, minutes. One monolithic merged result forces the shortest lifetime on everything.
The API shape that supports this is a search that returns an identifier immediately and lets the client poll or subscribe for results as they arrive, with each batch tagged by source and a flag that says whether the search is still open. The platform's own flight and hotel APIs are built around that shape; the travel APIs page describes the surfaces, and access starts as a conversation rather than a self-serve key, so bring the questions.
Timeouts per supplier, not per request
One timeout on the whole search is the most common mistake in this layer, and it is wrong in both directions at once. Set it short, and a slow-but-valuable supplier is cut off on every search and you quietly stop selling its inventory. Set it long, and one hanging supplier holds every result hostage, including the ones that arrived immediately.
| Decision | Single timeout for the whole search | A budget per supplier |
|---|---|---|
| One supplier hangs | Everyone waits, then everyone fails or everyone is cut off | That supplier is dropped from this search; the rest are shown |
| A slow supplier with good fares | Either always excluded or always slowing the page | Given a longer budget than the fast ones, and rendered late |
| Retrying | Retry the whole fan-out, doubling load on suppliers that already answered | Retry only the one that failed, if it is worth retrying at all |
| What the user sees | Spinner, then everything or an error | Results filling in, and a "still searching" state that eventually closes |
| What operations sees | "Search timed out", with no indication which source caused it | A timeout count per supplier that can be put next to that supplier's name |
| Tuning it | One number argued about forever | One number per supplier, set from that supplier's own history |
The per-supplier budget is also where the commercial reality lives. A supplier whose fares are rarely chosen does not deserve the same patience as the one that wins most of your bookings on a route. A consolidator's net fares on a Gulf–subcontinent route might be worth waiting for; a fourth bedbank returning the same hotels as the first three is not. The budget is a product decision expressed as a number, and it should be set per supplier, per tenant if the tenants differ, and revisited.
Two refinements that pay for themselves. First, a budget is not only a maximum; a supplier that returns in a fraction of its budget but with an empty set is a different signal from one that times out, and the two should be counted separately. Second, retries belong at the supplier level and should be rare. Retrying a search against a supplier that just timed out usually means two searches queued on their side, which makes the next one slower too, and on metered contracts it costs money.
What to measure so the number means something
"Average search time" is the number everyone reports and the one that tells you least. It blends a cached hotel lookup with a six-supplier international fan-out, it hides the supplier that is the cause, and it moves when traffic mix moves rather than when your code does. Replace it with a small set of measurements that each answer one question.
- Time to first result, per search. This is what the user experiences as speed. It is bounded by your fastest supplier plus your own overhead, which is the part you can actually improve.
- Time to complete, per search, with the identity of the supplier that closed it. If one supplier is always last, that is a budget conversation, not an engineering one.
- Per-supplier response time, as a distribution, not a mean, and tagged by route and time of day. A supplier that is fine in the morning and slow in the evening looks fine on an average and is not.
- Timeouts as a result class, counted alongside "returned results" and "returned empty", per supplier. A timeout is a result you did not get, and it belongs in the same chart as the ones you did.
- Your own post-processing time, separately. When this grows, you have a code problem. When supplier wait grows, you have a conversation.
- Searches per booking, per supplier and per tenant. Every search you send costs the supplier capacity, and most contracts care about the ratio. A latency fix that doubles your search volume through retries has made the number worse, not better.
Measure at the point the user sees it, too. A server that reports fast searches while the browser waits on a slow serialisation step is telling the truth and misleading you at the same time.
What it costs you when you get this wrong
The obvious cost is the one in the ticket: a user who waits, then leaves. The less obvious ones are commercial. A single search-wide timeout set too short silently removes a supplier from your results on every search, and you only find out when the account manager asks why bookings stopped. Retrying whole fan-outs doubles your searches-per-booking, and suppliers who meter that ratio respond by throttling you or by invoicing you. Re-sorting a progressive list under the user's cursor produces mis-clicks on the wrong fare, which become support tickets and sometimes refunds. And an average-based dashboard lets all three of these happen while the number on it stays green.
None of these are solved by making your code faster. They are solved by deciding, per supplier, how long you will wait, showing the user what you have while you wait, and measuring the thing that actually moved. The code speed-ups are worth doing. They are just not the part that was wrong.