Sequelize blocking node event loop on large queries

Viewed 137

Recently we've been noticing bad performance of our app, and using the blocked-at package found that Sequelize (v5.22) is blocking the node event loop on large queries.

The query in particular isn't complicated, just FooModel.findAll(someOptions), without any joins either. It's just that the result could be up to 100k rows.

Are there some known methods to improve performance, or at least ensure that the event loop won't be blocked?

1 Answers

Further testing with blocked-at has shown that the trace it gives isn't always 100% accurate. It sometimes indicates the point at which control was returned to the event loop, instead of the task that caused the event loop to be blocked.

In my case, the issue wasn't FooModel.findAll, but some logic before that.

Related