今日发现lighttpd的日志有大量的错误是同样的错误提示:
因为存在11433/1 的下级目录,而lighttpd根据地址认为 11433 是一个文件,删除的时候出错了,代码位置是:
unlink只能删除文件,不能删除文件夹,所以删除失败。
在linux下同一个目录下不会有同名的文件和文件夹
也就是说,如果 /a/1 的地址先访问,/a/1 的文件就先创建了
如果 /a/1/index.htm 先访问,/a/1 的文件夹先创建,老外一种形式就无法再缓存,这个就给后端带来了压力。
这个可以用redirect或者rewrite修正,参考做法:
原创内容如转载请注明:来自 阿权的书房
2009-05-21 18:39:06: (mod_cache.c.2080) failed to delete old cache file /cache/web/www.aslibra.com/search/article/11433 before update Is a directory
因为存在11433/1 的下级目录,而lighttpd根据地址认为 11433 是一个文件,删除的时候出错了,代码位置是:
if (unlink(file->ptr) && errno != ENOENT) {
log_error_write(srv, __FILE__, __LINE__, "sbss", "failed to delete old cache file",
hctx->file, "before update", strerror(errno));
log_error_write(srv, __FILE__, __LINE__, "sbss", "failed to delete old cache file",
hctx->file, "before update", strerror(errno));
unlink只能删除文件,不能删除文件夹,所以删除失败。
在linux下同一个目录下不会有同名的文件和文件夹
[root@localhost test]# ll
total 8
-rw-r--r-- 1 root root 1 May 24 02:08 a
[root@localhost test]# mkdir a
mkdir: `a' exists but is not a directory
[root@localhost test]# mkdir b
[root@localhost test]# ll
total 16
-rw-r--r-- 1 root root 1 May 24 02:08 a
drwxr-xr-x 2 root root 4096 May 24 02:16 b
[root@localhost test]# echo>b
-bash: b: Is a directory
total 8
-rw-r--r-- 1 root root 1 May 24 02:08 a
[root@localhost test]# mkdir a
mkdir: `a' exists but is not a directory
[root@localhost test]# mkdir b
[root@localhost test]# ll
total 16
-rw-r--r-- 1 root root 1 May 24 02:08 a
drwxr-xr-x 2 root root 4096 May 24 02:16 b
[root@localhost test]# echo>b
-bash: b: Is a directory
也就是说,如果 /a/1 的地址先访问,/a/1 的文件就先创建了
如果 /a/1/index.htm 先访问,/a/1 的文件夹先创建,老外一种形式就无法再缓存,这个就给后端带来了压力。
这个可以用redirect或者rewrite修正,参考做法:
$HTTP["host"] == "www.aslibra.com" {
#指定规则补全地址
url.redirect = (
"^/search/(article|pic)/([^/]+)$" => "/search/$1/$2/",
)
$HTTP["url"] =~ "^/search/" {
#可以重新制定目录缓存文件,避免原先的文件冲突
cache.bases = ("/cache/web/search/")
cache.support-queries = "disable"
}
proxy.server = ( "" =>(
( "host" => "192.168.1.2")
))
}
#指定规则补全地址
url.redirect = (
"^/search/(article|pic)/([^/]+)$" => "/search/$1/$2/",
)
$HTTP["url"] =~ "^/search/" {
#可以重新制定目录缓存文件,避免原先的文件冲突
cache.bases = ("/cache/web/search/")
cache.support-queries = "disable"
}
proxy.server = ( "" =>(
( "host" => "192.168.1.2")
))
}
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
三里屯Village
memcachedb的缓存解决方案
