Skip to content

Caching & Performance

Caching and performance optimisation help your back-end handle more users with lower latency and fewer resources. By avoiding unnecessary work (for example repeated database queries or external API calls) and by optimising critical code paths, you create a faster, more responsive system. A good caching and performance strategy balances speed, freshness of data, and complexity.

For this product, you describe how you measured performance, where you introduced caching or optimisations, and what impact this had on your application.

Caching & Performance in Back-end Systems

Common techniques include:

  • Application-level caching (in-memory caches, memoization)
  • Distributed caches (for example Redis)
  • HTTP caching (ETags, cache headers)
  • Database optimisations (indexes, query tuning, connection pooling)
  • Asynchronous processing (background jobs, queues)

In your project you choose a few techniques that make sense for your workload and document both the design and the concrete implementation.

Quality indicators

When assessing this product, the following quality indicators will be considered:

  • The caching & performance document is self-contained, with an introduction/context and then a description of the chosen techniques.
  • It explains which performance problems or bottlenecks you wanted to address and how you identified them (for example logs, metrics, profiling).
  • It describes which caching or optimisation strategies you implemented and why these were chosen.
  • It explains how cache invalidation and data freshness are handled.
  • It includes examples of code and/or configuration that implement caching or performance improvements, with references to the code in GitLab.
  • It describes how you measured the effect of your changes (for example response times, throughput, resource usage).
  • It reflects on trade-offs (complexity, memory usage, consistency) and how you balanced them.
  • It includes a list of sources used to design and implement your caching and performance strategy.

Template

To document caching and performance in your own project, you can use the following template:

# Caching & Performance

In this section, describe in a few sentences why performance matters for your application and what typical workloads or usage patterns look like. This is the main text of your document.

## Baseline & Bottlenecks

Here you describe the initial performance situation:
- How did you measure performance (logs, metrics, profiling tools)?
- Which endpoints or operations were slow or resource-intensive?
- What goals or targets did you set (for example max response time)?

## Caching & Optimisation Strategy

Here you describe which techniques you chose:
- Which data or operations you cache
- Which cache technology you use (in-memory, Redis, HTTP caching, etc.)
- How long items stay in cache and how invalidation works
- Other optimisations (query tuning, background jobs, batching)

## Implementation

Here you show how you implemented your strategy:
- Code examples (for example caching middleware, decorators, query changes)
- Configuration examples (cache settings, timeouts, headers)
- References to the code in GitLab

## Results & Trade-offs

Here you describe the impact of your changes:
- Before/after metrics or qualitative observations
- Any side effects or trade-offs (stale data, extra complexity, memory usage)

## Sources

List here the sources you used to design and implement caching and performance improvements (documentation, articles, videos, books, etc.).
Also include sources that helped you write the code.