dongliang1654 2016-04-16 16:27
浏览 105
已采纳

Mysql连接 - 通过IP然后域连接更快?

Question

Is faster this

$servername = "125.125.55.10";
$username = "username";
$password = "password";
$conn = new mysqli($servername, $username, $password);

or this?

$servername = "mysql.server.com";
$username = "username";
$password = "password";
$conn = new mysqli($servername, $username, $password);

or it has no effect to speed?

I do not know if it has any practical use, but millisecond is milisecond....

Thank you

  • 写回答

2条回答 默认 最新

  • duanlushen8940 2016-04-16 16:31
    关注

    Yes, it could be considered slightly faster, as there is no need to resolve the domain to an IP address (DNS lookup). However, most modern technologies will cache the IP address when a connection is made, meaning a DNS lookup does not have to be made for every connection to the same address. So the difference is neglible, apart from the first time you connect to a site, and even then only for a few seconds at most.

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

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站