Spring Cloud Research & Evidence-Based Practice 4 — Questions and Answers
Question 1: A developer wants to validate that Spring Cloud Feign retry logic does not retry non-idempotent POST requests. What is the evidence-based recommended approach?
- Disable the Feign retryer entirely and rely on the caller to retry
- Configure a custom Retryer that retries only on connection errors and limits retries to idempotent HTTP methods (Correct answer)
- Set feign.client.config.default.retryon=GET in application.properties
- Feign never retries by default, so no configuration is needed
Correct answer: Configure a custom Retryer that retries only on connection errors and limits retries to idempotent HTTP methods
A custom Retryer restricts retries to safe scenarios (idempotent methods, connection-level failures), preventing duplicate side effects from retried POST requests.
Question 2: Empirical studies on distributed configuration management recommend which strategy to reduce risk when rolling out a Spring Cloud Config change across a large fleet?
- Apply the change to all services simultaneously using a full Spring Cloud Bus broadcast
- Use canary deployment: push the config change to a small subset of instances first, monitor error rates, then expand (Correct answer)
- Restart all services at 3 AM when traffic is lowest
- Require all service teams to manually pull the new config at the same time
Correct answer: Use canary deployment: push the config change to a small subset of instances first, monitor error rates, then expand
Canary rollout of configuration changes limits blast radius — if the new configuration causes errors, only a small fraction of traffic is affected before rollback.
Question 3: When sizing Resilience4j TimeLimiter timeout values for Feign-based Spring Cloud calls, what does evidence-based guidance recommend?
- Set timeouts to 30 seconds for all services as a universal safe default
- Derive the timeout from the p99 response time of the upstream service under normal load, plus a small buffer (Correct answer)
- Set timeouts equal to the circuit breaker sliding window duration
- Use infinite timeouts to never drop a legitimate request
Correct answer: Derive the timeout from the p99 response time of the upstream service under normal load, plus a small buffer
Basing the timeout on the observed p99 latency plus a small buffer ensures legitimate slow-but-valid requests succeed while genuinely hung calls are cancelled promptly.
Question 4: Research into Spring Cloud Sleuth's compatibility with virtual threads (Project Loom) in Java 21+ highlights which key concern?
- Virtual threads cannot be used in Spring Boot applications at all
- ThreadLocal-based trace context propagation used by Sleuth is not automatically inherited by virtual threads, requiring explicit context passing (Correct answer)
- Sleuth disables virtual threads to prevent context leakage
- Virtual threads eliminate the need for distributed tracing entirely
Correct answer: ThreadLocal-based trace context propagation used by Sleuth is not automatically inherited by virtual threads, requiring explicit context passing
Sleuth relies on ThreadLocal for trace context; virtual threads don't automatically inherit parent thread locals, so Micrometer Tracing's context propagation model must be adopted.
Question 5: A case study on Spring Cloud Gateway rate limiting with Redis reveals over-limiting spikes during Redis leader election. What is the most resilient evidence-based remediation?
- Switch to an in-memory token bucket that resets on pod restart
- Use Redis Cluster with Sentinel and implement a fail-open fallback that allows requests when Redis is unavailable (Correct answer)
- Disable rate limiting during off-peak hours
- Add a second Redis instance and round-robin requests between them
Correct answer: Use Redis Cluster with Sentinel and implement a fail-open fallback that allows requests when Redis is unavailable
Redis Cluster with Sentinel improves availability, and a fail-open policy during Redis downtime prevents legitimate traffic from being blocked by infrastructure events.
Question 6: Evidence from chaos engineering experiments on Spring Cloud applications shows that which experiment most reliably exposes hidden single points of failure?
- Killing the lowest-traffic service instance
- Injecting network latency between a high-fan-out service and all its downstream dependencies simultaneously (Correct answer)
- Rebooting the build server during peak hours
- Enabling debug logging on all services during peak traffic
Correct answer: Injecting network latency between a high-fan-out service and all its downstream dependencies simultaneously
Simultaneously degrading all dependencies of a high-fan-out service reveals whether timeout budgets, fallbacks, and circuit breakers collectively prevent user-visible failure.
Question 7: Peer-reviewed guidance on microservice API versioning recommends which approach when evolving a Spring Cloud Feign client contract?
- Delete old endpoints immediately when a new version ships to force clients to upgrade
- Use URI versioning (e.g., /v2/resource) and maintain backward-compatible old versions for at least one deprecation cycle (Correct answer)
- Version only via HTTP headers to avoid URI pollution
- Never version APIs; use feature flags instead
Correct answer: Use URI versioning (e.g., /v2/resource) and maintain backward-compatible old versions for at least one deprecation cycle
URI versioning with a defined deprecation window gives consuming teams time to migrate without forced simultaneous upgrades across independently deployed services.
A developer wants to validate that Spring Cloud Feign retry logic does not retry non-idempotent POST requests.
What is the evidence-based recommended approach?