카테고리 없음

HTTP Cache 구조 엿보기

mulderu 2012. 10. 12. 18:28

서버쪽의 관심사중 하나가 서버의 대역폭을 절약하기 위한 Client Cache를 적절히 이용하는 일입니다.

우리가 사용하고 있는 tistory의 static image server 는 어떻게 할까요 ???

아래를 보시기 바랍니다.


wget  을 이용해서 static image 를 받아 보면 아래와 같은 필드가 있습니다.

 Expires: Sun, 11 Nov 2012 09:22:47 GMT
  Last-Modified: Fri, 12 Oct 2012 08:09:30 GMT


아래 예제를 보자면 wget -S option을 통해 header를 보여 줍니다.

저의 관심은 Expires, Last-Modified header field  입니다. 

예제로 호출한 이미지는 오늘 (10월12일) 업로드한 이미지 입니다. 

Cache expire를 1달 뒤로 정하는군요. (daum tistory image server)

대충 정한듯 하죠.. 저두 그낭 1달정도로 할것 같네요. :)



mulder@vlinux:~$ wget -v -S https://t1.daumcdn.net/cfile/tistory/1924D63C5077D03815
--2012-10-12 18:22:47--  https://t1.daumcdn.net/cfile/tistory/1924D63C5077D03815
Resolving cfile9.uf.tistory.com... 110.45.215.246
Connecting to cfile9.uf.tistory.com|110.45.215.246|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Date: Fri, 12 Oct 2012 09:22:47 GMT
  Server: Apache
  Content-Disposition: inline; filename="hadoop.jpg"
  Expires: Sun, 11 Nov 2012 09:22:47 GMT
  Last-Modified: Fri, 12 Oct 2012 08:09:30 GMT
  Content-Length: 16768
  Content-Type: image/jpeg
  Via: 1.0 wcache(1.0)
  Connection: keep-alive
Length: 16768 (16K) [image/jpeg]
Saving to: `1924D63C5077D038158C2E.1'

100%[================================================================================================================================>] 16,768      --.-K/s   in 0.06s   

2012-10-12 18:22:47 (292 KB/s) - `1924D63C5077D038158C2E.1' saved [16768/16768]

mulder@vlinux:~$