Oversized Queries
A common cause of both high database load and server memory exhaustion is queries loading too many results in a single query and materializing them into memory.
Imagine a query that loads all the rows from a table to do some aggregate computation on the entire set. When that table contains only a few dozen rows, no production monitoring tool will detect a problem, as the load will be neglible to retrieve and process the contents. But if that table soon grows to millions of rows, the query will grow with it.
AppMap Analysis will flag this pattern and recommend using a LIMIT
or COUNT
clause on the query, and for the application to either load the rows in small batches, or do the computation in the database itself.
Excessive Updates
A single HTTP update request (like a POST
, PUT
, or PATCH
) should have responsibility for making only a small number of update or insert queries into a database. If the number of updates it makes becomes too large, the code becomes harder to maintain. It also makes it more fragile, as more things can fail and then potentially leave the database in an inconsistent state.
AppMap Analysis can locate all the update queries made within one HTTP request and flag those that exceed a configurable limit. This makes it easy to identify both current and future reliability and maintainability problems in your backend code.
The above are just a sample of rules available in AppMap Analysis. More rules are always being added!