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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分