Posts
Architecture, trade-offs, and low-level optimization notes from the projects I'm building.
One writer for every piece of state
September 24, 2026 · Naoto Exchange
Most locks exist because two things can write the same data, so Naoto makes sure they never do, whether they're separate services or two threads.
Moving work off the hot path
September 24, 2026 · Naoto Exchange
Before the first line of code, every step an order goes through was designed from two angles, what the system around it needs and what the hardware does with it, so that as much of the work as possible could move off the hot path.
Modeling a project's infrastructure as a graph
September 24, 2026 · CNP: Cloud-Native Platform
A flat list of resources can't tell a load-bearing database from one nobody uses anymore. A dependency graph can, by walking it from the project's entry points.
When a descriptor changes mid-send
September 24, 2026 · Naoto Exchange
A file descriptor is just a reusable integer, so a thread sending on one while another replaces it can send an order to the wrong socket.
Triple-buffering client state without ever blocking a reader
September 20, 2026 · Naoto Exchange
A risk check can't wait on whatever thread is updating a client's balance, so the balance lives in three buffers behind one atomic index.
Catching up a stale snapshot without blocking
September 20, 2026 · Naoto Exchange
Instead of waiting on another service for a client's balance, the gateway replays the updates it has already seen onto whatever snapshot comes back.
Reliable risk checking on real-time client states
September 20, 2026 · Naoto Exchange
The risk check never sees a client's real-time balance, only a slightly stale copy, and it has to be correct anyway.
Designing a cache-friendly, SIMD-accelerated key-value store
September 20, 2026 · Naoto Exchange
Picking, and then hand-building, the data structure the order book actually lives in.
One order book, two data structures
September 17, 2026 · Naoto Exchange
An order book needs exact-price lookups and best-price order at the same time, and no single structure is good at both, so it keeps two.