Real-World Design & Interview Scenarios Flashcards

Apply NoSQL to build scalable, real-world systems. "Design a high-scale chat application using NoSQL databases." "How would you store and retrieve user sessions efficiently?" Designing a messaging app (Redis pub/sub, MongoDB for message history) Session management using Redis E-commerce catalog using MongoDB IoT data ingestion using Cassandra Graph-based recommendations using Neo4j Cost vs performance trade-offs (e.g., DynamoDB vs MongoDB Atlas) (20 cards)

1
Q

Design a high-scale chat application using NoSQL databases.

A

Use Redis Pub/Sub for real-time message delivery and MongoDB to persist chat history for retrieval and analytics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you store and retrieve user sessions efficiently?

A

Use Redis to store session data due to its in-memory speed, TTL support, and ability to expire stale sessions automatically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How would you design an e-commerce product catalog using NoSQL?

A

Use MongoDB to store product documents with flexible schema for categories, variants, and descriptions; supports indexing and fast search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is Cassandra suited for IoT data ingestion?

A

Cassandra handles high-throughput, time-series data ingestion with tunable consistency, making it ideal for distributed IoT workloads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can Neo4j help build a recommendation engine?

A

Use Neo4j to model users, items, and interactions as a graph and query relationship patterns for real-time recommendations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are cost vs performance trade-offs between DynamoDB and MongoDB Atlas?

A

DynamoDB offers predictable scaling and built-in autoscaling but has limitations in flexibility; MongoDB Atlas provides a richer query language but may require manual tuning and management overhead.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a real-world use case of Redis in applications?

A

Redis is used for caching API responses, storing sessions, and implementing real-time features like leaderboards or chat.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the benefits of using MongoDB in e-commerce?

A

Flexible schema, powerful indexing, and document-based modeling make it easy to store complex product data and serve fast queries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why use Cassandra for time-series data?

A

Cassandra excels at high write throughput, linear scalability, and handling large volumes of time-stamped data efficiently.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What makes graph databases ideal for social apps?

A

Graph databases naturally model relationships, making them great for friend-of-friend queries, mutual connections, and recommendations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are architectural implications of choosing NoSQL?

A

Architectural impacts include schema flexibility, need for eventual consistency handling, and trade-offs in indexing and joins.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are performance trade-offs in using Redis Pub/Sub?

A

Pub/Sub provides low-latency messaging but lacks durability and message replay, requiring additional layers for persistence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are challenges in using NoSQL for session storage?

A

Challenges include data eviction under memory pressure, scaling for large user bases, and ensuring fault-tolerant session replication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the best practice for chat message durability?

A

Persist messages in MongoDB or Cassandra after publishing through Redis Pub/Sub to ensure delivery even if users are offline.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are common interview questions around NoSQL system design?

A

‘Design a chat app using NoSQL’, ‘How would you use Redis for session management?’, ‘How do you model IoT data in Cassandra?’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a potential gotcha in using Redis for session storage?

A

Using volatile memory alone risks data loss on crashes; ensure persistence or backup strategies are in place if needed.

17
Q

How do you monitor NoSQL-based systems?

A

Use database-specific tools (e.g., Redis MONITOR, MongoDB Atlas metrics), external tools (Prometheus, Grafana), and logging to track latency, memory, replication, and throughput.

18
Q

What are debugging challenges in distributed NoSQL systems?

A

Debugging can be complex due to eventual consistency, network partitions, replication lag, and lack of centralized logs.

19
Q

What is polyglot persistence in real-world design?

A

Using multiple databases based on strengths: Redis for cache, MongoDB for documents, Cassandra for writes, Neo4j for relationships.

20
Q

What is a sample architecture for a scalable chat app?

A

Use Redis for message delivery, MongoDB for history, Cassandra for metrics/time-series, and a message queue for retries and async processing.