The Charger Counter That Restarted During a Charging Session
The Charger Counter That Restarted During a Charging Session
This situation follows the lesson Time-Series Storage & Roll-ups. Solve it on paper before you open a hint. The Teacher Gold Answer holds the worked solution, the other valid approaches and what a strong answer at each level demonstrates.
The scenario
Voltly runs a network of 40,000 electric-vehicle chargers, in 10,000 street cabinets of 4 chargers each. Each cabinet shares one grid connection, and Voltly's contract with the grid company says that a cabinet may never draw more than 10,000 W (an assumption of this scenario). Each charger's controller exposes two metrics:
charger_energy_wh_total{charger}, a counter: the energy delivered since the controller process started, in watt-hours (Wh). 1,000 Wh is 1 kWh.charger_power_w{charger}, a gauge: the power the charger is delivering at the scrape instant, in watts (W).
Collectors scrape every charger every 30 s, at :00 and :30 of each minute, and a sample lands at the store 2 s after its timestamp. The store keeps raw samples for 7 days and one tier of roll-ups: 1-hour rows, kept 5 years (1,826 days). Hour H is rolled up at H + 1 h 10 min from the raw samples, and each row is keyed by series, tier and window start and set, never added to. The planning figure for storage is 2 bytes a value, for raw samples and roll-up values alike. There is no 1-minute tier.
On Tuesday 3 March, two chargers in cabinet cab-5 are used. Charger c-17 charges a car at a steady 7,200 W from 13:00:00 to 14:30:00 (its gauge still reads 7,200 W at the 14:30:00 scrape, and 0 W from the 14:30:30 scrape on). Its counter reads 300,000 Wh at 13:00:00 (its controller started on 1 March). At 14:12:10 its controller reboots for a firmware update: the process restarts, the counter restarts from 0, and charging continues without a pause (an assumption). Charger c-18 charges at 7,200 W from 14:30:10 to 16:00:00. The other two chargers of cab-5 are idle all day.
Synthesizing vector architecture diagram...
H begins, a roll-up job builds that hour's rows from the raw samples, and those rows live for 5 years. The three dotted arrows are the questions, and all three point at the 1-hour rows, because by the time they are asked the raw samples of 3 March have been deleted. Whatever a row does not keep cannot be answered.A year later, three questions arrive:
- An audit asks how much energy
c-17delivered on 3 March. - The grid company asks whether
cab-5drew more than 10,000 W at any moment on 3 March. - A capacity review asks how large the 1-hour tier is for the 40,000 chargers over its 5 years, next to the 7 days of raw samples.
Your task
Design the 1-hour row for Voltly's metrics, and answer the three questions from it. A complete answer holds four things: the values a row keeps for each metric and for a cabinet; c-17's energy on 3 March from the rows, with its hour 14 value and what the reboot cost; the answer to the grid company's question, and what the rows must hold so that the answer is right; and the size of the 1-hour tier over 5 years against the 7 days of raw samples.
Hints
Open a hint only when you are stuck. Each hint gives a little more.
The Charger Counter That Restarted During a Charging Session
This situation follows the lesson Time-Series Storage & Roll-ups. Solve it on paper before you open a hint. The Teacher Gold Answer holds the worked solution, the other valid approaches and what a strong answer at each level demonstrates.
The scenario
Voltly runs a network of 40,000 electric-vehicle chargers, in 10,000 street cabinets of 4 chargers each. Each cabinet shares one grid connection, and Voltly's contract with the grid company says that a cabinet may never draw more than 10,000 W (an assumption of this scenario). Each charger's controller exposes two metrics:
charger_energy_wh_total{charger}, a counter: the energy delivered since the controller process started, in watt-hours (Wh). 1,000 Wh is 1 kWh.charger_power_w{charger}, a gauge: the power the charger is delivering at the scrape instant, in watts (W).
Collectors scrape every charger every 30 s, at :00 and :30 of each minute, and a sample lands at the store 2 s after its timestamp. The store keeps raw samples for 7 days and one tier of roll-ups: 1-hour rows, kept 5 years (1,826 days). Hour H is rolled up at H + 1 h 10 min from the raw samples, and each row is keyed by series, tier and window start and set, never added to. The planning figure for storage is 2 bytes a value, for raw samples and roll-up values alike. There is no 1-minute tier.
On Tuesday 3 March, two chargers in cabinet cab-5 are used. Charger c-17 charges a car at a steady 7,200 W from 13:00:00 to 14:30:00 (its gauge still reads 7,200 W at the 14:30:00 scrape, and 0 W from the 14:30:30 scrape on). Its counter reads 300,000 Wh at 13:00:00 (its controller started on 1 March). At 14:12:10 its controller reboots for a firmware update: the process restarts, the counter restarts from 0, and charging continues without a pause (an assumption). Charger c-18 charges at 7,200 W from 14:30:10 to 16:00:00. The other two chargers of cab-5 are idle all day.
Synthesizing vector architecture diagram...
H begins, a roll-up job builds that hour's rows from the raw samples, and those rows live for 5 years. The three dotted arrows are the questions, and all three point at the 1-hour rows, because by the time they are asked the raw samples of 3 March have been deleted. Whatever a row does not keep cannot be answered.A year later, three questions arrive:
- An audit asks how much energy
c-17delivered on 3 March. - The grid company asks whether
cab-5drew more than 10,000 W at any moment on 3 March. - A capacity review asks how large the 1-hour tier is for the 40,000 chargers over its 5 years, next to the 7 days of raw samples.
Your task
Design the 1-hour row for Voltly's metrics, and answer the three questions from it. A complete answer holds four things: the values a row keeps for each metric and for a cabinet; c-17's energy on 3 March from the rows, with its hour 14 value and what the reboot cost; the answer to the grid company's question, and what the rows must hold so that the answer is right; and the size of the 1-hour tier over 5 years against the 7 days of raw samples.
Hints
Open a hint only when you are stuck. Each hint gives a little more.
Provide 1–2 precise sentences for each architectural dimension. Each box guides you on what staff-level interviewers evaluate.
Define SLA targets, hard consistency constraints, and conditions the system must never violate.
Quantify throughput (QPS/RPS), read:write ratios, and peak burst multipliers.
Step-by-step path: client ingress → API gateway → queues → background workers → persistence.
Database engine, table schema, partition keys (PK/SK), and durability strategy.
What resource hits saturation first under 10x traffic? (CPU, disk IOPS, connection pools, network).
Worker crashes, network partitions, split-brain, poison pill DLQ, retries, and idempotency.
What did you sacrifice in exchange and why? (e.g. eventual consistency vs latency, cost vs redundancy).