Project · Intermediate · about 16 hours

A fast catalogue with MongoDB and a Redis cache

Model food products as documents, index them for real queries, add a cache in front, and prove the speed-up with a load test and numbers.

Skills:NoSQL databases, Monitoring and observability, REST APIs and HTTP, Automated testing

Part of: Software Engineer (Backend)

Data and licences

Brief

Product pages are read far more often than products change, and a few products get most of the traffic. That is the classic case for a document store plus a cache. Build it and measure it honestly.

What to build

  1. Import products from one country of the Open Food Facts export into MongoDB. Decide what to embed (nutrition, labels) and what to reference.

  2. Write down the three queries the product page needs. Create indexes for them and show explain() before and after.

  3. Build the service with GET /products/{barcode}, GET /products?category=&nutriscore= and GET /products/{barcode}/similar.

  4. Add Redis cache-aside for product lookups with a TTL, delete keys on updates, and expose hits and misses as metrics.

  5. Load test with a skewed key distribution (a few hot products). Report p50 and p95 latency and MongoDB operations per second, with and without the cache.

Deliverables

  • Repository with service/, load/, indexes.md, REPORT.md and compose.yaml

How it is graded

Reviewers rerun your load test and change a product to check the cache is invalidated. The report must explain why the numbers are what they are.

Stretch

Protect against a cache stampede on a hot key and show the effect in a test.

Deliverables

  • A MongoDB document model for products with the indexes your queries need, justified with explain() output
  • A service (Java, Go or Python) with lookup, search and "similar products" endpoints
  • A Redis cache-aside layer with TTLs, invalidation on updates and hit-rate metrics
  • A load test report comparing p50 and p95 latency and database load with and without the cache

How a reviewer grades it

CriterionWeightWhat good looks like
Document model and indexes fit the access patterns, shown with query plans30%
Cache is correct (invalidation, TTL, no cross-user leakage) and observable25%
Load test is fair and repeatable, with numbers and graphs25%
Tests and README20%