在同一个连接上同时查询?
我目前正在修改我的 C# 应用程序,并正在考虑对其 MySQL 部分进行以下操作:
- 服务器被调用来处理任何信息
- 服务器启动 MySQL 连接
- 服务器执行所需的所有查询和命令(可能发生同时查询?)
- MySQL 连接保持空闲第 3 号完成后 5 分钟
- 如果新请求在从第 4 号开始的 5 分钟内开始,则当最后一个请求结束时从 0 开始 5 分钟计数器
- MySQL 连接
- 从 2 开始
关闭我对此有一些疑问:
单个连接是否允许我运行同时查询/命令(我知道很奇怪的问题,我还没有达到同时连接并且不确定如何测试它)?
我最初考虑使用连接池,但由于我可能有一些查询需要一些时间才能完成,所以我选择不使用,这样我可以在连接打开时继续发送命令并得到他们的答复,这样可以吗?
如果我不使用上述序列,而是简单地打开和关闭每个命令的连接,则应用程序可能会达到该 MySQL 用户的最大连接限制,正确吗?如果我没记错的话,连接数上限为 100 个。
I am currently modifying my C# application and was thinking of following this for the MySQL part of it:
- Server get called to process any information
- Server initiate MySQL connection
- Server do all queries and commands needed (possible to happen simultaneous queries ?)
- MySQL connection stays idle after number 3 finish for 5 minutes
- In case a new request begins within the 5 minutes from number 4, start the 5 minutes counter from 0 when the last request ends
- MySQL connection closes
- Starts from 2
I few doubts I was having in regards this were:
Will a single connection allow me to run simultaneous queries/commands (weird question I know, I haven't hit a simultaneous connection yet and am not sure how to test it) ?
I was initially thinking of using connection pooling but since I may have some queries that would take some time to finish, I opted for not, so I can keep sending commands and get their reply while the connection is open, is that OK ?
If instead of using the above sequence I simple open and close connections per command, it could happen that the application hits the max connection limit of that MySQL user is that correct ? if I am not mistaken there is a cap to 100 connections.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
?
是的,完全没问题,但如果您也在进行更新,请留意锁。
实际上它是 151,但您可以根据需要更改此值。
请参阅: http://dev.mysql.com/doc /refman/5.5/en/too-many-connections.html
No.
Yes, that's perfectly OK, keep an eye out for locks, if you are also doing updates though.
Actually its 151, but you can change this values if needed.
See: http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html