doublethinker / smarthosts

Automatically exported from code.google.com/p/smarthosts
0 stars 0 forks source link

Recommendation, not an issue #391

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
信息
ISP:Hubei CHINA TELECOM ADSL(接入稳定)
Hosts File: 2012/11/20

====症状:====
繁忙时段单一IP的解析(https://www.google.com)偶尔会因延迟导致无
响应。
包括ping的丢包(以ping www.google.com相对明显)
以及网页加载缓慢(mail.google.com和Gmail附件服务器mail-attachment.g
oogleusercontent.com相对明显)。

均为偶发症状,不会导致服务完全不可用。
最坏需要情况刷新3-4次页面,绝大多数情况刷新一次即可。
但attachment.googleusercontent.com的确在任何时间段都相对比较缓慢
。

包丢失和链接终端(no 
response,并非interpreted)没有特定规律,没有GFW的特点。
表现似乎与流量和网络拥堵有关。

====建议:====
针对Google重要服务:
www.google.com
www.google.com.hk
mail.google.com
encrypted.google.com
同时提供多IP(包括海外)的解析。
可以考虑同时提供(按顺序)HK,JP,SG,US的解析,以避免单一IP不��
�定状况。

====方案:====
1.无需为所有服务提供分布式解析,仅为www,mail,encrypted等最关
键应用提供解析。

2.提供的解析顺序建议参考地理位置,但一定排除Google北京(��
�数报告不稳定)。

3.以JP/SG/HK优先,US其次(偶尔有报告HK不稳定)。

4.对于Chrome或者是IE等不依赖于单一DNS解析的应用程序,会自�
��按顺序轮询所有的IP解析。
  (目前的实验结果来看是按照顺序依次解析,似乎不是随机选取一个Hosts中的地址)
  例如
     Host仅包含
     173.194.38.84   www.google.com  //JP
     173.194.38.178  www.google.com  //SG
  在输入www.google.com时,如果173.194.38.84不可用,会自动尝试173.194.38.178
  的解析,知道所有DNS均失败(timeout)才会返回took too long to respond。

5.对于依赖唯一DNS解析的应用程序,比如Ping(Ping只会使用Host��
�表中的第一解析结果)
  例如
     Host仅包含
     173.194.38.84   www.google.com  //JP
     173.194.38.178  www.google.com  //SG
  Windows下任何时候Ping都将指向173.194.38.84,而不会使用173.194.38.178。
  可以考虑将最可靠(Ping速度不一定要最快,但IP不经常变更,服务器不经常失效)的排列
  在第一(比如US服务器),然后依次使用JP/SG/HK/US Other/World Other的解析以避
  免网络繁忙导致无响应。

6.可以单独提供给高级用户,以供他们单独选择,不建议合并
到普通用户Hosts,比如提供一
  个Main service Global (optional)的host。

7.并不会明显增加HOSTS文件的大小。因为只涉及到数十条的解�
��。

8.见EXAMPLE(截取自我的HOSTS文件),这样的配置在提供稳定性的�
��候显著提升了访问速度
  以Gmail的attachment upload尤为明显。注意!我避免使用Beijing以及HK的解析,
  但多数情况下使用HK的解析在也还是算稳定的。

=====================================================================
==                          EXAMPLE START                          ==
=====================================================================

#GOOGLE WWW
#=========================================================
#Google JP/SG
173.194.38.84   www.google.com
173.194.38.178  www.google.com

#Google US 圣何塞/洛杉矶/达拉斯/圣安娜
74.125.224.82   www.google.com
74.125.224.83   www.google.com
74.125.227.114  www.google.com
74.125.224.212  www.google.com

#Google HK
74.125.128.105  www.google.com.hk
74.125.128.106  www.google.com.hk
173.194.72.189  www.google.com.hk
#=========================================================
#GOOGLE WWW END

#GMAIL
#=========================================================
#Gmail JP/SG
173.194.38.85   mail.google.com
74.125.235.86   mail.google.com

173.194.38.182  mail.google.com
173.194.38.149  mail.google.com

#Gmail BJ/HK
####203.208.46.213 mail.google.com

####74.125.128.18  mail.google.com
####74.125.31.18   mail.google.com
####74.125.128.17  mail.google.com
####74.125.128.83  mail.google.com

#Gmail US 圣何塞洛杉矶/达拉斯/圣安娜
74.125.224.85   mail.google.com
74.125.227.118  mail.google.com
74.125.224.214  mail.google.com

#GMail-attachment 
#JP/SG/圣何塞/洛杉矶/达拉斯/圣安娜
173.194.38.75   mail-attachment.googleusercontent.com
173.194.38.170  mail-attachment.googleusercontent.com
74.125.224.74   mail-attachment.googleusercontent.com
74.125.224.76   mail-attachment.googleusercontent.com
74.125.227.107  mail-attachment.googleusercontent.com
74.125.224.170  mail-attachment.googleusercontent.com

#GMail-attachment 
#HK/BJ
####74.125.128.132  mail-attachment.googleusercontent.com

####203.208.46.210  mail-attachment.googleusercontent.com
####203.208.46.202  mail-attachment.googleusercontent.com

=========================================================
GMAIL END

=====================================================================
==                           EXAMPLE END                           ==
=====================================================================

==测试:==
1.在RouterBOARD 1100AH路由器上使用脚本进行追踪。
2.对列表中的IP每隔15分钟进行10次Ping,如果返回少于8个回复�
��即给予Log。
3.结果中可以发现US的丢包相对ASIA更加严重,晚上繁忙时段更
加如此。

=====================================================================
==                          ROS TASK END                           ==
=====================================================================
:if ([/ping 173.194.38.84 count=10] < 8) do={ :log info "ping Google JP WWW 
less than 80%"; };
:if ([/ping 173.194.38.178 count=10] < 8) do={ :log info "ping Google SG less 
than 80%"; };
:if ([/ping 74.125.224.82 count=10] < 8) do={ :log info "ping Google US San 
Jose less than 80%"; };
:if ([/ping 74.125.224.83 count=10] < 8) do={ :log info "ping Google US LA less 
than 80%"; };
:if ([/ping 74.125.227.114 count=10] < 8) do={ :log info "ping Google US Dallas 
less than 80%"; };
:if ([/ping 74.125.224.212 count=10] < 8) do={ :log info "ping Google US Santa 
Ana less than 80%"; };
:if ([/ping 74.125.128.105 count=10] < 8) do={ :log info "ping Google HK1 less 
than 80%"; };
:if ([/ping 74.125.128.106 count=10] < 8) do={ :log info "ping Google HK2 less 
than 80%"; };
:if ([/ping 173.194.72.189 count=10] < 8) do={ :log info "ping Google HK3 less 
than 80%"; };
:if ([/ping 203.208.46.213 count=10] < 8) do={ :log info "ping Gmail Beijing 
less than 80%"; };
:if ([/ping 173.194.38.85 count=10] < 8) do={ :log info "ping Gmail JP1 less 
than 80%"; };
:if ([/ping 74.125.235.86 count=10] < 8) do={ :log info "ping Gmail JP2 less 
than 80%"; };
:if ([/ping 173.194.38.182 count=10] < 8) do={ :log info "ping Gmail SG1  less 
than 80%"; };
:if ([/ping 173.194.38.149 count=10] < 8) do={ :log info "ping Gmail SG2 less 
than 80%"; };
:if ([/ping 74.125.224.85 count=10] < 8) do={ :log info "ping Gmail San Jose 
less than 80%"; };
:if ([/ping 74.125.227.118 count=10] < 8) do={ :log info "ping Gmail Dallas 
less than 80%"; };
:if ([/ping 74.125.224.214 count=10] < 8) do={ :log info "ping Gmail Santa Ana 
less than 80%"; };
:if ([/ping 173.194.38.75 count=10] < 8) do={ :log info "ping Gmail-att JP less 
than 80%"; };
:if ([/ping 173.194.38.170 count=10] < 8) do={ :log info "ping Gmail-att SG 
less than 80%"; };
:if ([/ping 74.125.224.74 count=10] < 8) do={ :log info "ping Gmail-att San 
Jose less than 80%"; };
:if ([/ping 74.125.224.76 count=10] < 8) do={ :log info "ping Gmail-att LA less 
than 80%"; };
:if ([/ping 74.125.227.107 count=10] < 8) do={ :log info "ping Gmail-att Dallas 
less than 80%"; };
:if ([/ping 74.125.224.170 count=10] < 8) do={ :log info "ping Gmail-att Santa 
Ana less than 80%"; };
:log info "Google Service Ping Test End";
=====================================================================
==                          ROS TASK END                           ==
=====================================================================

=====================================================================
==                          ROS PING LOG                           ==
=====================================================================
...
...
Nov/21/2012 15:33:58 script,info ping Gmail SG2 less than 80%
Nov/21/2012 15:34:08 script,info ping Gmail San Jose less than 80%
Nov/21/2012 15:34:18 script,info ping Gmail Dallas less than 80%
Nov/21/2012 15:34:46 script,info ping Gmail-att SG less than 80%
Nov/21/2012 15:34:56 script,info ping Gmail-att San Jose less than 80%
Nov/21/2012 15:35:25 script,info ping Gmail-att Santa Ana less than 80%
Nov/21/2012 15:35:25 script,info Google Service Ping Test End
Nov/21/2012 15:50:23 script,info Google Service Ping Test End
Nov/21/2012 16:05:23 script,info Google Service Ping Test End
Nov/21/2012 16:20:20 script,info Google Service Ping Test End
=====================================================================
==                          ROS TASK END                           ==
=====================================================================

Original issue reported on code.google.com by fuzhaop...@gmail.com on 21 Nov 2012 at 8:58

GoogleCodeExporter commented 9 years ago
可根据需要加入
google快照
Google cal
等和日常工作相关的解析

Youtube,Google Plug等可以不必要这么做
以免HOSTS文件过大占用资源(虽然微不足道)
以及增加HOSTS文件维护的难度(重点)

Original comment by fuzhaop...@gmail.com on 21 Nov 2012 at 9:04