ab测试curl测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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"
}<br><br><br><br><br>

  curl 传参  curl http://mywebsite.com/index.php?a=1\&b=2\&c=3

 

curl https://xxx -i -X POST -d 'a=1&b=2' (-i显示响应头,https加上 --insecure )

 

xml请求

cat cb.xml | curl -X POST -H 'Content-type:text/xml' -H 'cookie:JSESSIONID=xxx' -d @- http://xxx

 

posted @   星回中道  阅读(991)  评论(0编辑  收藏  举报
编辑推荐:
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
阅读排行:
· 手把手教你在本地部署DeepSeek R1,搭建web-ui ,建议收藏!
· Spring AI + Ollama 实现 deepseek-r1 的API服务和调用
· 数据库服务器 SQL Server 版本升级公告
· 程序员常用高效实用工具推荐,办公效率提升利器!
· C#/.NET/.NET Core技术前沿周刊 | 第 23 期(2025年1.20-1.26)
点击右上角即可分享
微信分享提示