远程MySQL访问需要很长时间 [英] Remote MySQL access taking a long time

查看:139
本文介绍了远程MySQL访问需要很长时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在本地数据库上运行MySQL查询只需要大约20-30ms,但通过远程连接(互联网)运行相同的查询需要500ms。这是正常吗?如果不是可能的原因,这样的延迟?

Running a MySQL query on a local database takes only about 20-30ms but running the same query through a remote connection(internet) takes 500ms. Is this normal? If not what could be the possible reason for such delay?

这是一个wireshark时间提取为特定的查询远程运行。

This is a wireshark time extract for a particular Query run remotely.

Time -195.768993000 --- Request Ping
Time -195.909453000 --- Response OK
Time -195.909729000 --- Request Use Database
Time -196.049567000 --- Response OK
Time -196.049918000 --- Request Query
Time -196.219660000 --- Response

注意:我试图通过工作台远程运行相同的查询,执行的时间为200ms.This我认为匹配从'请求查询'到'响应'在C#的时间,如以上的wireshark数据。

NOTE: I tried running the same query remotely through workbench and the duration of execution was 200ms.This I think matches time taken from 'Request Query' to 'Response' in C# as shown in the wireshark data above.

推荐答案

这可能是因为DNS问题。您可以通过在配置文件中使用 - skip-name-resolve选项启动mysqld来禁用DNS主机名查找。

It could be because of a DNS problem. You can disable DNS host name lookups by starting mysqld with the --skip-name-resolve option in the configuration file.

http://dev.mysql.com/doc/ refman / 5.0 / en / host-cache.html

这篇关于远程MySQL访问需要很长时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆