DEV Community

Cover image for Veltrix Economy Sync Was A House Of Cards Until We Rethought Service Boundaries
Lillian Dube
Lillian Dube

Posted on

Veltrix Economy Sync Was A House Of Cards Until We Rethought Service Boundaries

The Problem We Were Actually Solving

I still remember the day our Veltrix economy sync system started to show signs of strain, it was like watching a house of cards teetering on the edge of collapse. We had been running with the default config for months, and while it had worked fine for our small test group, once we went live and our user base grew, the whole system began to buckle under the pressure. The main issue was that our economy sync was not designed to handle the volume of transactions we were seeing, and as a result, we were experiencing errors like java.lang.OutOfMemoryError and org.apache.kafka.common.errors.TimestampOutOfBoundsException at an alarming rate. Our team was spending more time firefighting than actually improving the system, and it was clear that we needed to rethink our approach.

What We Tried First (And Why It Failed)

Our initial attempt to solve the problem was to simply throw more resources at it, we increased the number of Kafka partitions and bumped up the memory allocation for our JVM. While this did help to alleviate some of the pressure, it was only a temporary fix, and soon we were seeing the same errors again. It was clear that we needed to take a more structured approach to solving the problem, rather than just trying to brute force our way through it. We tried using Apache Cassandra as a replacement for Kafka, but we ended up with a complex system that was difficult to maintain and debug. The error messages we were seeing, like com.datastax.driver.core.exceptions.NoHostAvailableException, were not giving us any clear indication of what was going wrong, and we were starting to realize that we needed to take a step back and look at the bigger picture.

The Architecture Decision

After a lot of discussion and debate, we decided to take a different approach, we would move away from the default config and instead implement a more modular and scalable architecture. We broke down the economy sync into smaller, more manageable components, each with its own clear responsibilities and service boundaries. We used a combination of Apache ZooKeeper and etcd to manage the state of the system, and implemented a custom consistency model using a combination of strong and eventual consistency. This allowed us to ensure that the system was both highly available and highly consistent, even in the face of failures. We also made the decision to use a custom metrics system, based on Prometheus and Grafana, to monitor the performance of the system and identify any potential issues before they became major problems.

What The Numbers Said After

The impact of the new architecture was almost immediate, we saw a significant reduction in the number of errors we were experiencing, and the system became much more stable and reliable. Our metrics system was showing us that the average latency for economy sync transactions had decreased by over 50%, and the error rate had decreased by over 75%. We were also seeing a significant reduction in the amount of time our team was spending on firefighting, and we were able to focus on improving the system and adding new features. The numbers were clear, the new architecture was a success, and we had finally solved the economy sync problem.

What I Would Do Differently

Looking back, I think we should have taken a more structured approach to solving the problem from the start, rather than trying to brute force our way through it. We should have taken the time to properly analyze the problem and identify the root causes, rather than just trying to treat the symptoms. I also think we should have been more careful in our evaluation of different technologies and tools, rather than just jumping on the latest trend. For example, we should have taken a closer look at the tradeoffs of using Apache Cassandra, and considered the potential risks and downsides. Additionally, I think we should have put more emphasis on monitoring and metrics from the start, rather than trying to bolt it on later. Overall, I think we learned a lot from the experience, and we will be able to apply those lessons to future projects and systems.


We removed the payment processor from our critical path. This is the tool that made it possible: https://payhip.com/ref/dev1


Top comments (0)