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 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败