Tuesday, December 16, 2025
HomeCryptocurrencyOxidizing Kraken, Half 2: from wager to spine

Oxidizing Kraken, Half 2: from wager to spine

By Simon Chemouil, Senior Director of Engineering

It’s time to inform how that early wager grew to become the default method we construct backend techniques, what we realized about scaling individuals and software program collectively, and the way new AI instruments are influencing how we construct immediately.

Targets and outcomes

Giant-scale rewrites not often finish properly. They drift, they stall, they usually typically by no means end as a result of some final piece of legacy code holds the whole lot collectively. Our story turned out in a different way. Regardless of constraints and a relentless balancing act amongst new options, compliance, and technical remediation, we accomplished the hassle.

The outcome isn’t excellent (Is a six-year-old codebase ever excellent?), nevertheless it’s a stable basis that permits us to increase, delegate, and speed up. We now have hundreds of thousands of strains of Rust throughout tons of of companies, and our engineering group has grown past 200 individuals. We achieved what we got down to do, and extra.

We minimized the chance value of the rewrite by rising the Rust stack opportunistically. As our PHP stack grew to become more durable to evolve, we shipped new options in Rust. This stored our time to market largely unchanged: the time invested within the rewrite was offset by the more and more gradual PHP product updates attributable to technical debt.

The rewrite progressed by way of our product roadmap, not beside it. We did take detours to rebuild whole subsystems, however these have been unavoidable and rapidly paid for themselves as soon as these paths ran on Rust.

Performing underneath stress

Late 2020 and early 2021 have been defining. The bull run pushed each system to its limits. We confronted connection storms and blocking I/O saturating our PHP companies. As a result of we had already invested in Rust foundations, we may reply rapidly: migrating our REST APIs to async Rust based mostly on Tokio.

That transfer unlocked reuse throughout layers and drastically simplified the stack. Along with enhancements to our C++ buying and selling engine, it helped make Kraken one of the vital performant exchanges – not solely at low-latency buying and selling, however throughout each user-facing system. That snappiness is now a part of our identification.

Structure and design: crew and system as one

A crew and the software program it builds are symbiotic, like a tree and its atmosphere. Our legacy codebase contained years of tacit, tribal information — intricate logic understood by solely a handful of engineers. The rewrite gave us an opportunity to rediscover, doc, and share that information, remodeling it from particular person experience into collective understanding.

This alignment round a coherent architectural imaginative and prescient introduced consistency throughout the stack, making it far simpler for engineers to navigate and contribute past their quick domains. That degree of cross-collaboration wasn’t possible earlier than, and whereas deep experience nonetheless issues, it now exists inside a shared, accessible framework. That basis has develop into a cornerstone of our engineering tradition.

To scale each groups and capability, we decoupled monoliths and moved towards an event-driven structure, powered by an in-house stream-processing framework for Kafka written in Rust. This design helps autonomy, composability, and observability — with clear boundaries and powerful contracts.

Previous the honeymoon

Six years in, we’re gone the honeymoon section with Rust: it has develop into an afterthought. Day after day, we discuss extra about our Tokio-based ecosystem than the language itself: shared crates, testing frameworks, metrics, tracing, and repair scaffolding. Rust is now the platform we stand on, not the subject of debate.

A realistic multi-language technique

Rust is our major backend language by a large margin with a number of million strains throughout tons of of core companies, and tons of of engineers working with it each day. However we don’t optimize for uniformity in any respect prices. We privilege velocity and autonomy. Totally different issues name for various instruments, and groups retain the liberty to maneuver quick — so long as they converse the identical protocol.

That protocol is gRPC (Protobuf). We standardize inner service communication on gRPC, guaranteeing clear interoperability throughout Rust, C++, Go, Python, and TypeScript (Node.js). We outline protobufs as soon as, generate idiomatic shoppers and servers for each supported stack, and the whole lot else — tracing, retries, deadlines, observability — follows routinely. This permits groups to interoperate seamlessly no matter implementation language.

Our default stack is Rust – Tokio-based, with inner libraries for I/O, RPC, storage, and telemetry. We nonetheless depend on C++ for ultra-hot paths like our buying and selling engine. Go, Python, and TypeScript every have their place when their ecosystems or ergonomics make extra sense. The contract is gRPC; the SLOs, observability, and safety posture are the identical. This provides us autonomy with out chaos: groups choose the best device, however all companies share the identical contract.

Why Rust stored paying dividends

The concepts that drove our early adoption of Rust proceed to show themselves in manufacturing:

  • Reliability by building: possession and borrowing eradicate whole lessons of reminiscence and concurrency bugs earlier than they ship
  • Fewer heisenbugs: these elusive defects that change conduct when noticed not often survive Rust’s compile-time checks.
  • Failure modes by design: specific error semantics makes errors firstclass constructs, not an afterthought.
  • Reuse at scale: a shared runtime permits widespread crates for codecs, auth, metrics, and configuration, compounding leverage throughout groups.
  • Much less toil, extra velocity: as keeping-the-lights-on prices dropped, we reinvested that point into quicker product supply.

The journey wasn’t with out detours. We generally needed to pause and rebuild subsystems from scratch, and people moments carried actual value. We additionally encountered intervals of dependency hell, attributable to poorly outlined inner boundaries and API surfaces that pulled implementation particulars into shared crates. These challenges weren’t Rust-specific — they’re acquainted to anybody scaling a fast-moving system — however they taught us to design clearer contracts and isolation boundaries.

Nonetheless, Rust brings a degree of precision to enterprise logic that is still invaluable. Years later, after we revisit code to hint an encoding or make clear a vital information path, that precision is a godsend. The intent of the code is specific, and the invariants are enforced by the compiler itself. The payoff has been lasting: stability, readability, and confidence throughout the stack.

Coding in Rust with AI assistants

AI coding assistants have develop into a sensible a part of our workflow. They perceive and write Rust, assist navigate giant codebases, and clarify idioms inline. Engineers use them in numerous methods — some as pair-programming companions, others by way of extra structured, spec-driven approaches. Nevertheless they’re used, they make coding quicker and scale back friction in day-to-day improvement.

Rust’s design makes it significantly appropriate with AI instruments. Its robust sort system, borrow checker, and compiler hints present clear suggestions that helps these assistants generate higher, safer code. AI helps with scaffolding, exams, and exploration, whereas Rust ensures that what lands within the codebase is appropriate and maintainable. The mixture improves productiveness with out compromising high quality.

Folks and tradition

Rust has been a magnet for engineers who worth correctness, efficiency, and readability. It attracts individuals who take possession, assume systematically, and care about constructing sturdy techniques. With a constant stack and shared idioms, we’ve constructed a tradition the place engineers collaborate throughout domains, evaluate one another’s work successfully, and share duty for high quality.

We rent for fundamentals, curiosity, and the drive to enhance. Prior Rust expertise helps however  isn’t required; what issues most is the power to motive about techniques, write safe and maintainable code, and ship with integrity. AI instruments make onboarding smoother and assist new hires ramp up rapidly, however nice engineering nonetheless comes from rigor, collaboration, and care.

Our mission goes past constructing dependable infrastructure: Kraken exists to speed up the worldwide adoption of crypto so extra individuals can obtain monetary freedom and inclusion. You possibly can learn extra within the Kraken Tradition Defined web page.

That mission shapes how we work and who we rent. As Krakenites, we default to transparency, directness, and radical possession; we worth integrity over titles, readability over ceremony, and long-term considering over shortcuts. We function with belief and autonomy, bias for motion, and an expectation that everybody brings each judgment and humility to the desk.

On prime of that tradition, we construct a broad and bold product ecosystem:

This atmosphere rewards a shared mindset: precision, accountability, and satisfaction in our work. Rust reinforces these values by demanding rigor, and our individuals carry them ahead by constructing with goal and belief. We’re at all times in search of engineers who share that mindset and wish to develop with us.

The brand new default

What started as a technical refresh has develop into way more than that. Rust is now the muse of how we construct and assume—quietly enabling efficiency, security, and velocity whereas letting groups deal with product and influence. The platform we constructed collectively has develop into the spine of our techniques, however extra importantly, the shared self-discipline and tradition round it have develop into a part of who we’re as engineers.

We’ve confirmed that large-scale rewrites can succeed, {that a} pragmatic multi-language technique can keep coherent, and that nice groups hold evolving with their instruments. The work continues – refining, scaling, and welcoming new engineers who share our curiosity and requirements.

Should you’re certainly one of them, come construct the subsequent chapter with us.

Learn the origin story: Oxidizing Kraken: Bettering Kraken Infrastructure Utilizing Rust.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments