mysql远程访问时间长无反应_远程MySQL访问需要很长时间

本地运行MySQL查询只需20-30ms,但通过互联网远程连接则需500ms。可能存在DNS问题,尝试禁用DNS主机名解析以减少延迟。使用Workbench远程执行查询耗时200ms,与Wireshark数据显示一致。解决方案可能涉及网络延迟、DNS解析和数据库服务器性能等因素。
摘要由CSDN通过智能技术生成

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?

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

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.

Talk1:

how many rows it will return ?

Talk2:

May be 100. But that doesn't matter as "Request Ping to Request Query" only takes about 300ms.

Talk3:

can't you check the query by running directly on server with ssh

Talk4:

If I am right SSH only encrypts your connection it will not increase the throughput.

Talk5:

yes but it not needs to download the data to your local server, it will show you correct time of execution

Solutions1

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.

Talk1:

You checked again after restarting the server, right?

Talk2:

Ya, it seems that a remote connection would always have that time difference.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值