如何获得cisco和juniper设备的详细信息
2013-03-07 16:54
316 查看
论坛头像是动态的,例如:http://xxx.xxx.xxx/avatar.php?uid=xxx&size=big
每个用户的头像文件都有big、middle、small三个,并且在不同场景分别调用不同尺寸的头像图片,比如帖子、个人设置、头像编辑、登陆等等场景,无形中增加了nginx与php之间的工作压力,如果能够把这个解析结果缓存起来,那么就会减少nginx与php的通信压力,会降低系统cpu使用率。
测试nginx缓存功能,配置如下:
http域添加
fastcgi_cache_path /xxxcache levels=1:2 keys_zone=cgicache:30m inactive=1d max_size=10g;
server域添加
location ~* ^/avatar.php?.*$ {
add_header X-Cache-CFC "$upstream_cache_status - $upstream_response_time";
fastcgi_temp_path /xxxtemp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_cache cgicache;
fastcgi_cache_valid 301 302 1h;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
}
通过验证,缓存文件生成成功,http请求换成miss、hit等状态正确。
其它动态程序也可以使用此方法缓存。
本文出自 “菩提” 博客,请务必保留此出处http://zhangxingnan.blog.51cto.com/3241217/1619053
每个用户的头像文件都有big、middle、small三个,并且在不同场景分别调用不同尺寸的头像图片,比如帖子、个人设置、头像编辑、登陆等等场景,无形中增加了nginx与php之间的工作压力,如果能够把这个解析结果缓存起来,那么就会减少nginx与php的通信压力,会降低系统cpu使用率。
测试nginx缓存功能,配置如下:
http域添加
fastcgi_cache_path /xxxcache levels=1:2 keys_zone=cgicache:30m inactive=1d max_size=10g;
server域添加
location ~* ^/avatar.php?.*$ {
add_header X-Cache-CFC "$upstream_cache_status - $upstream_response_time";
fastcgi_temp_path /xxxtemp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_cache cgicache;
fastcgi_cache_valid 301 302 1h;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
}
通过验证,缓存文件生成成功,http请求换成miss、hit等状态正确。
其它动态程序也可以使用此方法缓存。
本文出自 “菩提” 博客,请务必保留此出处http://zhangxingnan.blog.51cto.com/3241217/1619053
相关文章推荐
- 如何在linux和windows下获得硬盘设备的接口通道信息
- 如何获得Android设备名称(ADB命令详细介绍)
- 如何获得unix版本的详细信息
- 如何获得相关指令的详细信息
- windows如何获得U盘的详细信息
- 如何获得U盘的详细信息
- [Oracle]如何获得出现故障时,客户端的详细连接信息
- 如何获得ios设备中的硬件信息(下)
- 如何获得Android设备名称(ADB命令详细介绍)
- 28.6.1 如何获得数据库创建过程中的详细信息
- [转]如何获得U盘的详细信息
- 如何获得WM设备信息,如型号、操作系统版本等
- [置顶] 如何查看连接自己wifi 的设备数目以及详细信息
- 如何获得WM设备信息,如型号、操作系统版本等
- 在VC中如何获得USB设备的Product ID,Vendor ID等信息
- 在VC中如何获得USB设备的Product ID,Vendor ID等信息
- 如何获得Android设备名称(ADB命令详细介绍)
- 关于如何查询本机详细的系统信息
- Linux系统环境下如何获得U盘拔插的信息
- 对不支持CSS浏览器,如何获得提示信息,使用灵活的ALT属性