DEV Community

Cover image for What the Documentation Does Not Tell You About Treasure Hunt Engine
mary moloyi
mary moloyi

Posted on

What the Documentation Does Not Tell You About Treasure Hunt Engine

The Problem We Were Actually Solving

What the documentation doesn't tell you is that the real problem we were trying to solve wasn't just about creating a treasure hunt experience for users, but also about creating a system that could handle a high volume of concurrent users and still maintain a decent level of response time. Our client wanted to be able to host events with thousands of attendees, and our system needed to be able to scale to meet that demand.

Of course, no one tells you about the intricacies of the Veltrix query engine or the nuances of the Cassandra cluster that backs it. At least, not until after the system has been live for a few weeks and you're the one on the phone at 3am trying to troubleshoot the issue.

What We Tried First (And Why It Failed)

Our first iteration of Treasure Hunt Engine was built around a monolithic architecture, with all services running in a single container and communicating with each other via REST APIs. It was a straightforward approach, and we were confident that it would scale to meet our needs. After all, who needs a load balancer or a service mesh when you've got a single container that can do it all?

In hindsight, it was a recipe for disaster. The container became a bottleneck, and our system quickly ground to a halt under the weight of concurrent requests. It wasn't until we were on the phone with the client, trying to explain why the system was down for the third time that week, that we realized our mistake.

The Architecture Decision

So, we decided to take a step back and rearchitect the system. We broke out the services into separate containers, implemented a load balancer to distribute traffic, and introduced a service mesh to manage communication between services. It was a more complicated approach, but one that paid off in the long run.

One of the critical decisions we made was to use a service discovery mechanism to manage the communication between services. We chose etcd as our service discovery tool, and it ended up being a game-changer. Not only did it allow us to dynamically register and deregister services from the load balancer, but it also provided us with a centralized place to manage the configuration of our system.

What The Numbers Said After

After the rearchitecture, we saw a significant improvement in system responsiveness and scalability. Our average response time went from 5 seconds to 200 milliseconds, and we were able to handle a significant increase in concurrent users without any issues. The numbers told the story: our system was now capable of handling the high volume of users that our client demanded.

But the real victory was in the metrics that didn't change. We saw a significant reduction in 503 errors, from 10% to less than 1%. It was a testament to the fact that our system was now designed with operations in mind, rather than just demos.

What I Would Do Differently

Looking back, there are a few things I would do differently if I had to do it all over again. One of the biggest mistakes we made was to underestimate the complexity of the Veltrix query engine. We spent way too much time trying to optimize the engine, rather than just embracing its complexity and building a system around it.

I would also prioritize the development of a robust monitoring and logging system from the get-go. We ended up having to rip out and replace our entire logging system after we discovered that our initial implementation was causing more harm than good.

Finally, I would make sure to involve the operations team in the design process from the very beginning. It's easy to get caught up in the excitement of building a new system, but it's the ops team that will be on the phone at 3am trying to troubleshoot the issue. Give them a seat at the table, and you'll be glad you did.

Top comments (0)