dongqiangse6623 2017-11-10 06:27
浏览 86
已采纳

如何在PHP中改善MySQL连接时间?

As testing performances on APIs, I found that 30% of response time for APIs are spent on connecting to MySQL. (Min. 500ms - Max. 600ms)

I assumed that it was because of MySQL settings, so I changed various settings to improve the connection time, but without luck.

I did not use any framework to test it. I wanted to compare with other languages, so I tested Python. Its result was around 50ms which is a lot better than 500-600ms of PHP.

What would be the reasons for such delay on PHP, but not on Python?

Here is the environment under which I tested:

  • php version : 7.1.9-1+0~20170902060604.8+jessie~1.gbpebe5d6
  • python version : 3.6.2
  • platform : Linux(Ubuntu)
  • mysql version : 5.7.2
  • 写回答

1条回答 默认 最新

  • douzhi1879 2017-11-10 06:37
    关注

    Depending upon your use case, you may be able to dramatically increase your response time by using persistent connections.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

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