Reputation: 3068
I have an C# app that accesses LAN based mysql server for database operations, it works fine. However, as soon as I try to access a remote mysql server the time to open MySQL connection and query execution increases considerably this causes a hang like condition on the main thread.
Just opening a MySQL connection takes about 1-3 seconds affecting the GUI.
Is there any way to avoid this except for running MySQL operations on another thread?
Upvotes: 0
Views: 1739
Reputation: 1588
There could be 2 reason. first mysql server has lots of open connections so it has slowed to manage new client, so check the server status with root super privileges or process privileges like root account-
Mysql> show processlist;
+----+-------------+-------------------+------+---------+------+----------------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-------------+-------------------+------+---------+------+----------------------------------+------------------+
| 2 | system user | | NULL | Connect | 1188 | Waiting for master to send event | NULL |
| 5 | root | smart.local:39850 | NULL | Query | 0 | init | show processlist |
+----+-------------+-------------------+------+---------+------+----------------------------------+------------------+
2 rows in set (0.00 sec)
Second possiblity there could be problem with connector. The issue was also present on our side with MySql Connector .Net 6.6.5. The MySql Connector .Net 6.8.3 is solving this issue.
if both are ok then the link can be helpful.
Very slow opening MySQL connection using MySQL Connector for .net
Upvotes: 2