Scrivio Interview library

Stateless services

ConceptFoundations6 min read
What makes a Spring Boot service stateless, and how do you handle HTTP sessions when you run several instances behind a load balancer?
ScenarioIntermediate6 min read
A legacy Spring MVC application keeps shopping carts in the HTTP session and stores uploaded files on local disk. You must run it on Kubernetes with autoscaling. What changes are required, in what order?
DesignAdvanced6 min read
A platform team wants every new service to be stateless by default. Which kinds of state still need a home, and what standard platform services would you provide for them?

Horizontal scaling

ConceptFoundations5 min read
A Spring Boot service scales horizontally from 3 to 30 pods but throughput stops growing after 10 pods. It uses one PostgreSQL database. What limits scaling here?
DesignIntermediate6 min read
A service that stores customer orders must handle 10x more writes within two years. One PostgreSQL primary is near its limit. Design a horizontal scaling approach.
LeadershipAdvanced6 min read
Several core databases in your organisation are approaching their vertical limits. How would you decide when and how to shard, and who should do the work?
LeadershipPrincipal6 min read
The business expects 10x growth over five years. As the senior technical leader, how do you decide the scaling strategy for the core Java platform and estimate its cost over the years?

Caching layers

ConceptFoundations6 min read
Compare a local cache such as Caffeine with a distributed cache such as Redis in a Spring Boot service using the Spring cache abstraction.
DebuggingIntermediate6 min read
After a Redis cluster restart, the database behind a product service became overloaded and the service went down. Explain what happened and how to prevent it.
DesignAdvanced6 min read
Design the caching layers for a product catalogue read 50,000 times per second and updated a few times per second, served by Spring Boot services behind a CDN.
LeadershipPrincipal7 min read
Your teams increasingly add caches to cope with slow core databases. As the senior technical leader, how do you decide between investing in caching and investing in the data layer itself?

Back-pressure

ConceptFoundations7 min read
What is back-pressure, and how do Project Reactor and a blocking ThreadPoolExecutor each handle a producer that is faster than its consumer?
DesignIntermediate7 min read
A Spring Boot service consumes bursts of events from Kafka and writes them to a database that can only take 2,000 writes per second. Design back-pressure so the service stays healthy during bursts.
ScenarioAdvanced7 min read
During an outage, retries from many upstream services overloaded a recovering downstream service and extended the outage by an hour. How would you prevent this across teams?

Rate limiting at scale

CodingFoundations6 min read
Describe how you would implement a per-API-key rate limit of 100 requests per minute in a Spring Boot service running on several instances.
DesignIntermediate6 min read
Design rate limiting for a public API served from three regions, where each customer has a plan with a monthly quota and a per-second limit.
LeadershipAdvanced6 min read
Internal services in your organisation regularly overload each other with batch jobs and traffic spikes. How would you introduce rate limiting and quotas between internal services?
LeadershipPrincipal6 min read
Your public API's growth is driven by a few very large customers whose traffic spikes degrade service for everyone. As the senior technical leader, how do you decide between strict rate limits, dedicated capacity for large customers, and pricing changes?