lighttpd & modcache ppt

讲座ppt下载

1) squid和modcache的对比:squid是个功能全面的系统、但效率不高;modcache是功能不多,但效率高的缓存系统;请求数不多的情况下 (<100 req/s),两者差别不大;请求数超过100 req/s,modcache完胜

2) Linux系统的优化也很重要,比如打开最大文件数等等。不一定非要改linux kernel source,参数调优事半功倍

3) 如何用尽多核CPU。首先要用多个进程(server.max-workers=4);用Linux的setaffinity系统调用把CPU0空闲出来,再根据服务情况选择是否把缓存加载到内存中;最后就是给足够大的负载了(大部分时候瓶颈在IO上,而不在CPU上)。

其实lighttpd在请求高(>1k req/s)的情况下,CPU也不忙,比Squid好太多;也就是说lighttpd不属于CPU计算量大的程序,而大部分时间在处理、等待网络IO,磁盘IO

4) keepalive 尽量关闭。lighttpd 1.4.23新加的server.defer-accept选项不错,可设置成server.defer-accept=30

5) 小文件缓存到内存;大文件放硬盘,硬盘没必要用raid

6) 加载 mod_status,设置 status.statistics-url = "/lighttpd_status"。然后访问http://ip/lighttpd_status 可看到modcache 的缓存命中率

7) modcache 使用两级hashmap管理内存缓存,效率不错,支持上千万的项目快速存取

8) 单进程和多线程。单进程适合现代的硬件和软件;多线程的弱势在于锁:一般多线程使用多个全局锁,当请求数量超过一定值后,全局锁会导致性能急剧下降;多线程的扩展性比单进程差不少。

多线程适合不同线程做不同工作,或者请求数量可控、且不高的情况

9) nginx 和 lighttpd对比
i) nginx 各模块结合比较紧密,效率比lighttpd高些
ii) nginx 代码更新频繁,比lighttpd好不少
iii) nginx 强项是做proxy,而且proxy种类也比lighttpd多,实际也见到不少这样的使用案例。

一般使用 lighttpd 和 nginx 差别不大,具体用哪个看个人偏好

Keywords: , ,

modcache v1.7.0 released

modcache 1.7.0 新增加的重大功能是可以把缓存存到内存里,而不只是本地硬盘。这个功能适合缓存小文件,比如小图片,JS,CSS,html文件。实际系统运行对比squid的nullfs,性能提高了5~10倍,还是不错的。

新增加的配置项是:

  • cache.max-memory-size,单位是Mbytes,缺省是256(256M内存)。modcache使用的内存缓存不会超过这个数值
  • cache.lru-remove-count,缺省是256。这个参数基本不用动

原来的cache.support-accept-encoding选项被取消了。

refresh-pattern也增加了三个选项:

  • use-memory:用内存作为缓存空间
  • support-accept-encoding:支持缓存压缩后的内容
  • use-gzip-deflate-only:对于带“Accept-Encoding"的请求,如果没有压缩后的缓存内容,则modcache不吐未压缩的内容,而把请求传递到后端服务器;

举例:
一: 图片缓存服务器

cache.max-memory-size = 2000 #maxium 2000M
cache.refresh-pattern = (
"\.(?i)(jpg|bmp|jpeg|gif|png|ico)$" => "0 use-memory",
"." => "120 no-cache"
)

二:页面缓存服务器

cache.max-memory-size = 1500 #maxium 1500M
cache.refresh-pattern = (
"\.(?i)(jpg|bmp|jpeg|gif|png|ico)$" => "0 use-memory",
"\.(?i)(css|js)$" => "1440 use-memory support-accept-encoding",
"\.(?i)(html|htm)$" => "10 use-memory support-accept-encoding",
"." => "120 no-cache"
)

如果后端服务器配置了mod_deflate,则可以改成:

cache.max-memory-size = 1500 #maxium 1500M
cache.refresh-pattern = (
"\.(?i)(jpg|bmp|jpeg|gif|png|ico)$" => "0 use-memory",
"\.(?i)(css|js)$" => "1440 use-memory support-accept-encoding use-gzip-deflate-only",
"\.(?i)(html|htm)$" => "10 use-memory support-accept-encoding use-gzip-deflate-only",
"." => "120 no-cache"
)

下载地址

Keywords: , ,

modcache v1.4.3 released

I backport modcache v1.4.2 to lighttpd 1.4.18 as modcache v1.4.3

Changelog:

  • fix bug on handle of fetchall-for-range-request option
  • new 'flv_streaming' option to work with mod_flv_streaming module

I update examples to demonstrate how mod_cache works with mod_flv_streaming.

homepage

Keywords: , ,

modcache v1.4.1 released

Changelog:

  • upgrade lighttpd 1.5 to r1922
  • put splaytree.c into mod_cache.c
  • fix memory leak on handler_ctx usage
  • fix memory leak on splaytree_splay usage

Hope you guys like it.

homepage

Keywords: , ,

modcache 1.4 released

changelog:

  • updated to lighttpd 1.5.0 r1811
  • status page for mod_status added
  • cache.ignore-hostname added
  • bugfix for checking cachehd file

homepage

Keywords: , ,




About

You are currently browsing the 听松一隅 weblog archives.

天气信息


6 页面: [1] 2 3 ... 下页 : 末页