doukong5394 2012-01-14 20:51
浏览 68
已采纳

来自localhost的远程MySQL连接Codeigniter =非常慢

I am using Codeigniter & LAMP stack (without the MySQL) on my localhost to connect to a remote MySQL database on my server. This configuration is for development purposes only.

Problem: It takes up to a minute for the entire page to load! Is there any way to make this connection faster?

Sometimes its so slow i even get the error:

A Database Error Occurred

Unable to select the specified database: x

Filename: /Applications/MAMP/htdocs/x/third_party/MX/Loader.php

Line Number: 96
  • 写回答

2条回答

  • dongzhang6677 2012-01-14 21:21
    关注

    Unless your app is very hard on the DB, it is very likely that reverse DNS resolution is the cause. Disable it on the remote server by adding skip-name-resolve to your my.cnf.

    Also, note that even for simple queries, the roundtrip "across the world" may be 200 ms or even more, so it only takes 300 queries to spend a minute on networking, regardless of the complexity or amounts of data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器