HomeSample Page

Sample Page Title


By Simon Chemouil, Senior Director of Engineering

It’s time to inform how that early wager grew to become the default approach 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 at the moment.

Targets and outcomes

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

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

We minimized the chance price of the rewrite by rising the Rust stack opportunistically. As our PHP stack grew to become tougher to evolve, we shipped new options in Rust. This saved our time to market largely unchanged: the time invested within the rewrite was offset by the more and more sluggish PHP product updates brought on by technical debt.

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

Performing below stress

Late 2020 and early 2021 had been defining. The bull run pushed each system to its limits. We confronted connection storms and blocking I/O saturating our PHP providers. As a result of we had already invested in Rust foundations, we might 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 performant exchanges – not solely at low-latency buying and selling, however throughout each user-facing system. That snappiness is now a part of our id.

Structure and design: staff and system as one

A staff and the software program it builds are symbiotic, like a tree and its surroundings. Our legacy codebase contained years of tacit, tribal data — intricate logic understood by solely a handful of engineers. The rewrite gave us an opportunity to rediscover, doc, and share that data, reworking 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 instant 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 robust contracts.

Previous the honeymoon

Six years in, we’re long gone the honeymoon part with Rust: it has develop into an afterthought. Each 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 practical multi-language technique

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

That protocol is gRPC (Protobuf). We standardize inside service communication on gRPC, making certain clear interoperability throughout Rust, C++, Go, Python, and TypeScript (Node.js). We outline protobufs as soon as, generate idiomatic purchasers and servers for each supported stack, and every thing else — tracing, retries, deadlines, observability — follows robotically. This permits groups to interoperate seamlessly no matter implementation language.

Our default stack is Rust – Tokio-based, with inside 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 decide the correct software, however all providers share the identical contract.

Why Rust saved paying dividends

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

  • Reliability by development: possession and borrowing get rid of complete courses of reminiscence and concurrency bugs earlier than they ship
  • Fewer heisenbugs: these elusive defects that change habits when noticed not often survive Rust’s compile-time checks.
  • Failure modes by design: express error semantics makes errors firstclass constructs, not an afterthought.
  • Reuse at scale: a shared runtime permits frequent 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 sooner product supply.

The journey wasn’t with out detours. We generally needed to pause and rebuild subsystems from scratch, and people moments carried actual price. We additionally encountered intervals of dependency hell, brought on by poorly outlined inside 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 continues to be invaluable. Years later, after we revisit code to hint an encoding or make clear a crucial knowledge path, that precision is a godsend. The intent of the code is express, 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 massive codebases, and clarify idioms inline. Engineers use them in numerous methods — some as pair-programming companions, others via extra structured, spec-driven approaches. Nonetheless they’re used, they make coding sooner and scale back friction in day-to-day growth.

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

Individuals and tradition

Rust has been a magnet for engineers who worth correctness, efficiency, and readability. It attracts individuals who take possession, suppose 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 may 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 pondering 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 surroundings rewards a shared mindset: precision, accountability, and pleasure in our work. Rust reinforces these values by demanding rigor, and our individuals carry them ahead by constructing with function and belief. We’re at all times on the lookout for engineers who share that mindset and need to develop with us.

The brand new default

What started as a technical refresh has develop into rather more than that. Rust is now the inspiration of how we construct and suppose—quietly enabling efficiency, security, and velocity whereas letting groups deal with product and impression. 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 preserve evolving with their instruments. The work continues – refining, scaling, and welcoming new engineers who share our curiosity and requirements.

When you’re one among 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

Latest Articles