zoukankan      html  css  js  c++  java
  • DNS加速

    http://elingwange.iteye.com/blog/1563497

    http://blog.csdn.net/lize1988/article/details/10404645

    java.net.InetAddress内部的缓存我们没有办法控制。4.0以前是永久缓存,4.0以后是只缓存2s。也就是说4.0以前通过设置虚拟机TTL没有用,因为java.net.InetAddress永久缓存了。

    下面是android api InetAddress 里的原话:

    DNS caching

    In Android 4.0 (Ice Cream Sandwich) and earlier, DNS caching was performed both by InetAddress and by the C library, which meant that DNS TTLs could not be honored correctly.In later releases, caching is done solely by the C library and DNS TTLs are honored.

    在控制DNS缓存时有两点需要注意:

        1. 可以根据实际情况来设置networkaddress.cache.ttl属性的值。一般将这个属性的值设为-1.但如果访问的是动态映射的域名(如使用动态域名服务将域名映射成ADSL的动态IP), 就可能产生IP地址变化后,客户端得到的还是原来的IP地址的情况。

        2. 在设置networkaddress.cache.negative.ttl属性值时最好不要将它设为-1,否则如果一个域名因为暂时的故障而无法访问,那么程序再次访问这个域名时,即使这个域名恢复正常,程序也无法再访问这个域名了。除非重新运行程序。

  • 相关阅读:
    ZOJ
    FZU
    FZU 2231 平行四边形数
    [转载] java的动态代理机制详解
    [转载] 解读ClassLoader
    [转载] 深入了解Java ClassLoader、Bytecode 、ASM、cglib
    MyBatis入门
    Spring入门
    Nginx入门
    Redis入门
  • 原文地址:https://www.cnblogs.com/xitang/p/3332310.html
Copyright © 2011-2022 走看看