Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama
Bölme yalıtımı ve ağ geçidinin RequestRateLimiter filtresini kullanarak arızaları yalıtın ve alt düzey hizmetleri koruyun.
Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama, CoddyKit'te ücretsiz bir API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Containing the Blast Radius
Circuit breakers stop calls to a broken service, but a flood of traffic to one route can still starve others. Bulkheads and rate limiting keep one busy route from sinking the whole gateway.
The Bulkhead Pattern
Named after a ship's watertight compartments, a bulkhead caps how many concurrent calls a route may have. If one service slows down, only its compartment fills, sparing the rest.
Resilience4j Bulkhead Config
Resilience4j offers a bulkhead that limits concurrent calls per instance.
resilience4j:
bulkhead:
instances:
orders:
maxConcurrentCalls: 20Why Rate Limiting Differs
A bulkhead caps concurrency; a rate limiter caps requests over time. Together they protect both fast bursts and sustained load.
The RequestRateLimiter Filter
Spring Cloud Gateway ships a RequestRateLimiter filter backed by a Redis token bucket. It rejects excess requests with HTTP 429.
filters:
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20Replenish Rate and Burst
replenishRate is the steady tokens per second; burstCapacity is the most that can be spent in a spike. Burst should be greater than or equal to replenish.
Choosing a KeyResolver
A KeyResolver decides what to limit by, such as user, API key, or IP. Here we limit per user from a header.
@Bean
KeyResolver userKeyResolver() {
return exchange -> Mono.just(
exchange.getRequest().getHeaders()
.getFirst("X-User-Id"));
}Redis Backing Store
The limiter needs Redis so counts are shared across gateway instances. Add the reactive Redis starter.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>Combining Patterns
Stack resilience filters on a route: circuit breaker first, then rate limiter, so traffic is shaped before reaching a possibly fragile backend.
filters:
- name: CircuitBreaker
args:
name: ordersCB
fallbackUri: forward:/fallback/orders
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20Graceful Rejection
When the limit is exceeded the client gets 429. You can customize the status, but always return a clear, retryable response so clients can back off.
args:
redis-rate-limiter.replenishRate: 5
statusCode: TOO_MANY_REQUESTSObserving the Limits
Watch metrics for 429 counts and bulkhead rejections. Tune the numbers based on real downstream capacity, not guesses.
Quick Check
What is the core difference between a bulkhead and a rate limiter?
Recap
You added two more resilience tools:
- Bulkheads cap concurrent calls per route
RequestRateLimiteruses a Redis token bucketreplenishRateandburstCapacityshape traffic- A
KeyResolverdefines the limiting key
Combined with circuit breakers, retries, and fallbacks, your gateway degrades gracefully under stress.
Sıkça Sorulan Sorular
“Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama” dersi ücretsiz mi?
Evet — “Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) kursu toplamda 4 dersten oluşur.
“Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama” dersinde ne öğreneceğim?
Bölme yalıtımı ve ağ geçidinin RequestRateLimiter filtresini kullanarak arızaları yalıtın ve alt düzey hizmetleri koruyun. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersinde kod yazıp çalıştırabilir miyim?
Evet. Her API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Resilience4j ile Devre Kesiciler
- Yeniden Denemeleri ve Zaman Aşımlarını Yapılandırma
- Hataları Ele Alma ve Geri Dönüşler
- Dayanıklılık için Bölme Yalıtımı ve Hız Sınırlama