Case Study
TVG: Kafka Implementation

Mindera - Global Software Engineering Company
2022 May 19 - 1min. Read
Share
Copy Page Url

TVG: Case Study (Kafka Implementation)
This case study covers the work that Mindera conducted in collaboration with TVG, an online horse racing betting brand.
Overview
- Client: TVG
- Industry: Gaming
- Project type: Event bus
- Tech used: Google Cloud Platform, Kafka, and Kubernetes
About TVG
TVG (Television Games Network) is an online betting company that specialises in horse racing.
It offers televised coverage of over 150 tracks from across the globe and gives betting fans the chance to wager by using their phone, tablet, computer, or TV remote control.
Two billion dollars worth of bets are placed via TVG every year, with people from 33 US states able to wager on races.
Executive summary
Rather than rely on http service-to-service calls and lose state, TVG needed to ensure service-to-service and same service transactions weren’t lost. This meant it required an event bus. Mindera collaborated with TVG to deliver this.
It was achieved through the implementation of Kafka and the result was that data can be reliably moved from one TVG system to another.
Challenges
TVG uses microservices to deliver its applications with the pace, frequency, and reliability it needs to provide its customers with the experience they demand.
Service-to-service communications are restful by nature. It’s OK if service providers know the state of this but becomes catastrophic when they don’t.
An example scenario of this for TVG is when a player places a bet.
It comes through a front gateway to kick off a sequence. The wager must first meet the necessary requirements to be processed (such as being allowed in the state from which it's placed) and it follows an order of actions to bring it to conclusion. The player could drop this request at any point, meaning the bet would be lost.
The nature of internet activities is that this loss is a very real prospect and any break in service-to-service communications increases the chances of it happening.
TVG sought to take more ownership of its wallet, for it to be the source of truth for its customers’ accounts. To make that performant and ensure there was no loss to the accounts (for the bet to be successful and there to re-increment or balance removal) TVG needed an event bus.
The challenge was to implement a solution without over engineering it, something that would be very costly in resources and effort. But its significance goes beyond this. TVG lives and dies by its service-to-service comms — if it goes down then the results would be ruinous.
Mindera collaborated with TVG to overcome this challenge and deliver the event bus it needed.
Solutions
Kafka implementation was the solution to TVG’s need to ensure the data streamed between its services were able to meet the standards its business demands.
Kafka has inherent, within architecture sequencing — something that’s really important for money-based services.
It means that if you key-off in Kafka then you’re guaranteed to land in a sequential partition (consumed in exactly the same order) each time you’re decrementing the balance. This is vital because you can’t have two services decrementing the balance.
Implementing Kafka would go beyond TVG securing wallet ownership. By having all transactional service-to-service going through it, Kafka would deliver increased resilience to TVG’s operations.
Mindera’s didn’t use a managed service for Kafka. Instead, the service was on Mindera’s side in a Kubernetes cluster on GCP (Google Cloud Platform).
Not using a managed service does mean that a deep understanding of Kafka is required to be able to address any future, associated issues. This is an important point because the learning curve to the product is steep — you can’t just plug it in. Furthermore, implementing streaming in Java and creating the necessary sequence diagrams is not insignificant.
Indeed, a consideration has been made for the possibility of transitioning from Mindera’s managed cluster to Confluent or another SaaS provider.
The original implementation was based off this repo. Mindera altered the repo to serve the requirements of the project and deliver the service TVG needed.
Results
Kafka is an essential component in TVG’s application ecosystem. Its implementation means that TVG’s services continue talking to each other, doing so in a very mature way that happens in a pretty much self-pilot mode.
The result is that TVG’s data is communicated in the way it needs to be to ensure service-to-service and same service transactions aren’t lost.
Kafka implementation has also provided TVG with the following ancillary benefits:
- It delivers back pressure protection (latency). There are no longer bursts of traffic. It’s more even because there’s a ceiling on the rate TVG receives messages and traffic.
- It allows TVG to replay and relook at scenarios after the fact because these messages aren’t all destructively removed.
Client's words
Lars Temme, Director of Engineering for TVG, had this to say about the Kafka implementation project:
“This is not for the faint of heart. You need to understand the reasons for implementing Kafka because it’s a huge undertaking. There’s a tight interaction between the Streams API and Kafka.
“You either need to own your in-house expertise to be in control of this or know the difficulties of implementing the product out-of-house and ensure the team responsible for doing so is up to the task.”
Looking for a tech partner? Get in touch!
TVG is one of the many companies Mindera has collaborated with to provide long-term solutions to key business issues. If you need a tech partner for your business then please get in touch with us. We’d love to collaborate with you and help your business.
Share
Copy Page Url