I'm confused about concurrent MySQL connections

前端 未结 6 1653
走了就别回头了
走了就别回头了 2021-02-14 01:14

So, I read a book in Mysql and it says that there\'s a limit on how many concurrent users that can access a database.

Does that mean that If I have 20k users browsing i

6条回答
  •  走了就别回头了
    2021-02-14 01:47

    Assuming you have a standard web application architecture, with a database at the back and the web server(s) getting data from the database, then each instance of the web server would generally be a single database user.

    From your application's standpoint, each remote user is a user, but from the database's standpoint your application is a single user.

    From the web server's standpoint, the important performance number is the number of operations per second it is being asked to do. For example, if you have a blog web site, so users will typically read for a minute between clicks, then 10,000 active users might generate a request rate of 10,000 / 60 = 166 requests per second, which would generally be well within Apache's capabilities. (You have to consider the performance mix of your application from your web server's standpoint: CPU time, network bandwidth, disk bandwidth, memory consumption, ... to get the more complete and accurate picture of how well a web application may scale within a single web server.)

    If you have enough load so that you need multiple web servers with e.g. a load balancer in front, then each web server would be a database user. If you have scaled to the point where you need 10,000 web servers to service your customer base, you would generally have had to resort to other technologies to solve other database performance scaling problems anyway.

提交回复
热议问题