Bomlin
Bomlin

Reputation: 676

Unusual latency issue when using MySql from C#

I am a relative novice to MySql and I've run out of possible ideas so looking for a bit of help.

We recently started using MySql and we are seeing in multiple environments a consistent latency issue with calls to MySql. The latency is not present when running the queries using Workbench.

Although it is happening with many calls, I cut the code down to very simple calls like this for testing.

cmd.CommandText =
"SELECT 'test'";

cmd.CommandType = CommandType.Text;
Console.WriteLine("before execute:{0}",timer.ElapsedMilliseconds);

cmd.ExecuteNonQuery();

I even changed the call to NonQuery to make sure that as little as possible was being returned. Consistently every call is taking 200-300ms when I use our dev/qa servers. If I run it locally, runs in just a millisecond or two. I also tried multiple executes in a row without closing connection to eliminate connections and pools. I believe the bad performance is specifically when the command is being executed.

Upvotes: 0

Views: 56

Answers (1)

Bomlin
Bomlin

Reputation: 676

After a week of back and forth, this issue was isolated to our VIP. I am not a network person so apologies if I don't get this description quite correct.

The VIP apparently had a small packet size set for the network. This caused the select statement packets to become fragmented and adding the latency. We just made a change to our VIP and the problem has gone away.

Marking question answered.

Upvotes: 1

Related Questions