How does connectionLimit work in node mysql?

Viewed 16239

I quite don't understand how connectionLimit in mysql module works.

I have created a connectionPool in following way:

  var connPool = mysql.createPool({
        host: config.get('database.host'),
        user: config.get('database.user'),
        password: config.get('database.password'),
        database: config.get('database.dbname'),
        connectionLimit: 5
  });

Now, what does limit 5 do here?

Here's what I think:

Suppose there are 5 users using my REST API for selecting some data from a table. Now in my API, I get a connection from pool, do stuff and then release the connection.

So now, suppose there are 12 users who send request to this API concurrently. So first 5 of them should get access to the data and other 7 will get error / no response. They will have to request again to get the data.

Is this like so or something else?

1 Answers
Related