Skip to content

Sales Performance Dashboard

A sales performance dashboard recomputed everything on demand against a legacy system I was not allowed to touch, query directly, or ask for a push feed. Here is what I could change, and what it cost.


Role

Senior Backend Developer, sole owner

Period

2024, Berijalan Technocenter

Stack

Spring Boot, Kafka, CDC, Alibaba Cloud

Outcome

~3 min → < 1 s, CPU spikes gone


01 — Context

What was actually wrong

Every time a sales manager opened the performance dashboard, the service recomputed aggregates on demand by calling into a slow legacy application. Page load sat at roughly three minutes. Worse, the load arrived in bursts — everyone opens the dashboard at the end of the reporting period — so the underlying database spiked its CPU exactly when the rest of the business needed it most.

The obvious fix, computing less, was not available: the numbers were the product. The second obvious fix, computing them ahead of time, required getting the data out of a system that offered no supported way to do that.

Symptom
Load time and database CPU both peaked at the same moment — a strong hint the read path, not the query, was the problem.
02 — Constraints

Three things I could not change

Hard 01

No database access

Direct reads against the source database were forbidden by policy. Not slow — forbidden.

Hard 02

Unmodifiable app

The legacy application could not be changed, so no hooks, no outbox table, no new endpoints.

Hard 03

No push mechanism

Nothing in the source would notify us when data changed. Every option had to discover change itself.

03 — Options

What I rejected, and why

A

Poll the existing API on a schedule

Simplest to build and needs no new infrastructure — but it re-creates the load problem on a timer instead of removing it, and the polling interval becomes the freshness ceiling.

Rejected — same load, moved
B

Read the source database directly

Technically the cleanest read path and the one a greenfield design would pick. Ruled out by access policy before any engineering argument could apply.

Rejected — policy, not preference
C

Change Data Capture into Kafka

Observes change at the log level without touching the application, and the company already ran Kafka — so the marginal infrastructure cost was close to zero. Buys pre-aggregation at the price of eventual consistency.

Chosen — reuses existing infra
Deciding factor
Kafka was already running and already paid for. A correct design that needs new infrastructure often loses to a good one that needs none.
04 — Architecture
Fig. 01 — Before and after
Before — on-demand recompute
Dashboardevery loadRecomputeper requestfull scanLegacy app+ database~3 min · CPU spike
After — CDC pipeline, pre-aggregated
Legacy DBwrite logCDCconnectorapp untouchedKafkatopicexisting clusterAggregateconsumerbatch cap 500Pre-agg store+ dashboardread in < 1 s

The read path never touches the legacy system again. The write path absorbs the cost, asynchronously.

Stress-tested under burst load: worst-case consumer lag ~10 s.

Tuning
The 500-message batch cap is the lever. Larger batches raise throughput but stretch worst-case lag; 500 held lag near ten seconds under the burst profile we tested.
05 — Trade-off

The numbers are now slightly stale, and users can see exactly how stale.

Pre-aggregation buys speed with freshness. Rather than hide that, the dashboard surfaces a last-sync timestamp, so a manager reading a number knows the moment it was true. Hiding eventual consistency is how you get people quietly mistrusting a system; showing it is how you get them to plan around it.

That decision also made the failure mode legible in production. A stale timestamp is a visible symptom of consumer lag — the dashboard became its own monitor.

06 — Result

< 1 s
Page load, from ~3 min
~10 s
Worst-case lag, burst load
0
Peak-hour CPU spikes

Stack
KafkaCDCSpring BootAlibaba CloudResilience4j

Next
Case 02
ATS / HRIS Connector Platform

One integration platform configured per client at runtime, instead of a fork per customer in code — and no engineering work required from the client to onboard.