Tutorial · Solution Architect – role and craft · Event-Driven Architecture
PoC, spike, prototype, MVP – how to plan and run a PoC (with a working example)
How a spike, a PoC, a prototype, an MVP and a pilot differ, when a PoC is really needed and how to run one: a hypothesis, measurable success criteria, a timebox, a scope cut, a plan, a report and a go/no-go decision recorded in an ADR. On the example of the VoltGo EV charging platform: can a Node.js OCPP gateway with Kafka ingest telemetry from 10,000 chargers at p95 < 300 ms? Gateway and consumer code in TypeScript, a k6 script, example results, downloadable plan and report templates, and the “PoC goes to production” trap.
“Let’s do a PoC” is one of the most frequently spoken and least often well-executed sentences in IT projects. Sometimes it ends with a week of playing with a new technology and no decision at all; sometimes – worse – with code that “temporarily” goes to production and stays there for years. A good PoC (proof of concept) is an experiment with a hypothesis, thresholds and a decision date. In this tutorial we plan and run such a PoC for the VoltGo EV charging platform – from the question to the ADR – with code you can run.
- 10,000
- simulated chargers – 4 k6 generators
- 1,000 msg/s
- steady-state telemetry – peak of 3,000 msg/s
- p95 < 300 ms
- latency threshold – gateway → live state
- 10 days
- PoC-01 timebox – 2 people, decision on 24 Nov
PoC, spike, prototype, MVP, pilot – how they differ
These words are often used interchangeably, which is asking for trouble: the team thinks it is running a quick experiment, while the business thinks it is getting the first version of the product. The difference is easiest to see in the question each form answers:
| Spike | PoC | Prototype | MVP | Pilot | |
|---|---|---|---|---|---|
| Question | how do we do it? how long will it take? | will it work technically under our conditions? | will users understand it and want it? | does the product deliver value in the market? | does it work for real customers at a small scale? |
| Audience | the team | architect, technical decision makers | users, PO, UX | market, business | selected customers, operations |
| Duration | hours – a few days | 1–3 weeks | days – weeks | months | weeks – months |
| Code afterwards | thrown away | thrown away, the knowledge stays | thrown away or a mock-up | production | production |
| Measure of success | an answer + an estimate | go/no-go criteria met | results of user tests | product metrics | pilot KPIs, stability |
| At VoltGo | how do we build the connection registry in Redis? | can the gateway + Kafka ingest telemetry from 10,000 chargers? | a clickable mock-up of starting a charge from a QR code | the app with ad hoc payment for the whole network | the new platform at 20 sites in Warsaw |
You will also come across POT (proof of technology – does the technology do what the vendor promises at all) and proof of value (does the solution deliver a measurable business benefit, often in presales). In practice the difference between a POT and a PoC matters less than naming the question and not mixing it up with building the product.
MVP, POC, POT - przestań mieszać te trzy rzeczy (apple-podcasts) – “The POC must deliver a fully functional production capable MVP.” Autentyczny cytat od klienta, który Łukasz wyciąga z Teamsów jak dowód rzeczowy w sprawie o zbiorowe pomieszanie pojęć. Brzmi znajomo? 🎯 MVP, POC, POT - trzy skróty, które w korporacji zlały się w jedno bezkształtne coś. Szymon…
When a PoC is needed – and when it is not
A PoC costs money: two people for two weeks is tens of thousands of złoty plus a delay to other work. It pays off when the cost of being wrong is higher than the cost of the experiment and the answer cannot be found more cheaply.
Typical signals that a PoC makes sense:
- Extreme NFRs – scale, latency or availability the team has never achieved (VoltGo: 10,000 persistent WebSocket connections and 1,000 msg/s at p95 < 300 ms).
- A technology that is new to the team in a critical place – here: Kafka, which the team does not know (risk R5 in the HLD).
- An unknown external system – a partner API whose behaviour under load nobody has seen.
- Vendor promises – “our product will handle everything” (that is more of a POT).
- Cost uncertainty – when the cloud bill could change the choice of option.
A PoC is not needed when the answer is known (do not test whether PostgreSQL can write 50 rows per second), when a wrong assumption is easy to fix later, or when you are really asking about usability – then you need a prototype, not a PoC.
Lesson 181 - Feasibility and Questioning Requirements (youtube) – Mark Richards on feasibility – an often overlooked architectural characteristic shaped by time, budget and skills – and on questioning "requirements" that are really solutions handed down by stakeholders.
Hypothesis and measurable success criteria
A hypothesis turns a vague “let’s check out Kafka” into a sentence that can be disproved. The format is simple: we believe that solution X will let us achieve Y under conditions Z; we will consider it true if criteria K are met.
We believe that a Node.js OCPP gateway that publishes telemetry to Kafka (MSK) and acknowledges it after the write will ingest data from 10,000 chargers (1,000 msg/s, peak 3,000) with p95 latency < 300 ms and no message loss – also during a reconnect storm and an instance restart.
The criteria must be measurable, set before the start and approved by the decision maker. We split them into “must” (not met = no-go or a change of option) and “should” (not met = a condition or a risk):
| ID | Criterion | Threshold | How we measure | Weight |
|---|---|---|---|---|
| K1 | MeterValues acknowledgement (CALL → CALLRESULT) | p95 < 300 ms at 1,000 and 3,000 msg/s | the ocpp_ack_ms trend in k6 | must |
| K2 | end-to-end: charger timestamp → processed in the consumer | p95 < 300 ms | percentiles in the consumer | must |
| K3 | message loss | 0 | gaps in numbering + comparison: acknowledged in k6 = processed in the consumer | must |
| K4 | gateway process CPU at 5,000 connections and 500 msg/s | < 70% of one core | instance metrics, loop_p99 | must |
| K5 | storm: 10,000 reconnects within ~10 s | all accepted ≤ 5 min, acknowledgements p95 < 300 ms | k6 + dashboard | must |
| K6 | restart of one of 3 gateway instances | chargers back < 60 s, 0 gaps | k6 + consumer | should |
| K7 | cost of the telemetry path at 10,000 charge points | ≤ PLN 8,000 per month | AWS Pricing Calculator | should |
Timebox and scope cut
A timebox is not a deadline but a budget: after 10 days we make a decision with what we know – even if the answer is “we did not get to K6”. Extending a PoC by “just one more week” is a sign that the question was too broad.
We cut the scope by a single rule: only what affects the answer stays. Everything else – however tempting – goes, with a justification:
| In scope | Out of scope (and why it is safe to skip) |
|---|---|
BootNotification, MeterValues, StatusNotification | Start/StopTransaction – the synchronous path, a separate risk, tested in the lab |
| TLS terminated in the gateway (as in security profile 2) | per-charger passwords – negligible cost compared with TLS, a separate security test |
Kafka on MSK (3 brokers, acks=all) – as in production | Redis – known write cost (~1 ms); in the PoC the state lives in the consumer’s memory |
| a consumer that measures latency and gaps | real chargers – risk R1, the lab with 3 models |
| reconnect storm, instance restart | cross-region DR, UI, operator authorisation |
The day-by-day plan is part of the PoC too, because without it “the environment” can eat half of the timebox:
- Day 1 (9 Nov) Plan and criteria – Hypothesis, K1–K7, scope and scenarios approved by the CTO and the Charging team lead. Branch `poc/telemetry-ingest`.
- Days 2–4 Code – Gateway, consumer, k6 script; a local smoke test with Redpanda and 500 chargers.
- Day 5 Environment – An AWS sandbox account with Terraform: NLB, 3 gateway instances, MSK, consumer, 4 k6 generators, Grafana.
- Days 6–7 S1 scenarios – Steady state with 10,000 chargers, a peak of 3,000 msg/s, one instance with 5,000 connections.
- Days 8–9 S2–S3 scenarios – Reconnect storm (two rounds), gateway instance restart.
- Day 10 (23 Nov) Report and decision – Report, dashboard demo, go/no-go decision; ADR-0003 and the HLD updated on 24 Nov. `terraform destroy`.
You write the plan down in a short document – a downloadable template:
# PoC-<no>: <the question in one sentence, ending with a question mark>
| Owner | Team | Timebox | Start | Decision (date, who) |
|---|---|---|---|---|
| <architect> | <2–3 people> | <e.g. 10 working days> | YYYY-MM-DD | YYYY-MM-DD, <decision maker> |
## 1. Why this PoC
<!-- Which assumption from the HLD/ADR are we testing? What happens to the architecture if it turns out to be false? -->
- Assumption / risk: <A1, R2 from the HLD register>
- Decision that depends on it: <ADR-XXXX>
- Cost of being wrong without a PoC: <e.g. rewriting the gateway after launch, PLN X thousand more per month>
## 2. Hypothesis
We believe that **<solution>** will let us **<achieve the outcome>** under **<conditions / scale>**.
We will consider the hypothesis confirmed if **<measurable criteria from section 3>**.
## 3. Success criteria (go / no-go)
| ID | Criterion | Threshold | How we measure | Weight (must / should) |
|---|---|---|---|---|
| K1 | | | | must |
| K2 | | | | should |
## 4. Scope
| In scope | Out of scope (and why it is safe to skip) |
|---|---|
| | |
## 5. Test scenarios
| Scenario | Load / event | Duration | What we observe |
|---|---|---|---|
| S1 steady state | | | |
| S2 peak / storm | | | |
| S3 failure | | | |
## 6. Environment and tools
- Infrastructure: <sandbox account, region, instance types – as close to production as possible>
- Load generators: <k6, how many machines, how many VUs per machine>
- Measurement: <metrics, dashboard, where raw results are stored>
- Code: branch `poc/<name>` – **never merged to main**; archived with a tag after the decision
## 7. Day-by-day plan
| Day | Goal |
|---|---|
| 1 | plan and criteria approved by the decision maker |
| … | |
| last | report, demo, decision |
## 8. PoC budget and risks
- Environment cost: <amount> · People: <person-days>
- What stops the PoC early: <e.g. no access to the vendor sandbox>Example: PoC-01 – telemetry from 10,000 chargers
The PoC architecture is deliberately minimal: simulated chargers (k6) → OCPP gateway → Kafka → a consumer that measures latency and counts gaps. Nothing more is needed to answer the question.
The code is simple but not naive: the gateway acknowledges MeterValues only after the write to Kafka (at-least-once delivery), groups messages into micro-batches every 5 ms, and during a reconnect storm it can answer BootNotification with the Pending status – a mechanism from OCPP 1.6 itself that tells the charger to try again after the given number of seconds.
Project and how to run it
PoC-01 project – package.json, tsconfig, Redpanda
{
"name": "voltgo-poc-telemetry",
"version": "0.1.0",
"private": true,
"description": "PoC-01: can one OCPP gateway + Kafka ingest MeterValues from 10 000 chargers with p95 < 300 ms end-to-end?",
"type": "module",
"engines": { "node": ">=22" },
"scripts": {
"build": "tsc -p .",
"gateway": "node dist/gateway.js",
"consumer": "node dist/consumer.js",
"topic": "docker compose exec redpanda rpk topic create ocpp.inbound.v1 -p 24 -r 1",
"load": "k6 run k6/telemetry.js"
},
"dependencies": {
"kafkajs": "^2.2.4",
"ws": "^8.18.3"
},
"devDependencies": {
"@types/node": "^24.10.0",
"@types/ws": "^8.18.1",
"typescript": "^5.9.3"
}
}{
"compilerOptions": {
"target": "ES2023",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"rootDir": "src",
"outDir": "dist",
"strict": true,
"noUncheckedIndexedAccess": true,
"skipLibCheck": true,
"sourceMap": true
},
"include": ["src"]
}services:
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v26.2.7
command:
- redpanda
- start
- --mode=dev-container
- --smp=2
- --kafka-addr=internal://0.0.0.0:9092,external://0.0.0.0:19092
- --advertise-kafka-addr=internal://redpanda:9092,external://localhost:19092
ports:
- "19092:19092"docker compose up -d # Redpanda (Kafka API) on localhost:19092
npm install && npm run build
npm run topic # ocpp.inbound.v1, 24 partitions
npm run gateway # terminal 1
npm run consumer # terminal 2
k6 run -e CHARGERS=500 -e RAMP=30s -e HOLD=2m k6/telemetry.js # terminal 3: smoke test
Locally you check correctness, not performance: Redpanda speaks the Kafka API but is a different engine, and a laptop running the generator, the broker and the gateway on one CPU tells you nothing about production. The numbers for the report come from the AWS environment.
OCPP frames and the gateway
OCPP gateway – OCPP-J frames and the Kafka producer
// Minimal OCPP 1.6-J framing – just enough for the PoC.
// Frames are JSON arrays: CALL [2, id, action, payload], CALLRESULT [3, id, payload], CALLERROR [4, id, code, text, details].
export type Call = [2, string, string, Record<string, unknown>];
export interface SampledValue {
value: string;
measurand?: string;
unit?: string;
}
export interface MeterValuesReq {
connectorId: number;
transactionId?: number;
meterValue: { timestamp: string; sampledValue: SampledValue[] }[];
}
/** Envelope published to Kafka for every inbound charger message. */
export interface InboundEvent {
cpId: string;
action: string;
uniqueId: string;
receivedAt: number; // epoch ms at the gateway
payload: Record<string, unknown>;
}
export function parseCall(raw: string): Call | null {
try {
const msg: unknown = JSON.parse(raw);
if (
Array.isArray(msg) &&
msg[0] === 2 &&
typeof msg[1] === 'string' &&
typeof msg[2] === 'string' &&
typeof msg[3] === 'object' &&
msg[3] !== null
) {
return msg as Call;
}
} catch {
// not JSON – treated as a protocol error by the caller
}
return null;
}
export const callResult = (id: string, payload: Record<string, unknown> = {}): string => JSON.stringify([3, id, payload]);
export const callError = (id: string, code: 'NotImplemented' | 'FormationViolation' | 'InternalError', text: string): string =>
JSON.stringify([4, id, code, text, {}]);
/** Value of one measurand from the newest sample, e.g. 'Power.Active.Import'. */
export function measurand(req: MeterValuesReq, name: string): number | undefined {
const sample = req.meterValue.at(-1);
const v = sample?.sampledValue.find((s) => (s.measurand ?? 'Energy.Active.Import.Register') === name)?.value;
return v === undefined ? undefined : Number(v);
}// PoC OCPP gateway: holds charger WebSockets and publishes inbound messages to Kafka.
// MeterValues/StatusNotification are acknowledged only AFTER Kafka confirms the write (at-least-once).
import { readFileSync } from 'node:fs';
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
import { createServer as createTlsServer } from 'node:https';
import { monitorEventLoopDelay } from 'node:perf_hooks';
import { Kafka, logLevel, type Message } from 'kafkajs';
import { WebSocket, WebSocketServer } from 'ws';
import { callError, callResult, parseCall, type InboundEvent } from './ocpp.js';
const PORT = Number(process.env.PORT ?? 9000);
const TOPIC = process.env.TOPIC ?? 'ocpp.inbound.v1';
const BROKERS = (process.env.BROKERS ?? 'localhost:19092').split(',');
const FLUSH_MS = Number(process.env.FLUSH_MS ?? 5);
const BOOT_RATE = Number(process.env.BOOT_RATE ?? 0); // accepted BootNotifications per second, 0 = unlimited
const kafka = new Kafka({ clientId: `ocpp-gw-${process.pid}`, brokers: BROKERS, logLevel: logLevel.WARN });
const producer = kafka.producer({ allowAutoTopicCreation: false });
type Pending = { msg: Message; ack: () => void };
let pending: Pending[] = [];
let flushing = false;
const stats = { connections: 0, published: 0, failed: 0, bootPending: 0 };
// Load shedding for reconnect storms: above BOOT_RATE/s, answer "Pending" with a random retry interval.
// OCPP 1.6: a charger in Pending state retries BootNotification after `interval` seconds.
let bootTokens = BOOT_RATE;
if (BOOT_RATE > 0) setInterval(() => (bootTokens = BOOT_RATE), 1000).unref();
function admitBoot(): boolean {
if (BOOT_RATE === 0) return true;
if (bootTokens <= 0) return false;
bootTokens--;
return true;
}
// Micro-batching: one Kafka request every few ms instead of one per charger message.
async function flush(): Promise<void> {
if (flushing || pending.length === 0) return;
flushing = true;
const batch = pending;
pending = [];
try {
await producer.send({ topic: TOPIC, acks: -1, messages: batch.map((p) => p.msg) });
for (const p of batch) p.ack();
stats.published += batch.length;
} catch (err) {
// No CALLRESULT is sent: chargers retry transaction-related messages after a timeout.
stats.failed += batch.length;
console.error(`kafka send failed (${batch.length} msgs):`, (err as Error).message);
} finally {
flushing = false;
}
}
function onMessage(cpId: string, socket: WebSocket, raw: string): void {
const call = parseCall(raw);
if (!call) return; // CALLRESULT/CALLERROR from the charger – not used in the PoC
const [, uniqueId, action, payload] = call;
switch (action) {
case 'BootNotification': {
const currentTime = new Date().toISOString();
if (admitBoot()) {
socket.send(callResult(uniqueId, { status: 'Accepted', currentTime, interval: 300 }));
} else {
stats.bootPending++;
socket.send(callResult(uniqueId, { status: 'Pending', currentTime, interval: 30 + Math.floor(Math.random() * 90) }));
}
return;
}
case 'Heartbeat':
socket.send(callResult(uniqueId, { currentTime: new Date().toISOString() }));
return;
case 'MeterValues':
case 'StatusNotification': {
const event: InboundEvent = { cpId, action, uniqueId, receivedAt: Date.now(), payload };
pending.push({
msg: { key: cpId, value: JSON.stringify(event) }, // key = charger → per-charger ordering
ack: () => {
if (socket.readyState === WebSocket.OPEN) socket.send(callResult(uniqueId));
},
});
return;
}
default:
socket.send(callError(uniqueId, 'NotImplemented', `${action} is out of PoC scope`));
}
}
// TLS like OCPP security profile 2 (the NLB passes TLS through, the gateway terminates it).
const reject = (_req: IncomingMessage, res: ServerResponse) => res.writeHead(426).end('Upgrade Required');
const { TLS_CERT, TLS_KEY } = process.env;
const server =
TLS_CERT && TLS_KEY ? createTlsServer({ cert: readFileSync(TLS_CERT), key: readFileSync(TLS_KEY) }, reject) : createServer(reject);
const wss = new WebSocketServer({
server,
handleProtocols: (protocols) => (protocols.has('ocpp1.6') ? 'ocpp1.6' : false),
});
wss.on('connection', (socket, req) => {
// OCPP-J: the charge point identity is the last segment of the URL, e.g. /ocpp/VG-WAW-00042
const cpId = decodeURIComponent(req.url?.split('/').pop() ?? '');
if (socket.protocol !== 'ocpp1.6' || !/^[A-Za-z0-9._-]{1,48}$/.test(cpId)) {
socket.close(1002, 'ocpp1.6 subprotocol and a valid charge point id are required');
return;
}
stats.connections++;
socket.on('message', (data) => onMessage(cpId, socket, data.toString()));
socket.on('close', () => stats.connections--);
});
const loopDelay = monitorEventLoopDelay({ resolution: 10 });
loopDelay.enable();
let lastPublished = 0;
setInterval(() => {
const rate = (stats.published - lastPublished) / 10;
lastPublished = stats.published;
const p99 = (loopDelay.percentile(99) / 1e6).toFixed(1);
const rss = Math.round(process.memoryUsage().rss / 1024 / 1024);
console.log(
`conn=${stats.connections} published/s=${rate.toFixed(0)} failed=${stats.failed} queue=${pending.length} boot_pending=${stats.bootPending} loop_p99=${p99}ms rss=${rss}MB`,
);
loopDelay.reset();
}, 10_000).unref();
const flushTimer = setInterval(() => void flush(), FLUSH_MS);
async function shutdown(): Promise<void> {
console.log('shutting down: closing sockets, flushing the last batch');
clearInterval(flushTimer);
for (const ws of wss.clients) ws.close(1001, 'gateway restart'); // chargers reconnect to another instance
await flush();
await producer.disconnect();
server.close(() => process.exit(0));
}
process.on('SIGTERM', () => void shutdown());
process.on('SIGINT', () => void shutdown());
await producer.connect();
const scheme = TLS_CERT ? 'wss' : 'ws';
server.listen(PORT, () => console.log(`OCPP gateway ${scheme}://0.0.0.0:${PORT}/ocpp/<chargePointId> → ${TOPIC} @ ${BROKERS.join(',')}`));The rest of this article is for members
Create a free account or sign in to read it all. Still ahead:
- The consumer: latency and gaps
- The k6 script: 2,500 chargers per generator
- Reconnect storm: the result that changed the design
- The results report
- The go/no-go decision and the ADR
- Traps that ruin a PoC
- Tools for a PoC
- Related
- Check yourself