Scrivio Interview library

Spring Data for NoSQL

22 questions in 6 subtopics.

MongoDB

CodingFoundations6 min read
Map an Order document with embedded line items in Spring Data MongoDB, and write a repository method that finds orders by customer id sorted by date.
ScenarioIntermediate7 min read
A Spring Boot service needs multi-document transactions in MongoDB. What are the requirements and costs?
DesignIntermediate7 min read
When would you embed related data in a MongoDB document and when would you reference other documents? Use orders, customers and products as examples.
LeadershipPrincipal6 min read
Your company built its main product on MongoDB ten years ago with no schema enforcement, and now has documents in many historical shapes. What long-term plan would you set?

Redis

ConceptFoundations6 min read
What is the difference between RedisTemplate and StringRedisTemplate, and why do keys sometimes appear as unreadable bytes in Redis?
CodingFoundations6 min read
Configure Spring Cache with Redis so that product lookups are cached for 10 minutes, and explain the cache-aside behaviour.
ScenarioIntermediate7 min read
You need a distributed lock so that only one instance runs a scheduled job at a time. Discuss using Redis for this, and alternatives.
LeadershipAdvanced7 min read
Redis is used by 50 services for caching, sessions, rate limiting and queues in one shared cluster. What risks do you see, and what would you change?
ScenarioPrincipal6 min read
Several open-source data stores your company relies on have changed licences in recent years, and cloud providers offer forks or compatible services. How would you decide whether to stay, move to a fork, or move to a managed compatible service?

Elasticsearch

ConceptFoundations7 min read
How do you use Spring Data Elasticsearch to index and search products, and why is Elasticsearch usually not the primary store?
DesignIntermediate7 min read
Design how product changes in PostgreSQL reach an Elasticsearch index reliably, including full reindexing without downtime.
LeadershipAdvanced7 min read
Search is run on a self-managed Elasticsearch cluster by one team, and other teams want to add their own indexes to it. How would you decide on ownership, tenancy and the platform choice?

Cassandra

ConceptFoundations6 min read
In Cassandra, what are the partition key and clustering columns, and why can you not query freely by any column as in SQL?
DesignIntermediate7 min read
Model a Cassandra table for 'latest 50 messages per conversation' with Spring Data Cassandra. Explain partition and clustering keys and the pitfalls.
ScenarioAdvanced7 min read
A team proposes Cassandra for a new order service because of its write scalability. What questions would you ask before approving?

Choosing SQL vs NoSQL

ConceptFoundations6 min read
What factors would make you choose a relational database over a document database for a new service?
ScenarioIntermediate6 min read
A team stores user profiles in MongoDB, but new features need reporting with joins across profiles, orders and payments in PostgreSQL. What would you recommend?
LeadershipAdvanced6 min read
Teams have adopted six different databases over the years. How would you create a database technology policy that balances team autonomy with operational cost?
LeadershipPrincipal6 min read
Looking back at the NoSQL wave of the 2010s and the later return of relational databases with JSON support and distributed SQL, how would you advise an organisation making database bets for the next ten years?

DynamoDB

ConceptFoundations7 min read
How do you access DynamoDB from a Spring Boot service, and how do partition keys and sort keys determine what queries are possible?
DebuggingIntermediate7 min read
A DynamoDB table backing an order service throttles with ProvisionedThroughputExceededException during a sale, even though total consumed capacity is far below the table's limit. What is likely happening and how do you fix it?
DesignAdvanced7 min read
A team wants to move an order service from PostgreSQL to DynamoDB to reduce operational work. What questions would you ask, and what risks would you highlight?