0

I'm having an issue with a very slow query in an C# WPF application. The application connects to a MySQL-server. As long as the application is used on my LAN, everything is going fast. When i use the application anywhere else, connecting to the DB over WAN, a simple query takes more than 10 seconds, not workable. The strange thing is that other services, like RDP, VNC, webhosting, streaming,... are working very fast over WAN, bandwidth can't be the problem i think.

This is the speedtest for the location where the server is: speedtest

What can i check/change to make this work better/workable over WAN?

Thanks in advance.

Dave
  • 1
  • 2
  • 2
    Individual queries might run fine over a WAN connection, but typically an application that uses a database connection makes many queries and those are sensitive to latency, which many WAN connections have plenty of. Keep the application and it's database close together. (and if you need remote access to the data, use a protocol like RDP that is WAN optimized to remotely access the application, rather than only accessing the database remotely.) – HBruijn Apr 03 '19 at 07:23
  • The reason that I'm using a remote SQL, is that the user of the application needs to print invoices. The printer is locally installed at his location. – Dave Apr 03 '19 at 08:06
  • The application does not need to run on the workstation a printer is attached to to make use of that printer. Remote desktop and similar allow remote applications to use local resources such as printers – HBruijn Apr 03 '19 at 08:17
  • Thanks for the information. I will try to set up an RDP server for this. – Dave Apr 03 '19 at 08:27
  • Please note that my suggestion is only one, you do have other options (like making your database queries and application design less sensitive to latency for instance) – HBruijn Apr 03 '19 at 08:30
  • Dup of https://dba.stackexchange.com/questions/233991/make-sql-query-latency-proof – Rick James Apr 21 '19 at 05:01

2 Answers2

1

Try disabling DNS reverse resolving from the MySQL server by adding or un-commenting the skip-name-resolve option on the MySQL configuration file like so:

# Skip reverse DNS lookup 
skip-name-resolve
Jangita
  • 11
  • 2
0

Try forcing compression protocol from the client side.

https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_compress

David Fear
  • 41
  • 3