N+1 Queries and Fragmented APIs: A Typical Architectural Pain
Your SPA makes 30 requests per page; N+1 queries in GraphQL haven't solved the API fragmentation problem. Each microservice returns its own data, and client code is littered with call chains. We are a team of engineers with 5 years of experience implementing KrakenD. Our specialty is high-load API Gateways handling up to 70,000 RPS on a single core. KrakenD is a stateless API Gateway written in Go with a declarative configuration in a single JSON/YAML file. Its standout feature is aggregating responses from multiple backend services into one response to the client (API composition). This reduces latency and simplifies client code.
How KrakenD Solves the API Aggregation Problem
KrakenD makes parallel requests to backends and merges them into a single response. The client sees only one endpoint, and the gateway itself collects the data. This eliminates the need to write a BFF or use workarounds like server-side includes.
Why KrakenD Is Faster Than Kong
In benchmarks, KrakenD achieves up to 70K RPS per core—2–3 times higher than Kong (25K RPS). The reason is a minimalistic codebase in Go and the absence of plugins that slow down processing. For high-load projects, this is critical: you save on hardware and keep low latency. According to official KrakenD benchmarks, the difference is especially noticeable when aggregating multiple backends.
Aggregation in Action
A typical endpoint /api/v1/user-profile calls three services: users, billing, prefs. KrakenD invokes them in parallel and returns a combined JSON. In the configuration, this looks like:
{
"$schema": "https://www.krakend.io/schema/v3.json",
"version": 3,
"name": "MyApp API Gateway",
"timeout": "3000ms",
"cache_ttl": "300s",
"output_encoding": "json",
"port": 8080,
"endpoints": [
{
"endpoint": "/api/v1/user-profile",
"method": "GET",
"output_encoding": "json",
"backend": [
{
"url_pattern": "/users/{JWT_CLAIMS.user_id}",
"host": ["http://users-service:3000"],
"mapping": { "data": "user" }
},
{
"url_pattern": "/subscriptions/active?user_id={JWT_CLAIMS.user_id}",
"host": ["http://billing-service:3001"],
"mapping": { "plan": "subscription_plan" }
},
{
"url_pattern": "/preferences/{JWT_CLAIMS.user_id}",
"host": ["http://prefs-service:3002"],
"mapping": { "settings": "preferences" }
}
],
"extra_config": {
"auth/validator": {
"alg": "RS256",
"jwk_url": "http://auth-service:4000/.well-known/jwks.json",
"cache": true,
"cache_duration": 300
}
}
}
]
}
The client makes one GET request and receives {"user":{"id":"123","name":"Alice"},"subscription_plan":"pro","preferences":{"theme":"dark"}}. Without KrakenD, you would have to make 3 requests and merge on the client—increasing complexity and loading time.
Rate Limiting and Circuit Breaker
To protect backends from overload, we configure rate limiting (by IP or token) and a circuit breaker. Example configuration:
{
"endpoint": "/api/v1/search",
"backend": [{ "url_pattern": "/search", "host": ["http://search:3000"] }],
"extra_config": {
"qos/ratelimit/router": {
"max_rate": 100,
"client_max_rate": 10,
"strategy": "ip",
"capacity": 100,
"client_capacity": 10
},
"qos/circuit-breaker": {
"interval": 60,
"timeout": 10,
"max_errors": 5,
"name": "search-cb",
"log_status_change": true
}
}
}
The circuit breaker disables a problematic backend for 10 seconds after 5 errors, preventing cascading failures. JWT validation errors are also cut off at the gateway level, reducing load on services.
Caching and Additional Transformations
KrakenD supports response caching (cache_ttl) and transformation using Lua scripts or built-in filters. This allows, for example, filtering sensitive fields before sending to the client. For frequent requests, caching can reduce latency by up to 80%.
KrakenD Setup Process
We follow a clear plan to ensure you get a stable gateway without surprises.
Analysis and Architecture Design
We study your architecture: list of services, endpoints, authentication and security requirements. We create an aggregation schema and choose a caching strategy.
Installation and Configuration
Installation via Docker:
docker run -p 8080:8080 \
-v $PWD/krakend.json:/etc/krakend/krakend.json \
devopsfaith/krakend:2.7 run -c /etc/krakend/krakend.json
We create a configuration with your endpoints, JWT validation, rate limiting, and circuit breaker. We use KrakenD Designer for visual verification.
Monitoring Integration
We set up Prometheus metrics and Grafana dashboards. Example monitoring section:
{
"extra_config": {
"telemetry/metrics": {
"collection_time": "60s",
"proxy_disabled": false,
"router_disabled": false,
"backend_disabled": false,
"endpoint_disabled": false,
"listen_address": ":9091"
},
"telemetry/opentelemetry": {
"service_name": "krakend-gateway",
"exporters": {
"prometheus": [{ "port": 9090, "disable_metrics": false }],
"otlp": [{
"name": "jaeger",
"host": "jaeger",
"port": 4317,
"use_http": false
}]
}
}
}
}
You get dashboards with LCP, TTFB, error count, and backend load.
Testing and Deployment
We perform load testing, check aggregation, timeouts, circuit breaker. After successful testing, we deploy to your environment (Kubernetes, bare metal, cloud).
Documentation and Training
We hand over complete documentation: configuration schema, instructions for adding endpoints, dashboard addresses. We conduct a training session for your team.
What's Included in the Setup?
| Step | Result |
|---|---|
| Analysis | Service map, aggregation schema, security requirements |
| Configuration | JSON config with endpoints, JWT, rate limiting |
| Monitoring | Prometheus + Grafana dashboards, alerts |
| Testing | Load test report |
| Documentation | Configuration description, endpoint addition guide |
| Training | 1-hour team workshop |
| Support | 1 month after launch |
Why Choose Us?
We are certified engineers with 5 years of experience working with KrakenD. We have launched 50+ projects, including high-load systems with 100K RPS traffic. We guarantee 99.9% uptime and deliver the project with full documentation. Thanks to aggregation and caching, our clients save up to 40% on infrastructure costs. Payback period for setup is typically 3–4 months.
| Metric | Value |
|---|---|
| Market experience | Over 5 years |
| API Gateway deployments | 50+ |
| Average setup time | 2–3 days |
| Uptime SLA | 99.9% |
Order a turnkey KrakenD setup — from consultation to monitoring. We will assess your project within 1 day. Get a ready-made gateway with documentation and team training. Contact us to get started.
Estimated Timelines
Basic setup with aggregation, JWT, and rate limiting — 2–3 business days. Complex configuration with transformations and observability — 4–5 days. The cost is calculated individually after analyzing your architecture.







