部分内容转自:http://hi.baidu.com/supermfc/blog/item/21e74638f1f576feb311c71b.html
1、Pcre的安装 (PERL兼容正则表达式库)
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/pcre/pcre/8.02/pcre-8.02.tar.bz2tar zxvf pcre-8.02.tar.gz
cd pcre-8.02
./configure --libdir=/usr/lib
make && make install
如果没有安装Pcre,configure varnish2.0以上版本时候,会提示找不到pcre库
2、varnish 安装
wget http://cdnetworks-kr-2.dl.sourceforge.net/project/varnish/varnish/2.1.3/varnish-2.1.3.tar.gz
tar zxvf varnish-2.1.1
cd varnish-2.1.1
./configure --prefix=/usr/local/varnish
make && make install
3、varnish启动
usage: varnishd [options]
-a address:port # HTTP listen address and port
-b address:port # backend address and port
# -b <hostname_or_IP>
# -b '<hostname_or_IP>:<port_or_service>'
-C # print VCL code compiled to C language
-d # debug
-f file # VCL script
-F # Run in foreground
-h kind[,hashoptions] # Hash specification
# -h simple_list
# -h classic [default]
# -h classic,<buckets>
-i identity # Identity of varnish instance
-l bytesize # Size of shared memory log
-M address:port # CLI-master to connect to.
-n dir # varnishd working directory
-P file # PID file
-p param=value # set parameter
-s kind[,storageoptions] # Backend storage specification
# -s malloc
# -s file [default: use /tmp]
# -s file,<dir_or_file>
# -s file,<dir_or_file>,<size>
# -s file,<dir_or_file>,<size>,<granularity>
-t # Default TTL
-S secret-file # Secret file for CLI authentication
-T address:port # Telnet listen address and port
-V # version
-w int[,int[,int]] # Number of worker threads
# -w <fixed_count>
# -w min,max
# -w min,max,timeout [default: -w2,500,300]
-u user # Priviledge separation user id
sbin/varnishd -a :8080 -n logs -f etc/varnish/default.vcl -T localhost:6082 -p thread_pools 8 -p first_byte_timeout 20 -p between_bytes_timeout 10m -s malloc,100m
4、varnish配置
backend test {
.host = "102.21011.81.309";
.port = "8080";
.probe = {
.url = "/index.jsp";
.interval = 5s;
.timeout = 8 s;
.window = 5;
.threshold = 3;
}
}
director baz1 round-robin{
{
.backend = test;
}
}
sub vcl_recv {
set req.backend = baz1;
/* add x-forwarded-for */
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For =
req.http.X-Forwarded-For ", " client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
/* ignore invalid request */
if (req.request != "GET" &&
req.request != "HEAD" &&
req.request != "PUT" &&
req.request != "POST" &&
req.request != "TRACE" &&
req.request != "OPTIONS" &&
req.request != "DELETE") {
/* Non-RFC2616 or CONNECT which is weird. */
return (pipe);
}
if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
/* Not cacheable by default */
return (pass);
}
/* // need cache turn on return (lookup);*/
return (pass);
}
sub vcl_pipe {
set req.http.connection = "close";
return (pipe);
}
sub vcl_deliver {
set resp.http.Server = "是";
return (deliver);
}
5、用apache ab进行测试
ab -n100000 -c1000 http://192.168.1.128:8080/index.jsp
Benchmarking 192.168.1.128(be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests
Server Software: Apache-Coyote/1.1
Server Hostname: 10.210.71.30
Server Port: 8080
Document Path: /index.jsp
Document Length: 8248 bytes
Concurrency Level: 1000
Time taken for tests: 97.820 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 838287304 bytes
HTML transferred: 825560634 bytes
Requests per second: 1022.28 [#/sec] (mean)
Time per request: 978.205 [ms] (mean)
Time per request: 0.978 [ms] (mean, across all concurrent requests)
Transfer rate: 8368.80 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 575 1925.0 108 45128
Processing: 9 377 624.8 224 13631
Waiting: 7 223 501.8 107 13230
Total: 12 953 2061.8 339 45373
Percentage of the requests served within a certain time (ms)
50% 339
66% 360
75% 415
80% 620
90% 3230
95% 3439
98% 9209
99% 9459
100% 45373 (longest request)
未完待续.....
分享到:
相关推荐
varnish测试报告
squid、varnish、ngx_cache的性能测试对比报告
Varnish Cache测试覆盖套件用于测量Varnish Cache的测试套件覆盖率的工具。 这段代码位于上的git中。先决条件在Debian上: # apt-get install lcov跑步主脚本是“ collect”,它使用varnish-cache/的git checkout。 ...
它不是超级强大,而且我没有要测试的 Windows 机器。 因此,如果您发现明显的 Windows 问题,请告诉我!运行这个你需要安装和 。 Git 克隆这个盒子。 编辑 Vagrantfile,将 webroot 设置为各个站点文件夹所在的...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
varnish_ng食谱 这是一本食谱,用于使用LWRP管理。 传统上,系统运行具有多个实例和多个虚拟主机的单个Varnish服务。... 该食谱有望与Varnish 3.0版一起使用,但尚未经过测试。 支持的安装类型 当前仅通过
一个安装了清漆,设置守护程序选项并推出vcl的人偶模块。 它带有一个相当通用的VCL文件,该文件可以进行一些基本的缓存,但是对于大多数环境而言可能是不够的。 用法: 通用清漆安装 class { 'varnish': } 包括...
这些说明将为您提供在本地计算机上运行并运行的项目的副本,以进行开发和测试。 有关如何在实时系统上部署项目的注释,请参阅部署。 先决条件 对于版本1.0 Magento 2.2 PHP 7.1 对于realease 2.0 Magento 2.3 ...
普罗米修斯的清漆出口商 刮除每个Prometheus集合上的varnishstat -j JSON输出,并公开所有报告的指标。 具有多个后端或清漆定义标识符的度量标准... 我已经亲自测试了以下版本的Varnish才能工作6.0.0, 5.2.1, 5.1.2, 4.
清漆3.x 支持的目标: Ubuntu 14.04 LTS“ Trusty Tahr” Ubuntu 12.04 LTS“精确的穿山甲” Debian(未经测试) 安装方式: 来自官方存储库的二进制软件包可调用的任务: vcl :创建(或删除)Varnish VCL配置用法...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
1.4.1 下载与安装Nginx 1.4.2 Nginx配置文件的结构 1.4.3 配置与调试Nginx 1.4.4 Nginx的启动、关闭和平滑重启 1.5 Nginx常用配置实例 1.5.1 虚拟主机配置实例 1.5.2 负载均衡配置实例 1.5.3 防盗链...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装