December 1, 2023
-
5
Min Read

Distributed locks: Save 50%+ on your DynamoDB lock client

Momento’s drop-in replacement lock library results in cost savings and enhanced performance.
Pratik Agarwal
Headshot of the blog author
by
Pratik Agarwal
,
,
by
Pratik Agarwal
by
green squirrel logo for momento
Pratik Agarwal
,
,
Integration

In our previous blog, we explored how Momento’s drop-in replacement for DynamoDB lock client simplifies distributed locks, enhancing both performance and user experience in high-traffic scenarios. Now, let's shift our focus to a crucial aspect of any technology adoption - cost-effectiveness. In this part, we'll conduct a detailed cost analysis between Momento and DynamoDB lock client libraries, demonstrating the significant savings Momento offers.

Momento vs DynamoDB lock client cost analysis

It's the Super Bowl in America, and fans are eagerly competing for 100,000 coveted seats! Fans' online booking behavior during such events can be unpredictable - some may abandon their chosen seats mid-reservation, allowing others to swoop in and claim them. This high-energy, unpredictable environment makes for the perfect arena to put Momento and DynamoDB lock clients to the test. In this scenario, we're leveraging DynamoDB OnDemand capacity to handle the bursty nature of fan interactions, which also passes our serverless litmus test. 

For simplicity, let's break down the numbers. Suppose we release 10,000 new seats every 10 minutes, with 50,000 fans eagerly trying to secure them. After 100 minutes or 10 rounds, we anticipate a sold-out event!

DynamoDB’s play: Think of DynamoDB's lock client as a determined player on the field, executing two key moves: acquiring a lock (1 write request) for a seat and keeping that lock active through heartbeat (1 write request). The crowd, 50,000 fans strong, is relentless, each trying to secure a seat every 30 seconds. 10,000 lucky fans keep their seats under lock every 60 seconds (heartbeat) too. Over a 10-minute play, that amounts to 1.1 million write requests. By the time the session completes over 100 minutes, DynamoDB has executed an impressive 11 million write requests, racking up a cost of approximately $14.

Calculations unwrapped:

Momento's strategy

Momento plays a different game. Instead of direct write requests, it uses data. Every fan's attempt to grab a seat (150 bytes) and every heartbeat (300 bytes) uses just a bit of data. After 10 minutes of high-energy play, Momento uses about 0.18 GB of data. By the end of the 100-minute showdown, the total data comes to 1.8 GB. With Momento's pricing strategy of $0.5/GB, the total cost is a mere $1 - that's a game-changer, saving nearly 10 times compared to DynamoDB!

Calculations Unwrapped:

- Each round of seat acquisition and heartbeats uses 0.18 GB of data.

- After 10 rounds, the total data usage is 1.8 GB, costing just $0.9.

Even when optimizing DynamoDB in its provisioned mode and carefully managing capacity for 70% utilization, the cost hovers around $3.09. This figure still stands at 3x the cost of using Momento's on-demand or pay-per-request service, which requires no intricate capacity planning or AutoScaling tuning. Curious about crunching these numbers yourself? Dive into our DynamoDB Magic Numbers guide for a deeper understanding.

Why would we care about a $1 vs $14 difference anyway?

We absolutely wouldn’t, if our booking system processed only this event.

As our ticket booking system gains popularity, the scale and frequency of lock requests grow exponentially. Imagine the system now handles not just one Super Bowl event, but hundreds of events every month, including high-demand concerts like Taylor Swift's. The difference in cost between using Momento and DynamoDB for lock management becomes even more dramatic.

Consider the scenario where our system processes approximately 1,000 such events each month. The cost difference we observed in the Super Bowl example - roughly $1 with Momento versus $14 with DynamoDB per event - now amplifies significantly. For DynamoDB, managing these events could cost around $14,000 monthly. In contrast, Momento would incur only about $1,000 for the same level of activity. This equates to an impressive monthly saving of $13,000. Annually, the gap widens to $156,000 versus $12,000. Even with DynamoDB’s provisioned mode, which would bring the cost down to approximately $35,000 annually, Momento still leads in savings, not to mention freeing you from the complexities of managing capacity and AutoScaling.

This example isn’t just hypothetical. In real-world scenarios, where systems like ours are leveraged by multiple teams across various workloads – from ticket bookings to stream processing – the cumulative cost-effectiveness of Momento becomes significant. In essence, what seems like a small cost difference per event accumulates into a significant financial impact, underscoring the value of efficient lock management solutions in large-scale environments.

Conclusion

The comparison between Momento and DynamoDB in cost terms is more than just numbers; it's about real-world impact and scalability of savings. As our analysis shows, Momento stands out not only for its technical prowess but also for its significant cost advantages, especially when scaled up for high-demand scenarios.

Discover the efficiency and savings with Momento’s solution and stay tuned for our general Momento lock client!

Pratik Agarwal
by
Pratik Agarwal
,
,
by
Pratik Agarwal
by
green squirrel logo for momento
by
Pratik Agarwal
,
,
Author
Pratik Agarwal

Pratik is a software engineer at Momento, specializing in distributed systems. With a rich background spanning roles at prominent teams like AWS DynamoDB and Marketplace, he has honed his expertise across the backend stack. Now at Momento, Pratik is on a mission to elevate the developer experience, rooted in his conviction that it's a cornerstone of serverless computing. Beyond the code, he is passionate about kickboxing and cricket, and loves delving into the strategic nuances of poker, always seeking the upper hand at the table.

Author
Author
Open