We have a project backend running on NodeJS / expressJS / SequilizeJS as a RESTapi. That RESTapi connceted to a VueJS SPA.
Only 5 people use this system. Most of the operations are transactions.
We get an error
SequelizeConnectionAcquireTimeoutError: Operation timeout
This is our config object.
const sequelize = new Sequelize(
config.database,
config.username,
config.password,
{
host: config.host,
dialect: "mysql",
pool: {
max: 20,
min: 0,
acquire: 30000,
idle: 10000
}
}
);
We are certain that our server's memory is not the issue. Because only 5 percent is used.
Where does this error comes from?
If someone stumbles here looking for Postgres specific config (i.e. node-postgres) for query timeout, it looks like this in sequelize v5: dialectOptions: { statement_timeout: 1000, idle_in_transaction_session_timeout: 5000 } This will set statement_timeout to 1s and idle_in_transaction_session_timeout to 5s.
The query timeout error will be given back to the application for handling. Setting a query timeout will not resolve why the queries are taking a long time to complete, but it will timeout any long queries so the application can handle the exception and free up that connection.
Common Reasons Why Connections Stay Open for a Long Period of Time in WebSphere Application Server When you are monitoring connection pool performance, you may occasionally notice that connections are staying open for long periods of time. This behavior can have many different causes and can lead to issues like the connection pool maxing out.
When the get/use/get/use/get/use……/ close pattern is used, the application does not call close until the very last request is completed. That means that the rest of the connections will remain open in the pool with a ‘Connections being held’ or ‘Handle count’ value of 1 until that very last request completes.
Change acquire to 60000, It will resolve otherwise you need to recheck that particular query where it is coming. acquire: 60000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With