DEV Community

Cover image for Crypto exchange with Kafka Streams only: Part 1 - Overview
Rodion Altshuler
Rodion Altshuler

Posted on

Crypto exchange with Kafka Streams only: Part 1 - Overview

Why single-tool solution?

How many infrastructure components you need to build Cryptocurrency Exchange (centralised one) if we talk strictly about trade order processing? As we definitely need some kind of persistent storage, we need at least one.

So can we achieve all the desired functionality and quality attributes - performance and availability included - with single infrastructure piece, in addition to domain services?

Inspired by Kappa Architecture and achieving ACID transactions using Kafka Streams, I became curios enough to build the whole solution with Kafka only (Kafka Streams specifically).

Purpose of the project

Goal 2

It's interesting to see performance (throughput specifically - orders processed per second), and especially comparing to "base level" that would be using transactions SQL database.

Goal 1

Which is more interesting - to evaluate development experience: sql-db-based solution definitely simpler, but to what extent?

Main goal

Actually I have some knowledge gaps in Kafka Streams design and implementation, so hope to fill some of them with a help of this project and uncomfortable questions/comments of yours.

The result

Here is the Github repo for this project, if you're curios enough to take a look before it's ready: https://github.com/rodionaltshuler/crypton-exchange

The scope

Orders operations (submit, fill, cancel)
Order matching
Wallet operations (debit, credit, order-specific operations like blocking funds for orders and unblocking on execution/cancellation)

Streams topology

Streams topology

It's my first post here, so I'm looking to feedback whether this topic is interesting enough to make a series of articles about different aspects of the project, for example

  • performance metrics
  • building REST API on top of ksqldb
  • providing pull (request-reply) or push (real-time updates using server-sent events) endpoints of this API.

Top comments (0)