0%

Oxidizing Kraken, Part 2: from bet to backbone

1 hour ago 9 min read
News Article Banner Image

Goals and outcomes

Large-scale rewrites rarely end well. They drift, they stall, and they often never finish because some last piece of legacy code holds everything together. Our story turned out differently. Despite constraints and a constant balancing act among new features, compliance, and technical remediation, we completed the effort.

The result isn’t perfect (Is a six-year-old codebase ever perfect?), but it’s a solid foundation that enables us to expand, delegate, and accelerate. We now have millions of lines of Rust across hundreds of services, and our engineering organization has grown beyond 200 people. We achieved what we set out to do, and more.

We minimized the opportunity cost of the rewrite by growing the Rust stack opportunistically. As our PHP stack became harder to evolve, we shipped new features in Rust. This kept our time to market largely unchanged: the time invested in the rewrite was offset by the increasingly slow PHP product updates caused by technical debt.

The rewrite progressed through our product roadmap, not beside it. We did take detours to rebuild entire subsystems, but those were unavoidable and quickly paid for themselves once those paths ran on Rust.

Performing under pressure

Late 2020 and early 2021 were defining. The bull run pushed every system to its limits. We faced connection storms and blocking I/O saturating our PHP services. Because we had already invested in Rust foundations, we could respond quickly: migrating our REST APIs to async Rust based on Tokio.

That move unlocked reuse across layers and drastically simplified the stack. Together with improvements to our C++ trading engine, it helped make Kraken one of the most performant exchanges – not only at low-latency trading, but across every user-facing system. That snappiness is now part of our identity.

Architecture and design: team and system as one

A team and the software it builds are symbiotic, like a tree and its environment. Our legacy codebase contained years of tacit, tribal knowledge — intricate logic understood by only a handful of engineers. The rewrite gave us a chance to rediscover, document, and share that knowledge, transforming it from individual expertise into collective understanding.

This alignment around a coherent architectural vision brought consistency across the stack, making it far easier for engineers to navigate and contribute beyond their immediate domains. That level of cross-collaboration wasn’t feasible before, and while deep expertise still matters, it now exists within a shared, accessible framework. That foundation has become a cornerstone of our engineering culture.

To scale both teams and capacity, we decoupled monoliths and moved toward an event-driven architecture, powered by an in-house stream-processing framework for Kafka written in Rust. This design supports autonomy, composability, and observability — with clear boundaries and strong contracts.

Past the honeymoon

Six years in, we’re long past the honeymoon phase with Rust: it has become an afterthought. Day to day, we talk more about our Tokio-based ecosystem than the language itself: shared crates, testing frameworks, metrics, tracing, and service scaffolding. Rust is now the platform we stand on, not the topic of debate.

Explore open engineering roles at Kraken

A pragmatic multi-language strategy

Rust is our primary backend language by a wide margin with several million lines across hundreds of core services, and hundreds of engineers working with it daily. But we don’t optimize for uniformity at all costs. We privilege velocity and autonomy. Different problems call for different tools, and teams retain the freedom to move fast — as long as they speak the same protocol.

That protocol is gRPC (Protobuf). We standardize internal service communication on gRPC, ensuring clean interoperability across Rust, C++, Go, Python, and TypeScript (Node.js). We define protobufs once, generate idiomatic clients and servers for every supported stack, and everything else — tracing, retries, deadlines, observability — follows automatically. This allows teams to interoperate seamlessly regardless of implementation language.

Our default stack is Rust – Tokio-based, with internal libraries for I/O, RPC, storage, and telemetry. We still rely on C++ for ultra-hot paths like our trading engine. Go, Python, and TypeScript each have their place when their ecosystems or ergonomics make more sense. The contract is gRPC; the SLOs, observability, and security posture are the same. This gives us autonomy without chaos: teams pick the right tool, but all services share the same contract.

Why Rust kept paying dividends

The ideas that drove our early adoption of Rust continue to prove themselves in production:

  • Reliability by construction: ownership and borrowing eliminate entire classes of memory and concurrency bugs before they ship

  • Fewer heisenbugs: those elusive defects that change behavior when observed rarely survive Rust’s compile-time checks.

  • Failure modes by design: explicit error semantics makes errors first class constructs, not an afterthought.

  • Reuse at scale: a shared runtime enables common crates for codecs, auth, metrics, and configuration, compounding leverage across teams.

  • Less toil, more velocity: as keeping-the-lights-on costs dropped, we reinvested that time into faster product delivery.

The journey wasn’t without detours. We sometimes had to pause and rebuild subsystems from scratch, and those moments carried real cost. We also encountered periods of dependency hell, caused by poorly defined internal boundaries and API surfaces that pulled implementation details into shared crates. Those challenges weren’t Rust-specific — they’re familiar to anyone scaling a fast-moving system — but they taught us to design clearer contracts and isolation boundaries.

Still, Rust brings a level of precision to business logic that remains invaluable. Years later, when we revisit code to trace an encoding or clarify a critical data path, that precision is a godsend. The intent of the code is explicit, and the invariants are enforced by the compiler itself. The payoff has been lasting: stability, clarity, and confidence across the stack.

Coding in Rust with AI assistants

AI coding assistants have become a practical part of our workflow. They understand and write Rust, help navigate large codebases, and explain idioms inline. Engineers use them in different ways — some as pair-programming companions, others through more structured, spec-driven approaches. However they’re used, they make coding faster and reduce friction in day-to-day development.

Rust’s design makes it particularly compatible with AI tools. Its strong type system, borrow checker, and compiler hints provide clear feedback that helps these assistants generate better, safer code. AI helps with scaffolding, tests, and exploration, while Rust ensures that what lands in the codebase is correct and maintainable. The combination improves productivity without compromising quality.

People and culture

Rust has been a magnet for engineers who value correctness, performance, and clarity. It attracts people who take ownership, think systematically, and care about building durable systems. With a consistent stack and shared idioms, we’ve built a culture where engineers collaborate across domains, review each other’s work effectively, and share responsibility for quality.

We hire for fundamentals, curiosity, and the drive to improve. Prior Rust experience helps but  isn’t required; what matters most is the ability to reason about systems, write secure and maintainable code, and deliver with integrity. AI tools make onboarding smoother and help new hires ramp up quickly, but great engineering still comes from rigor, collaboration, and care.

Our mission goes beyond building reliable infrastructure: Kraken exists to accelerate the global adoption of crypto so more people can achieve financial freedom and inclusion. You can read more in the Kraken Culture Explained page.

That mission shapes how we work and who we hire. As Krakenites, we default to transparency, directness, and radical ownership; we value integrity over titles, clarity over ceremony, and long-term thinking over shortcuts. We operate with trust and autonomy, bias for action, and an expectation that everyone brings both judgment and humility to the table.

On top of that culture, we build a broad and ambitious product ecosystem:

This environment rewards a shared mindset: precision, accountability, and pride in our work. Rust reinforces those values by demanding rigor, and our people carry them forward by building with purpose and trust. We’re always looking for engineers who share that mindset and want to grow with us.

The new default

What began as a technical refresh has become much more than that. Rust is now the foundation of how we build and think—quietly enabling performance, safety, and velocity while letting teams focus on product and impact. The platform we built together has become the backbone of our systems, but more importantly, the shared discipline and culture around it have become part of who we are as engineers.

We’ve proven that large-scale rewrites can succeed, that a pragmatic multi-language strategy can stay coherent, and that great teams keep evolving with their tools. The work continues – refining, scaling, and welcoming new engineers who share our curiosity and standards.

If you’re one of them, come build the next chapter with us.

Explore open engineering roles at Kraken

Read the origin story: Oxidizing Kraken: Improving Kraken Infrastructure Using Rust .

The post appeared first on Kraken Blog.

Popular news

How to Set Up and Use Trust Wallet for Binance Smart Chain
#Bitcoin#Bitcoins#Config+2 more tags

How to Set Up and Use Trust Wallet for Binance Smart Chain

Your Essential Guide To Binance Leveraged Tokens

Your Essential Guide To Binance Leveraged Tokens

How to Sell Your Bitcoin Into Cash on Binance (2021 Update)
#Subscriptions

How to Sell Your Bitcoin Into Cash on Binance (2021 Update)

What is Grid Trading? (A Crypto-Futures Guide)

What is Grid Trading? (A Crypto-Futures Guide)

Start trading with Cryptohopper for free!

Free to use - no credit card required

Let's get started
Cryptohopper appCryptohopper app

Disclaimer: Cryptohopper is not a regulated entity. Cryptocurrency bot trading involves substantial risks, and past performance is not indicative of future results. The profits shown in product screenshots are for illustrative purposes and may be exaggerated. Only engage in bot trading if you possess sufficient knowledge or seek guidance from a qualified financial advisor. Under no circumstances shall Cryptohopper accept any liability to any person or entity for (a) any loss or damage, in whole or in part, caused by, arising out of, or in connection with transactions involving our software or (b) any direct, indirect, special, consequential, or incidental damages. Please note that the content available on the Cryptohopper social trading platform is generated by members of the Cryptohopper community and does not constitute advice or recommendations from Cryptohopper or on its behalf. Profits shown on the Markteplace are not indicative of future results. By using Cryptohopper's services, you acknowledge and accept the inherent risks involved in cryptocurrency trading and agree to hold Cryptohopper harmless from any liabilities or losses incurred. It is essential to review and understand our Terms of Service and Risk Disclosure Policy before using our software or engaging in any trading activities. Please consult legal and financial professionals for personalized advice based on your specific circumstances.

©2017 - 2025 Copyright by Cryptohopper™ - All rights reserved.