Guapo
Guapo

Reputation: 3482

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:

Upvotes: 0

Views: 991

Answers (1)

Johan
Johan

Reputation: 76537

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

Upvotes: 1

Related Questions