Finding and improving inefficient queries
Glovo was already using Datadog Application Performance Monitoring (APM), Infrastructure Monitoring, and Log Management. For Reddy, it felt natural to extend their existing observability tooling to Datadog Database Monitoring (DBM) as it had the same easy-to-use interface they were already familiar with as well as features like granular data of the queries, explain plans, query costs, wait times, etc. With Datadog DBM, Glovo engineers now have full visibility into their databases and can quickly identify and optimize inefficient queries to reduce computational load. “It's hard to believe that one query can cause big problems, but it happens often. That simple, inefficient query can consume all the resources and things stop working and all the alarms go off,” says Reddy. “With Datadog, we can identify inefficient queries and address them. We immediately saw resource consumption improvements.”
For example, Glovo was running a query from its high-traffic homepage. The query was working fine until it was revamped in a design change and caused a failure “After a while the query became very inefficient and at one point that simple query blocked everything else,” says Reddy.
“Datadog is our one-stop shop for observability. We don’t even consider using anything else if it's available in Datadog. Having everything on the same platform saves us time and makes troubleshooting easier.”
Using Datadog DBM, Reddy and his team observed that the query was going to a writer instead of a reader, a major pitfall that should be avoided. After identifying and fixing the issue, Glovo’s overall CPU usage dropped by five percent. “That was a big win for us because it was the single highest drop in CPU percentage we’ve seen at one time,” says Reddy. “Sometimes the data we need is easy to miss, but Datadog provides us a very clear indication when something is going wrong in our code.”
Glovo is also using DBM for capacity planning and to enable resource optimization across the organization. For example, the infrastructure team supports other teams across the business in provisioning and maintaining their own infrastructure. DBM helps the infrastructure team work with other business areas to ensure their workloads run efficiently and resources are allocated appropriately, thereby reducing costs.