开发者

Simultaneous query on the same connection?

I am currently modifying my C# application and was thinking of following this for the MySQL part of it:

  1. Server get called to process any information
  2. Server initiate MySQL connection
  3. Server do all queries and commands needed (possible to happen simultaneous queries ?)
  4. MySQL connection stays idle after number 3 finish for 5 minutes
  5. 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
  6. MySQL connection closes
  7. 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.


Will a single connection allow me to run simultaneous queries/commands

No.

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 ?

Yes, that's perfectly OK, keep an eye out for locks, if you are also doing updates though.

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.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜