2007年8月9日星期四

过期时间设置 expires and max-age (一)

最近对关于http协议的rfc都或多或少的看了些!
随便也看了关于expires vs max-age
关于http/1.1协议的rfc2616上有这么三句话很有意思。
HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past (i.e., "already expired").

To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header value. (See the rules for expiration calculations in section 13.2.4.)

To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future.

The presence of an Expires header field with a date value of some time in the future on a response that otherwise would by default be non-cacheable indicates that the response is cacheable, unless indicated otherwise by a Cache-Control header field (section 14.9).

上面提到什么是过期:expires date ==date header
什么是不过期:expires date > date header
也提到了我们现在通常处理使得 expires date= 0 或者 expires date < date header
在这种非标准的header下面,http/1.1协议是怎么去解释的!
基本上没有设置expires date 就应该默认不能被cache,除非有section 14.9中其他的cache-control.
关于max-age 只想提这么一句话:
If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive

也就是max-age会优先expires!
在过期时间设置 expires and max-age (二)将抛开协议本身,来详细了解下在apache.lighttpd中怎么样去定制一个有比较好的过期时间设置的header

2007年8月8日星期三

服务器时间同步(一)

很多时候由于安装系统时候的不在意,或者服务器本身频率的问题,会导致服务器之间时间的不同步!
时间不同步造成的影响,squid,mysql出现问题!这些都与系统时间有这紧密的关系!
1.squid中cache出现问题
2.mysql中系统时间出现问题
通常解决的办法
同步时间
/usr/bin/rdate -s rdate.darkorb.net
clock 或者 hwclock -w 写入cpu 或硬件里面
问题:clock 和hwclock的区别
用rdate只能治表不能治本
治疗时间问题的根本是: set the system time from the hardware clock,把系统时间写入硬件中!
鸟哥这篇文章可以好好的参考参考
归纳一下别人的方法
linux调整系统时间和时区的方法(redhat 系列)

1) 找到相应的时区文件 /usr/share/zoneinfo/Asia/Shanghai

用这个文件替换当前的/etc/localtime文件。

2) 修改/etc/sysconfig/clock文件,修改为:

ZONE="Asia/Shanghai"
UTC=false
ARC=false (这个不太清楚,但应该是没什么用处的)

3) 同步时间并写入cmos

2007年8月5日星期日

数据库之 b tree

http://www.sci.unich.it/~acciaro/bpiutrees.pdf
http://www.usenix.org/events/usenix99/full_papers/olson/olson.pdf