我朝Internet南北不畅通的解决方案(老旧方案)


我朝Internet南北不畅通的解决方案(老旧方案)

Published on Mon 01 Feb 2010 08:02 ( 7 months ago)
Web Idea sharing

这个问题曾经花过不少力气,但也没有很理想解决。 正好建硕也要解决类似问题,我就把过去的土法给权当抛砖引玉写出来。4年前的东西了,想必现在会有更好的办法。

过去的方案:

1. DNS 采用geo load balance.  关键点在于获得南北的ip分布,并建立规则表。 很多公司应该有这个表
2. 所有的web前端都为 reverse proxy,当时采用SQUID,并设立了2级的级联cache
3. 数据库, application server 均中心化位于一个 data center.
4. 租用至少一个具有BGP路由的双线机房的主机,这台主机上跑着cache server (SQUID)
5. 配制web前端的cache规则,以实现最好的cache效果

application设计的时候考虑有多极cache服务器的存在,web app采用下面的原则:
1. 静态、不常变动内容永远采用最大的max-age, 更新的时候采用改变路径的方式来强制所有cache更新。e.g. http://yourserver/media/(version number)/... 每次升级改变version number.
2. 不常变化的动态内容给出可接受的max-age,根据性质归入几个group, e.g. 1天失效,1小时失效,5min失效。 web app永远要支持 请求中的cache  control header,没有变化的时候给出304 Not Modified, 而不是给相同的内容.
3. 常变化的动态内容总是给一个足够短的max-age
4. 设计一个可以用来区别cache策略的cookie

cache server前端的策略
1. 前端cache server配制成利用cookie来简单判断该请求应该采用的策略:(1) max-age  (2) check if modified  (3) no cache
2. 用于级连的cache server忽略cookie规则

当时觉得级连的cache server最好自己专门实现,这样可以更智能地和app server交换些控制cache失效的策略(比如可以让app主动要求其失效一些符合规则的内容,这样它就可以永远cache所有内容,直到被主动失效,效率可以更好),但只是设计没有实现。


Related posts:


Search related in web:

Custom Search

RSS Feed

One click subscribe this blog in your google reader!

Be social!


Want to say something here? please sign in



Blog posts link to this page
What are friends tweeting?
Tags cloud
Monthly Archives