Covers diagnosing chatty client and service-to-service communication and reducing round trips with aggregate endpoints, batch APIs, BFFs, gRPC streaming, data ownership changes and caching, with the trade-offs of each.
Chattiness turns latency into round trips × RTT: 25 sequential calls over an 80 ms mobile link is two seconds before any server work. I first measure it with distributed traces (Application Insights end-to-end transactions) to count calls per operation and find the critical path. Then:
If two services always call each other, the real fix may be the boundary. The trade-off: fewer round trips cost coupling, ownership and more complex failure handling.
"Chatty APIs are a latency multiplier. Each call pays a network round trip, and on mobile that's 50 to 150 ms, so 25 calls, even partly parallel, cost seconds while each endpoint looks fast in isolation. Between services the RTT is usually lower, around a millisecond inside one Azure region, but that's not a given: calls that cross regions, go through gateways, sidecars or private endpoints, or hit a congested or throttled dependency can cost tens of milliseconds each. N+1 call patterns multiply that by the size of the data, and every extra hop adds a failure point, serialisation cost and a dependency that can slow everyone down.
I start by measuring: in Application Insights I open end-to-end transactions for the slow screen or request, count the calls and see which are sequential. For example, at [company] our [mobile home screen] made [25] calls, and the order service called the catalogue service once per order line, [up to 200] times a request. First we removed calls that weren't needed at all. For the client side, we introduced a BFF owned by the mobile team: one endpoint per screen that fans out in parallel inside Azure, with per-dependency timeouts, a circuit breaker and partial responses. For the service side, we added a
GetProductsByIdsbatch endpoint and cached product data with HybridCache, then later moved to consuming product-changed events so the order service kept its own read model. [Screen p95 went from 2.8 s to 700 ms and downstream calls per order request from about 200 to 1.]The mistake I see is reaching for gRPC as if a faster protocol fixes too many calls. gRPC shrinks each call, but 200 small calls are still 200 round trips. The other mistake is batching as a band-aid when the real problem is that two services split one business capability between them. The question I ask is: should these services be talking this much at all, and who owns the composition? Fix the number of calls first, then the cost of each."
| Option | What it is | Fits | Watch out for |
|---|---|---|---|
| Aggregate endpoint | One endpoint returning a screen's data | Single client, few screens | Couples API to UI |
| BFF | A backend per client type, owned by that client team | Several client types with different needs | Duplication, another deployable |
| Batch API | GET /products?ids=1,2,3 or POST /batch |
N+1 service calls | Payload limits, partial failures |
| gRPC (+ streaming) | Protobuf over HTTP/2 | High-volume internal traffic | Browser support (gRPC-Web), L4 load balancing |
| GraphQL | Client picks fields and joins | Many clients, varied queries | Query cost control, caching |
| Edge/CDN caching | Cache public, cacheable GETs near users | Reference data, catalogues | Personalised data, invalidation |
| Replicate data | Local read model fed by events | Data read far more than changed | Eventual consistency |
| Merge services | One service where boundaries were wrong | Services that always change together | Organisational change |
AddStandardResilienceHandler).CancellationToken so abandoned requests stop downstream work.After the BFF and the batch endpoint, the mobile home screen went from 25 calls to 3, p95 on 4G fell from 2.8 s to 700 ms, and catalogue service traffic dropped 85%, which also let us scale it down from [8] to [3] instances.
Checks whether the candidate can diagnose chatty communication, choose between composition patterns with clear trade-offs, and recognise when chattiness signals a boundary problem.
Green flags
Red flags
sequential: [call1 80ms][call2 80ms][call3 80ms] ... x25 = ~2,000 ms
parallel(6): [6 calls][6 calls][6 calls][6 calls][1] = ~400 ms + queueing
BFF: client --80ms--> BFF --(25 calls, ~1-5 ms each, parallel)--> services
total ~ 80 ms + slowest dependency
The network cost is paid where RTT is high. Moving fan-out from the phone to a BFF inside Azure Australia East replaces 25 × 80 ms with 1 × 80 ms + in-region calls. In-region calls are not free: a service mesh sidecar, an API gateway, TLS, a cross-region hop or a dependency under load can each add milliseconds to tens of milliseconds.
dependencies grouped by operation_Id gives calls per request.dependencies
| where timestamp > ago(1h) and cloud_RoleName == "orders-api"
| summarize calls = count() by operation_Id, target
| summarize p50 = percentile(calls, 50), p95 = percentile(calls, 95) by target
Chattiness creeps back one feature at a time, so make it a monitored number:
AddOpenTelemetry().WithTracing(...) exporting to Azure Monitor) so HTTP, gRPC and SQL dependencies become spans automatically.A BFF is a thin service per client type (mobile, web, partner) that composes downstream calls into screen-shaped responses. Rules that keep it healthy:
Task.WhenAll, per-dependency timeouts, and partial responses (show the screen without recommendations if that service is slow).AddStandardResilienceHandler (timeouts, retries with jitter, circuit breaker).Replace foreach (line) await catalogue.GetProduct(id) with one GetProductsByIds(ids) call. Design points: maximum batch size, deduplicated IDs, result keyed by ID, and explicit handling of missing items. Server side, the batch maps to a single WHERE Id IN (...) or a TVP, not a loop.
Protobuf is compact and gRPC multiplexes on HTTP/2, so per-call overhead drops. Server streaming sends many results over one call; client and bidirectional streaming suit telemetry and chat-like flows. Constraints: browsers need gRPC-Web, L4 load balancers pin HTTP/2 connections to one pod (use L7 or client-side balancing), and contracts need versioning discipline.
If order processing needs product data on every request, either cache it (HybridCache with tags), or have the order service own a read model fed by ProductChanged events through Azure Service Bus. If two services must update together synchronously all the time, they probably split one business capability and belong in one service or one module of a modular monolith.
Task.WhenAll and a 300 ms timeout each.tc netem and compare 25 sequential calls with one aggregate call.A BFF endpoint that composes a screen with parallel fan-out, timeouts and a partial response:
// Program.cs in Mobile.Bff
using Microsoft.Extensions.Http.Resilience;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpClient<OrdersClient>(c => c.BaseAddress = new Uri("https://orders.internal"))
.AddStandardResilienceHandler();
builder.Services.AddHttpClient<CatalogueClient>(c => c.BaseAddress = new Uri("https://catalogue.internal"))
.AddStandardResilienceHandler();
builder.Services.AddHttpClient<RecommendationsClient>(c => c.BaseAddress = new Uri("https://recs.internal"))
.AddStandardResilienceHandler();
var app = builder.Build();
app.MapGet("/screens/home/{customerId:int}", async (
int customerId, OrdersClient orders, CatalogueClient catalogue,
RecommendationsClient recs, CancellationToken ct) =>
{
var ordersTask = orders.GetRecentAsync(customerId, ct);
var recsTask = WithTimeout(recs.GetForAsync(customerId, ct), TimeSpan.FromMilliseconds(300), []);
var recent = await ordersTask;
// One batch call instead of one call per order line (avoids N+1 across services).
var productIds = recent.SelectMany(o => o.ProductIds).Distinct().ToArray();
var products = await catalogue.GetByIdsAsync(productIds, ct);
return Results.Ok(new HomeScreen(recent, products, await recsTask)); // recs may be empty: partial response
});
app.Run();
static async Task<T> WithTimeout<T>(Task<T> task, TimeSpan timeout, T fallback)
{
var finished = await Task.WhenAny(task, Task.Delay(timeout));
return finished == task ? await task : fallback; // optional data must not hold up the screen
}
public sealed record OrderSummary(int Id, IReadOnlyList<int> ProductIds);
public sealed record Product(int Id, string Name, decimal Price);
public sealed record HomeScreen(IReadOnlyList<OrderSummary> RecentOrders,
IReadOnlyList<Product> Products, IReadOnlyList<Product> Recommended);
public sealed class OrdersClient(HttpClient http)
{
public async Task<IReadOnlyList<OrderSummary>> GetRecentAsync(int customerId, CancellationToken ct) =>
await http.GetFromJsonAsync<List<OrderSummary>>($"/customers/{customerId}/orders?pageSize=5", ct) ?? [];
}
public sealed class CatalogueClient(HttpClient http)
{
public async Task<IReadOnlyList<Product>> GetByIdsAsync(int[] ids, CancellationToken ct) =>
ids.Length == 0 ? [] :
await http.GetFromJsonAsync<List<Product>>($"/products?ids={string.Join(',', ids)}", ct) ?? [];
}
public sealed class RecommendationsClient(HttpClient http)
{
public async Task<IReadOnlyList<Product>> GetForAsync(int customerId, CancellationToken ct) =>
await http.GetFromJsonAsync<List<Product>>($"/customers/{customerId}/recommendations", ct) ?? [];
}
Chattiness is usually a symptom of either a UI that grew one call at a time or service boundaries drawn around nouns instead of business capabilities. A senior fixes the immediate latency with composition close to the data (BFF, batch endpoints) but also asks whether the boundary is right, because every remote call is a latency, failure and versioning cost forever.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| BFF | Distinct client types and teams | Another service to run | One client, a few screens: an aggregate endpoint is enough |
| Batch endpoint | N+1 service calls | API design work | Calls that are rare or already single |
| gRPC streaming | High-volume internal flows | Tooling, L7 balancing | Public browser APIs |
| Event-fed read model | Read-heavy, slowly changing data | Eventual consistency, infrastructure | Data that must be strongly consistent |
| Merge services | Always change and call together | Org and deployment change | Truly independent scaling or ownership needs |
For most APIs, latency × number of round trips dominates, not bandwidth. A request that makes 50 sequential database calls at 2 ms RTT spends 100 ms on the network; move the database to another region at 30 ms RTT and it spends 1.5 s. Fix it by reducing round trips (batching, joins, fewer chatty calls), moving compute near data, caching, and parallelising independent calls.
An API gateway is a single entry point in front of your services that routes requests and applies cross-cutting concerns: TLS termination, token validation, rate limiting and quotas, request ids, IP filtering, header rewriting and sometimes caching. Azure API Management is a managed gateway with XML policies, products and subscriptions, a developer portal and analytics; YARP is a .NET reverse-proxy library you host yourself and extend in C#. A backend-for-frontend (BFF) is a gateway per client (web, mobile) that aggregates and shapes data for that client. The danger is a smart gateway: business rules and orchestration in policies become untested, hard-to-version logic owned by nobody. Keep the gateway thin and services authoritative.
Maybe. A mobile BFF owned by the app team lets the app's contract evolve with the app and isolates it from changes the web needs, which removes a lot of coordination. It can also aggregate several backend calls into one mobile-shaped response, cutting round trips and payload on slow mobile networks.
But it is another service to host, secure, monitor and be on call for, it adds a hop and a second contract to version, and it moves rather than removes compatibility: the BFF still has to serve every supported app version. I would introduce one when web and mobile needs genuinely diverge or the app team wants to own its API, not just to dodge one incident.
How to tell it (STAR)
**S:** At [company], our mobile home screen took nearly three seconds on 4G and the catalogue service needed eight replicas, although each endpoint looked fast on its own. **T:** As [senior engineer on the platform team], I was asked to make the screen fast and cut the infrastructure cost. **A:** I used Application Insights traces and mobile telemetry to show the screen made 25 calls, and the order service called catalogue once per line, up to 200 times. I proposed a batch endpoint with caching for the service-side N+1, and a mobile-owned BFF with parallel fan-out, timeouts and partial responses for the screen. Later we replaced the cache with an event-fed read model. **R:** Home screen p95 fell to [700 ms], catalogue calls per order went from about 200 to [1], and we scaled catalogue from [8] to [3] replicas.
Last updated 23 Nov 2026.