Nginx日志切割实战
一、Apache Benchmark(ab) 压力测试工具
[root@localhost nginx]# yum install -y httpd-tools
ab压力测试工具的使用
- 模拟并发请求1次,总共请求10000次
- 命令模板:
ab -c 1 -n 10000 待测试网站(建议完整路径)/
1、使用du -sh *
命令查看日志文本大小
[root@localhost nginx]# du -sh *
64K access.log
84K error.log
2、使用ab压力测试工具
扩大日志文本大小
[root@localhost nginx]# ab -c 100 -n 10000 http://192.168.146.133/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.146.133 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: nginx/1.8.1
Server Hostname: 192.168.146.133
Server Port: 80
Document Path: /
Document Length: 612 bytes
Concurrency Level: 100
Time taken for tests: 1.425 seconds
Complete requests