0

我在任何地方都找不到答案,我已经在整个互联网上查看了。

我即将启动一个连接到网络服务器的应用程序(手机游戏)。我预计高峰时段将有大约 1,000 名并发用户在游戏中。对游戏的每个请求都需要数据库请求来获取或添加新数据。

我目前正在使用来自 AWS RDS 的 t2.small 数据库。显然这种类型的数据库的 max_connections 是 150。我的问题是:

1) 这是否意味着最多只能有 150 个并发用户访问我的应用程序/游戏?对于每月 30 美元的数据库服务器来说,这似乎是一个极低的数字。

2)每个数据库连接持续多长时间?如果我有 500 人提出一个数据库请求并且限制是 150 个连接,那么如果每个连接只打开 250 毫秒就不会那么糟糕了。如果每个连接打开 1 秒,那么每个请求等待大约 3 秒的人就太长了。

3) 我是否需要为管理员保留数据库连接才能每次都能够登录?

任何帮助都会很棒,谢谢。

4

1 回答 1

0

I think something have gone terribly wrong.

Users shouldn't access MySQL server directly, and you needn't create a new MySQL connection for every individual user. What you should do is to setup a server to handle all requests from users. The MySQL connections only exist between Server and MySQL server, it could be one or several depending on your architecture.

The framework just looks like this:
enter image description here

And this is the simplest one usually.

So, in this case, the limit of 150 connections is just more than enough. Actually 150 connections is adequate for most applications.

于 2018-03-19T04:49:02.387 回答