ab测试curl测试

ab -n 1000  -c 100 -p 'post.txt' -T 'application/json' 'http://192.168.1.102:9600/api/myface' > ab.log


post.txt
{
	"personName":"xxx",
	"score":85.2928695678711,
	"hardwareId":"P6b38d05e",
	"phone":"",
	"avatarBase64url":"http://192.168.122.128:9400/2020-04-17/700776010370514944.jpg",
	"personId":"1331",
}

得到 ab.log
-----------------
[root@localhost ab-test-all]# cat my-ab-post.sh 
ab -n 1000  -c 100 -p 'post.txt' -T 'application/json' 'http://10.35.2.83:9600//api/myface' > ab.log
[root@localhost ab-test-all]# cat ab1.log 
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 10.35.2.83 (be patient).....done


Server Software:        
Server Hostname:        10.35.2.83
Server Port:            9600

Document Path:          /api/myface
Document Length:        3 bytes

Concurrency Level:      10
Time taken for tests:   0.110 seconds
Complete requests:      20
Failed requests:        0
Write errors:           0
Total transferred:      5660 bytes
Total body sent:        13740
HTML transferred:       60 bytes
Requests per second:    182.47 [#/sec] (mean)
Time per request:       54.804 [ms] (mean)
Time per request:       5.480 [ms] (mean, across all concurrent requests)
Transfer rate:          50.43 [Kbytes/sec] received
                        122.42 kb/s sent
                        172.85 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:     9   33  23.4     29      86
Waiting:        9   32  22.8     29      80
Total:          9   33  23.4     29      86

Percentage of the requests served within a certain time (ms)
  50%     29
  66%     37
  75%     51
  80%     51
  90%     80
  95%     86
  98%     86
  99%     86
 100%     86 (longest request)




---------------curl
curl -X POST "http://192.168.1.102:9600/ai/person/" -H "accept: application/json;charset=utf-8" -H "Content-Type: application/json" -d "{ "avatar": "", "depId": "20", "name": "aa1", "phone": "13552594619", "typeId": "1"}"



curl -X POST "http://127.0.0.1:10080/api/auth/token" -H "accept: application/json;charset=utf-8" -H "Content-Type: application/json" -d@p1.txt

p1.txt
{
	"username":"admin",
	"password":"www123"
}

curl -X POST "http://localhost:9600/ai/yltPerson/" -H "accept: application/json;charset=utf-8"  -H "Content-Type: application/json"  -H "token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTEyNTc5NzksImV4cCI6MTU5MTg2Mjc3OSwidXNlcklkIjoiMSIsImlzcyI6InJlbWFya0hvbGRpbmdzIn0.o2Y8LmQxaZk9mewZxS2tRSVtaboo5OGkwIUZm4j7ySU" -d@p1.txt


p1.txt
{
    "avatar": "base64 code",
    "depId": "20",
    "name": "aa1",
    "phone": "13552594619",
    "typeId": "1"
}

  

原文地址:https://www.cnblogs.com/xhzd/p/13047937.html