← Back to projects

High-performance grading service in Go

Backend

Problem

Grade large batches reliably, separating queued work from result caching, and keeping everything ready for a future cloud migration.

Impact

A fast, portable service with correct storage policies and compatibility with managed cloud Redis.

The problem

The service had to grade large batches reliably. It needed a queue for pending work and a cache for results — but those two workloads have opposite memory policies, and the plan was to move to the cloud, where managed Redis imposes constraints.

The architecture

  • Go HTTP service, with grading logic separated from the transport layer.
  • Two Redis instances: one for cache and one for the queue, isolated by key prefixes (not by multi-DB).
  • Separate worker from the API, so processing scales independently.
  • Multi-token Bearer authentication to protect the endpoints.

Key decisions

  • Two Redis instances instead of one with multi-DB: the cache needs an eviction policy (allkeys-lru) and the queue needs to not lose data (noeviction). Those are mutually exclusive in a single instance. Multi-DB is also not viable on managed Redis in cluster mode — so splitting by instance and prefix made the design cloud-ready from day one.
  • Worker/API split: compute scales without affecting endpoint availability.

Impact

A fast grading service with the right storage policy for each workload, portable to managed infrastructure without a redesign.