1. Home
  2. Blog
  3. Integration

Integration

What Is an API Gateway? Jobs, Added Latency, Single Point of Failure and Payback Guide

What is an API gateway? Its jobs, how it differs from a load balancer, added latency, the single-point-of-failure risk and payback, with worked examples.

Contents 13 sections
  1. What Is an API Gateway?
  2. How Does an API Gateway Differ from a Load Balancer and a Service Mesh?
  3. Which Jobs Does an API Gateway Take On?
  4. How Do You Calculate Added Latency and Capacity?
  5. How Do Caching and Rate Limiting Reduce Backend Load?
  6. What Do Aggregation and Shared Rules Add?
  7. How Do You Manage the Single-Point-of-Failure Risk?
  8. How Do You Release a New Version Safely with Staged Routing?
  9. When Is an API Gateway Unnecessary or Problematic?
  10. How Do You Calculate Payback?
  11. How Do You Set Up an API Gateway? Six Steps
  12. API and Integration Architecture with İnovabil
  13. Frequently Asked Questions

Your dealer portal, your mobile app and two partner integrations all connect to the same backend services. Each service opens its own address, writes its own authentication, applies its own rate limit and keeps its own log format. As the number of services grows, the same rule ends up living in six places, then ten, and one of them gets forgotten. An API gateway is the layer that pulls this sprawl into a single entry point: clients talk only to the gateway, and the gateway forwards each request to the right service.

In this guide we explain what an API gateway is, how it differs from a load balancer and a service mesh, which jobs it takes on, the risks of added latency and a single point of failure, staged routing, and how to calculate payback. All example figures are illustrative; they are not the performance or price of any specific product.

Key takeawayAn API gateway is a traffic-and-rules layer, not a business-logic layer. By applying shared rules (authentication, rate limiting, logging, routing) in one place, it reduces the work of every service team. In return it adds one more hop, some latency and a new single point of failure. Do not introduce one before you have weighed the gain against that cost.

What Is an API Gateway?

An API gateway is the single entry point that receives every API request coming from outside, applies the rules, and forwards the request to the appropriate backend service. The client does not know how many services sit behind it or where each one runs; it only knows the gateway's address.

It brings three benefits: simplicity for clients (one address, one authentication style), rule delegation for services (no service rewrites the same code) and visibility for the business (who calls which endpoint, and how often). We covered what APIs are and how they connect systems in our API integration guide; this article focuses on the layer placed in front of those connections.

We recommend reading: Our integration services

How Does an API Gateway Differ from a Load Balancer and a Service Mesh?

All of them manage traffic, but at different levels and for different questions. A load balancer answers "which instance?", while a gateway answers "may this client call this endpoint, and which service should it go to?".

ComponentMain jobUnderstands the API?Typical place
Load balancerSpreads traffic across instances of the same serviceNo; address and port levelIn front of a service or the gateway
Reverse proxyForwards requests from one address to the backend, terminates TLSLimitedPublic edge
API gatewayIdentity, quota, routing, transformation, loggingYes; endpoint and client levelSingle entry for traffic from outside
Service meshManages the internal traffic between servicesService-call levelInternal network, east-west traffic
Backend for frontendGathers data for one specific interface (for example mobile)Yes; specific to that interfaceBehind or next to the gateway

In practice they work together: a load balancer sits in front of the gateway instances, the gateway handles traffic from outside, and a service mesh manages internal traffic. We discussed the broader design questions on the service side in our microservices architecture guide.

Which Jobs Does an API Gateway Take On?

A gateway takes on eight jobs, and each has a "should not do" side. If you do not draw the line, the gateway slowly becomes a bottleneck that accumulates business logic and that nobody wants to touch.

JobWhat it doesShould not
RoutingForwards to the right service by path and versionDecide on business rules
Authentication delegationVerifies tokens and keys, passes the verified identity to the internal service as a headerDecide object-level permission on its own
Rate limit and quotaLimits requests per client, rejects the excessUse the limit as a business rule
CacheStores unchanging read responses at the gatewayPut user-specific replies into a shared cache
Request and response transformationAdds headers, adapts field names and formatDo heavy data conversion or calculation
AggregationCombines several service calls into one replyRun long workflows
Logging and monitoringAssigns a trace ID, collects latency and error metricsWrite secrets into logs
Circuit breakerTemporarily cuts off an unhealthy service and returns a fast errorSwallow the error silently
The six-step path of a request through an API gateway: request, verify, limit, route, combine, log
The path of a request through the gateway. Most steps are applied once, in one place, instead of being rewritten in every service.

The difference between authentication and authorization is critical here. The gateway answers "who is this client?"; the decision "does this record belong to this client?" stays in the service that owns the record. See our API security guide for the full framework. Internal services must accept traffic only from the gateway; if the gateway can be bypassed, every rule loses its meaning.

How Do You Calculate Added Latency and Capacity?

A gateway adds a hop, so every request becomes slightly slower. What matters is that this cost has a budget and is measured.

In the illustrative example the backend responds in 120 ms. The gateway adds 6 ms for routing and authentication and 4 ms for transformation and logging. Added latency is 6 + 4 = 10 ms, total 120 + 10 = 130 ms, an increase of 10 ÷ 120 = 8.3%. If the target p95 response time is 200 ms and the backend p95 is 150 ms, the figure after the gateway is 160 ms, leaving a 40 ms margin.

ItemTimeNote
Backend response120 msWithout the gateway
Routing + authentication6 msToken check served from cache
Transformation + logging4 msHeader addition, trace ID
Added latency10 ms6 + 4
Total130 ms+8.3% (10 ÷ 120)
TipBefore rolling out the gateway, measure one suitable endpoint directly and through the gateway; look at p95 and p99 rather than p50. If the added latency exceeds your budget, strip out transformation and logging work and cache authentication results for a short time.
The added latency of an API gateway, the backend load reduced by caching, and the effect of a staged rollout
The cost and the gain of a gateway (illustrative dealer portal example).

How Do Caching and Rate Limiting Reduce Backend Load?

Because the gateway can filter requests before they reach the backend, it also pays off on the load side. Two mechanisms stand out.

Cache. Suppose you receive 1,200,000 requests a day and 70% are reads, that is 840,000 requests. For frequently read, rarely changing replies such as product and price lists, if the cache hit rate is 60% of reads, 504,000 requests never reach the backend. Backend load falls to 1,200,000 − 504,000 = 696,000 requests, a reduction of 504,000 ÷ 1,200,000 = 42.0%. We covered the details of cache design, invalidation and expiry decisions in our caching guide.

Rate limit. A partner's faulty loop produces 5,000 requests per minute, while the per-client limit is 300 per minute. The gateway turns away 4,700 requests with a 429 reply and backend load drops from 5,000 to 300, a reduction of 4,700 ÷ 5,000 = 94%. For quota and plan design, see our API key and quota guide.

What Do Aggregation and Shared Rules Add?

There are two more gains: the client makes fewer calls, and shared rules live in one place.

Aggregation. A mobile home screen needs data from four services (orders, stock, prices, balance). If the client makes four separate calls, each costs roughly 120 ms of round trip on the mobile network, and the services take 40, 35, 50 and 30 ms to process. Sequentially the time is 4 × 120 + (40 + 35 + 50 + 30) = 480 + 155 = 635 ms. The gateway receives a single call and goes to the four services in parallel; the slowest service takes 50 ms. The time becomes 120 + 50 + 10 (gateway) = 180 ms, a drop of (635 − 180) ÷ 635 = 71.7%.

Shared rules. With six services and five shared rules (authentication, rate limiting, logging, TLS settings, header policy), applying them in each service means 6 × 5 = 30 implementations; at the gateway it is 5. If changing a rule takes 2 hours per service, that is 6 × 2 = 12 hours, versus 2 hours in one place at the gateway. With 8 changes a year it is 96 hours against 16; the difference is 80 hours, which at ₺300 per hour is ₺24,000.

How Do You Manage the Single-Point-of-Failure Risk?

Every request passes through the gateway, so if it goes down, no service can be reached. This risk is real and is the most misunderstood point: the answer is not to avoid the gateway but to avoid running it as a single instance.

In the illustrative calculation a 30-day month is 43,200 minutes. If a single gateway instance is 99.9% available, monthly downtime is 43,200 × 0.001 = 43.2 minutes. With two independent instances behind a 99.99% load balancer (assuming the instances fail independently), the gateway-side failure probability is 1 − (1 − 0.000001) × 0.9999 ≈ 0.000101 and monthly downtime falls to roughly 4.4 minutes. In reality instances are not fully independent; they share the same version, configuration and environment, so this result is an optimistic upper bound.

ScenarioGateway availabilityMonthly downtime (gateway)Chain (gateway × 99.9% service)
Single instance99.9%43.2 min99.8% (≈ 86.4 min)
Two instances + balancer≈ 99.990%≈ 4.4 min≈ 99.89% (≈ 47.6 min)

The chain column assumes the request depends on the gateway and on a single service; a request that passes through several services takes longer. A broken routing rule affects both instances at once, so the gateway configuration is kept under version control and released in stages. Monitoring and alerting are mandatory for readiness.

How Do You Release a New Version Safely with Staged Routing?

Because the gateway can send a share of traffic to a new version, it shrinks release risk. The impact of a faulty version is proportional to the share routed to it.

1,200,000 requests a day is 50,000 requests an hour. Assume you observe the new version for 4 hours at each stage: 200,000 requests flow in total. At the 5% stage, 10,000 requests go to the new version; at 25%, 50,000. If the version is faulty, switching straight to 100% affects 200,000 requests in 4 hours; caught at the 5% stage, 10,000 are affected. The difference is 200,000 ÷ 10,000 = 20 times.

StageNew version shareRequests in 4 hoursCondition to proceed
15%10,000Error rate ≤ 1.2% (baseline 0.8%)
225%50,000Errors and p95 latency within thresholds
3100%200,000Old version kept ready for a while

Rollback is also quick: setting the routing weight to zero does not require redeploying the service and takes about a minute. Feature flags, the application-side counterpart of this idea, are a separate topic; the gateway only manages the traffic share.

When Is an API Gateway Unnecessary or Problematic?

Not every architecture needs a gateway. In these cases the benefit may not cover the cost.

  • One service, one client: With no scattered rules, the layer only adds latency.
  • Two or three services that are not changing: Applying shared rules in the services may be cheaper.
  • Very tight latency budget: If every millisecond counts, the extra hop may be unacceptable.
  • Business logic creeping in: If calculations and rules pile up at the gateway, everyone depends on it and changes become unmanageable.
  • Unclear ownership: If the gateway has no owner, rule changes wait in a queue.

Document the gateway's public interface too; our API documentation guide covers this, and for changes that break clients see our API versioning guide.

How Do You Calculate Payback?

For an illustrative dealer portal we set up the gateway in 24 person-days: 24 × ₺9,000 = ₺216,000 investment. Annual gross benefit has three items:

  • Shared-rule effort: the ₺24,000 calculated above.
  • Adding new services: 4 new services a year; shared-rule integration per service drops from 3 days to 0.5 days; the gain is 4 × 2.5 = 10 person-days, 10 × ₺9,000 = ₺90,000.
  • Smaller incident impact: in 2 faulty releases a year, the incident cost falls from ₺60,000 to 20 times less with staged routing, that is ₺3,000; the gain is 2 × (60,000 − 3,000) = ₺114,000.

Gross benefit is 24,000 + 90,000 + 114,000 = ₺228,000. If gateway infrastructure and maintenance cost ₺6,000 a month, ₺72,000 a year, net benefit is ₺156,000 a year, ₺13,000 a month. Payback is 216,000 ÷ 13,000 ≈ 16.6 months.

If the expected gain halves (only the incident item, ₺114,000, materializes), net benefit is 114,000 − 72,000 = ₺42,000 a year, ₺3,500 a month, and payback is 216,000 ÷ 3,500 ≈ 61.7 months. The gap shows the decision depends on your number of services and release frequency; recalculate with your own figures.

How Do You Set Up an API Gateway? Six Steps

  1. Take an inventory: List which client calls which service through which endpoint.
  2. Identify the shared rules: Separate the rules every service repeats, such as authentication, rate limiting, logging and header policy; leave business logic out.
  3. Write the latency budget: Settle the added-latency limit and the measurement method up front.
  4. Build high availability: At least two instances with a load balancer in front; configuration under version control.
  5. Close the internal services: Services should accept only traffic coming through the gateway; block direct access at network level.
  6. Start with one endpoint: Move a low-risk read endpoint first, widen with staged routing and watch the measurements.
We recommend reading: How to Design a REST API: Resource Naming, Pagination, Error Format and Idempotency Guide

API and Integration Architecture with İnovabil

At İnovabil our focus is building bespoke software from scratch: custom software, ERP, CRM, e-commerce, web, mobile and integration. For a system with several clients and services, we recommend assessing in writing during requirements analysis whether an API gateway is needed, based on the number of services, the kinds of clients and the latency budget; in small systems, postponing the layer can also be the right call.

We have built CRM, purchasing and mobile for Avcılar İnşaat; a purchasing system for İZBAN; a prepaid cargo system for Kredili Kargo; logistics and shipment planning with wholesale order management for Karyak; and warehouse management plus a complaint and support management system for Sleepy. Send us a short summary of your system's clients and services and we will assess the architecture together.

We recommend reading: Our software development process: step by step from analysis to release

Frequently Asked Questions

What is an API gateway, and what is it for in short?

It is the single entry point for all API requests coming from outside. It does shared jobs such as authentication, rate limiting, routing, caching and logging in one place and forwards the request to the right service.

Is an API gateway the same as a load balancer?

No. A load balancer spreads traffic across instances of the same service and does not understand the API. A gateway decides at endpoint and client level; a load balancer is often used in front of the gateway as well.

Does an API gateway reduce performance?

It adds latency because it adds a hop; in the example that is 10 ms, or 8.3%. Caching, aggregation and rate limiting can still pay back overall by cutting backend load and client call counts; decide by measuring.

Isn't the gateway a single point of failure?

It is if you run a single instance. At least two instances, a load balancer in front and versioned configuration reduce this risk. In the example monthly downtime falls from 43.2 minutes to about 4.4 minutes; because of the independence assumption this is an optimistic bound.

Does a small system need an API gateway?

Usually not. With one service and one client, or just two or three services, the layer can add latency and operating load instead of benefit. The decision changes as the number of services and clients grows.

Let's talk about your project

Tell us briefly about the software you have in mind; we'll listen and prepare a tailored roadmap and proposal.

Get a quote