Trustpilot.com is a Danish consumer review website founded in Denmark in 2007 which hosts reviews of businesses worldwide. Nearly 1 million new reviews are posted each month. In 2017, the company was using MongoDB and decided to evaluate DynamoDB to make their entire pipeline scalable from one end to the other and cut some of the costs. They had moved from MySQL database on-premise to MySQL database in the cloud, then from MySQL to MongoDB. They wanted to explore serverless to make their database fully scalable.
The first scenario that Trustpilot considered for serverless was the customer sign-up process. After a customer signs up, he needs to activate the account. If he doesn't, Trustpilot must delete the information. The storage of all the unused data caused unnecessary loads to the primary database (MongoDB).
Some scenarios are not adapted to serverless and are better managed with containers. For example, the third-party system called by API may have a limit that renders serverless inappropriate. Understanding the limitations is part of the practice.
They use events when consumers sign up: - The sign-up event stores some data in a DynamoDB to register that this consumer signed up, - Another event comes from the activation API, saying this consumer activated the account, - All the unactivated accounts are stored in one DynamoDB table, - Accounts that are not activated in time can be deleted without refactoring the entire database.
Switching from a SQL to a NoSQL database requires understanding how DynamoDB works. It's an important investment in terms of training. However, the number of tutorials and the support from the community have progressed dramatically since 2017.
Make the process entirely scalable, and prove the serverless benefits moving forward.