java后端系统架构之技术架构验证篇1

来源:互联网 发布:排序算法总结 编辑:程序博客网 时间:2024/05/01 04:34

本篇讲述如何验证技术架构可行性

压测工具使用

ab工具


ab -c 20000 -n 10000000 -p msg.txt http://localhost:8081/post?xx=075500000000\&token=99029212\&Version=1.0
Concurrency Level:      10000
Time taken for tests:   151.732369 secondsComplete requests:      500000Failed requests:        0Write errors:           0Total transferred:      0 bytesTotal POSTed:           100014614HTML transferred:       0 bytesRequests per second:    3295.28 [#/sec] (mean)Time per request:       3034.647 [ms] (mean)Time per request:       0.303 [ms] (mean, across all concurrent requests)Transfer rate:          0.00 [Kbytes/sec] received                        643.70 kb/s sent                        643.70 kb/s total
Connection Times (ms)              min  mean[+/-sd] median   maxConnect:        0 1646 3061.0    776   47149Processing:     0 1224 1767.1   1087   67949Waiting:        0    0   0.0      0       0Total:          0 2870 3473.2   2039   83262Percentage of the requests served within a certain time (ms)  50%   2039  66%   2267  75%   2746  80%   3729  90%   5061  95%   6796  98%  10853  99%  21644 100%  83262 (longest request)

jmeter工具


jmx脚本,为我自己编写。jmeter很耗内存,需要大点的内存。jemeter写报表日志,对io有很大影响,因此压测时,应该使用少量性能损耗低的报表。并发大量用户线程对主机内存,线程切换等有影响

集合点:即模拟N个用户,在同一时刻发出请求,在毫秒内发出大量的请求,以测试系统的负载能力。

无集合点:8000用户线程,2000次请求/每线程



有集合点:4000用户线程 。syntimes是4000集合点


siege工具


urls文件
http://120.24.208.132:9081/simple/services/s1 POST <msg.txt
Http地址为请求压测的地址    Post 为请求类型   msg.txt为请求报文 

msg.txt
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tel="http://youdomain.com"><soapenv:Header/><soapenv:Body><tel:exchange><tel:in0>xxxx</tel:in0></tel:exchange></soapenv:Body></soapenv:Envelope>

压测命令
 ./siege -c 1 -r 200 -f urls 
-c 并发用户 数 -r每个用户发送的请求数  urls为上面的文件



linux性能分析基本命令

netstat命令

netstat -n|awk '/^tcp/{++S[$NF]} END {for(a in S) print a,S[a]}'


linux内核参数修改

vi /etc/sysctl.confvi /etc/security/limits.conf * soft nofile 32768 * hard nofile 65536 


查线程IO占用

pidstat -d -t -p[pid] 1 100


0 0
原创粉丝点击