所以我們可在後半用併發連接和持續連接在提速,表現在Apache 的配置方式可在httpd.conf中找到答案: # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves
# worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves
# KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to 「Off」 to deactivate. # KeepAlive On|Off
在Squid 2.6中對經過壓縮的數據能Cache, 來提高 緩存命中率. # TAG: cache_vary # Set to off to disable caching of Vary:in objects. # #Default: # cache_vary on
即當你的前端代理伺服器實行加速WEB行為需要確認Cache_vary為開狀態.
我們需要作些改變來合理使用Apache Modules, 對於頻繁變動的頁面內容我們可以在程序設置header來不緩存. Cal Henderson充分利用了Http 1.1規範的Last-Modified和ETag 來Cache內容. 3.11 Entity Tags
Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the ETag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. The definition of how they are used and compared as cache validators is in section 13.3.3. An entity tag consists of an opaque quoted string, possibly prefixed by a weakness indicator.
A 「strong entity tag」 MAY be shared by two entities of a resource only if they are equivalent by octet equality.
A 「weak entity tag,」 indicated by the 「W/」 prefix, MAY be shared by two entities of a resource only if the entities are equivalent and could be substituted for each other with no significant change in semantics. A weak entity tag can only be used for weak comparison.
An entity tag MUST be unique across all versions of all entities associated with a particular resource. A given entity tag value MAY be used for entities obtained by requests on different URIs. The use of the same entity tag value in conjunction with entities obtained by requests on different URIs does not imply the equivalence of those entities.
* 頁面必須包含Last-Modified: 標記 一般純靜態頁面本身都會有Last-Modified信息,動態頁面需要通過函數強制加上,比如在PHP中: // always modified now header(」Last-Modified: 」 . gmdate(」D, d M Y H:i:s」) . 」 GMT」);