web缓存值varnish使用
具体的介绍到官网 https://www.varnish-software.com/static/book
一、简介
Varnish is a reverse HTTP proxy, sometimes referred to as a HTTP accelerator or a web accelerator. It is designed for modern hardware, modern operating systems and modern work loads.
Varnish is designed for hardware that you buy today, not the hardware you bought 15 years ago. Varnish is designed to run on 64-bit architectures and will scale almost proportional to the number of CPU cores you have available. Though CPU-power is rarely a problem.
所以它是为64位操作系统打造的,服务于现在高性能的服务器。
Varnish does not keep track of whether your cache is on disk or in memory. Instead, Varnish will request a large chump of memory and leave it to the operating system to figure out where that memory really is. The operating system can generally do a better job than a user-space program.
它把一部分功能交给了处理能力更强的操作系统,由操作系统来维护缓存,这样系能更能提高
二、下载安装
wget http://repo.varnish-cache.org/source/varnish-3.0.4.tar.gz
tar -xzvf
./configure 报错 error: Package requirements (libpcre) were not met
但是我rpm -qa | grep pcre是有东西的
export PKG_CONFIG=/usr/local/lib/pkgconfig/还是不行,报错 The pkg-config script could not be found or is too old.
既然这么麻烦,我就不用PK_CONFIG了,
export PCRE_LIBS=/usr/lib64/
export PCRE_CFLAGS=/usr/lib64/
./configure --prefix=/usr/loca/varnish
但是make的时候出错 :undefined reference to `pcre_free
好吧,尼玛的我重新安装pkg-config
wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.27.1.tar.gz
tar -xzvf
./configure --with-libiconv=gnu
make && maike install
然后 调用./pkg-config又报错: error while loading shared libraries: libiconv.so.2:
libiconv.so.2在/usr/local/lib目录下
vim /etc/ld.so.conf,增加一行/usr/local/lib
ldconfig,再运行pkg-config就不报错了
再次进入varnish的安装目录,这次configure make make install都不报错了。尼玛的坑爹货。早知道这么麻烦我直接 yum install varnish一句搞定
三、运行
vim /usr/local/varnish/etc/varnish/default.把
backend default {
.host = "127.0.0.1";
.port = "8080";
}前面的注释去掉
chown www:www -R /usr/local/varnish/var/varnish/
/usr/local/varnish/sbin/varnishd -P /var/run/varnish.pid -a :80 -f /usr/local/varnish/etc/varnish/default.vcl -T 127.0.0.1:6082 -t 120 -w 50,1000,120 -u www -g www -s file,/usr/local/varnish/var/varnish/varnish_storage.bin,1G
四、配合nginx
1、把nginx监听的端口从80改成上面的8080
2、重启nginx服务,然后开启varnish服务即可
五、重启varnish
/usr/local/varnish/bin/varnishadm
vcl.load reload01 /usr/local/varnish/etc/varnish/default.vcl
vcl.use reload01
这样就重启了。更改了default.vcl以后可以这样简单的重新加载配置
六、一些配置
未完待续
七、一些小注意事项
1、如果http的请求中带有cookie,默认情况下varnish是不会缓存的。如果想对cookie做一些筛选,可以参照https://www.varnish-cache.org/trac/wiki/VCLExampleRemovingSomeCookies
web缓存值varnish使用的更多相关文章
- Web缓存(Varnish方案)
Web缓存(Varnish方案) 转载 http://www.s135.com/post/313/ arnish是一款高性能的开源HTTP加速器,挪威最大的在线报纸 Verdens Gang (htt ...
- 【Web缓存机制系列】2 – Web浏览器的缓存机制-(新鲜度 校验值)
Web缓存的工作原理 所有的缓存都是基于一套规则来帮助他们决定什么时候使用缓存中的副本提供服务(假设有副本可用的情况下,未被销毁回收或者未被删除修改).这些规则有的在协议中有定义(如HTTP协议1.0 ...
- 项目实战5—企业级缓存系统varnish应用与实战
企业级缓存系统varnish应用与实战 环境背景:随着公司业务快速发展,公司的电子商务平台已经聚集了很多的忠实粉丝,公司也拿到了投资,这时老板想通过一场类似双十一的活动,进行一场大的促销,届时会有非常 ...
- web缓存服务器varnish-4.1.6的部署及配置详解
web缓存服务器varnish-4.1.6的部署及配置详解 1.安装varnish4.1.6安装依赖 yum install -y autoconf automake jemalloc-devel l ...
- 作为前端应当了解的Web缓存知识
缓存优点 通常所说的Web缓存指的是可以自动保存常见http请求副本的http设备.对于前端开发者来说,浏览器充当了重要角色.除此外常见的还有各种各样的代理服务器也可以做缓存.当Web请求到达缓存时, ...
- Web缓存杂谈
一.概述 缓存通俗点,就是将已经得到的‘东东’存放在一个相对于自己而言,尽可能近的地方,以便下次需要时,不会再二笔地跑到起始点(很远的地方)去获取,而是就近解决,从而缩短时间和节约金钱(坐车要钱嘛). ...
- Web 技术人员需知的 Web 缓存知识(转)
最近的译文距今已有4年之久,原文有一定的更新.今天踩着前辈们的肩膀,再次把这篇文章翻译整理下.一来让自己对web缓存的理解更深刻些,二来让大家注意力稍稍转移下,不要整天HTML5, 面试题啊叨啊叨的~ ...
- [转载]WEB缓存技术概述
[原文地址]http://www.hbjjrb.com/Jishu/ASP/201110/319372.html 引言 WWW是互联网上最受欢迎的应用之一,其快速增长造成网络拥塞和服务器超载,导致客户 ...
- Web 技术人员需知的Web 缓存知识
最近的译文距今已有4年之久,原文有一定的更新.今天踩着前辈们的肩膀,再次把这篇文章翻译整理下.一来让自己对web缓存的理解更深刻些,二来让大家注意力稍稍转移下,不要整天HTML5, 面试题啊叨啊叨的~ ...
随机推荐
- MTK Android 编译命令
一.Target 编译命令 usage: (makeMtk|mk) [options] project actions [moudles] options: -t,-tcc ...
- EntityFramework:支持同一事务提交的批量删除数据实现思路
一切从一段代码说起... 下面一段代码是最近我在对一EF项目进行重构时发现的. protected override void DoRemove(T entity) { this.dbContext. ...
- 转: sqlserver常用sql语句,更改字段,建立唯一键,多个字段去重复等
[sql] view plain copy print?在CODE上查看代码片派生到我的代码片 --修改字段类型: --alter table 表名 alter column 待修改字段名 待修改字段 ...
- 51nod1257 背包问题 V3
分数规划经典.开始精度1e-3/1e-4都不行,1e-5就A了 #include<cstdio> #include<cstring> #include<cctype> ...
- 51nod1120 机器人走方格 V3
跟括号序列是一样的,将向右走看成是左括号向左走看成是右括号就可以了.那么就是卡特兰数了.然后由于n和m太大所以用了lucas定理 //跟括号序列是一样的,将向右走看成是左括号向左走看成是右括号就可以了 ...
- 博客已搬家至 hate13.com
博客园停止更新,新博客链接:hate13.com 欢迎访问~
- 点分十进制IP校验、转换,掩码校验
/***************************************************************************** * 点分十进制IP校验.转换,掩码校验 * ...
- modeler与activiti进行整合
整合Activiti Modeler到业务系统(或BPM平台) http://www.kafeitu.me/activiti/2013/03/10/integrate-activiti-modeler ...
- bash 的漏洞,你们中招了吗?
http://threatpost.com/major-bash-vulnerability-affects-linux-unix-mac-os-x 检测: $ env x='(){:;}; echo ...
- android 单独编译某个模块
第一次下载好Android源代码工程后,我们通常是在Android源代码工程目录下执行make命令,经过漫长的等待之后,就可以得到Android系统镜像system.img了.以后如果我们修改了And ...