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 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
  • ¥15 算法题:数的划分,用记忆化DFS做WA求调
  • ¥15 chatglm-6b应用到django项目中,模型加载失败
  • ¥15 CreateBitmapFromWicBitmap内存释放问题。