简体   繁体   中英

NodeJS + MySql and large concurrent access

So I have been writting this NodeJS Quiz App. At first we are not expecting that much users, but as time goes by we are looking at about ~50000 potential registered users. Considering the DB of choice iss MySql, and also considering not all registered users are going to be logged in at the same time, what is the maximum number of concurrent MySQL connections possible? Also, how much RAM and CPU would I need to host this app?

When you are using node.js, you can simply use connection pooling, there is no obvious downside to pooling but you are establishing much less connection (and less overhead).

In addition, it all goes down to how much query is actually executed and how much execution time they need, here are some make up numbers:

Let's say if 50k users all go online at the same time, and each user makes 1 interaction per 5s and takes 10ms DB time to execute, then 50k * 10ms / 5s = 100 concurrent connection needed.

Of course you need to factor in some real numbers, and read-to-write ratio matters a lot (read can potentially run in parallel), and cache can help a lot if reading makes up large number of queries.

All in all, you are unlikely to need much if all you do is some simple select and insert per interaction.

PS This post gave some interesting number: with connection pooling, 5k connection = 100k concurrent user. Of course he/she didn't mention his/her load type, but you can see that (concurrent / connection threads) can be up to tens and hundred when connection pool is in place.

you can set mySQL the max global connection up to 10,00,000. and for hardware requirement below link can help you.

https://www.percona.com/blog/2019/02/25/mysql-challenge-100k-connections/

Hope you get your answers if not let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM