Commit b397732b authored by Your Name's avatar Your Name

test record

parent 83186670
......@@ -49,6 +49,21 @@
```console
./k6 run --vus 20 -i 1000 --batch 20000 --batch-per-host 10000 http_batch.js --local-ips '192.168.10.1-192.168.10.99'
```
| 序号 | k6 | kong | api-backend | delay 10s | 1.5M | k6 速率 | req_failed | data_received |
|:--: | :---: | :----: | :----: | :----: | :----: | :----: | :----: | :----: |
|1 | 220 | 220 | 220 | | | 24808.401989/s | 0.0% | |
|2 | 220 | 220 | 220 | 1 | | 1055.079942/s | 5.58% | |
|3 | 220 | 220 | 220 | | 1 | 1701.379022/s | 0.00% | 2.7 GB/s |
|3 | 220 | 220 | 220 | 1 | 1 | 618.755198/s | 2.16% | 953 MB/s |
......
import http from 'k6/http';
import { check } from 'k6';
export default function () {
/*
array[i] = http.asyncRequest('POST', 'http://192.168.1.220:8000/api/v1/demianhjw/aigic/0129', {
"model_name": "Realistic_Vision_V1.4",
"model_type": "tex2img",
"desc": {
"prompt": " a small car",
"steps": 20
}
}, { headers:
{ "Content-Type": "application/json",
"apikey":"6r9aCCENYah5KPARJ4GLFmlOLs0uAEr2",
"async":"true"}
});
}
./k6 run --vus 100 -i 100 --batch 2000 --batch-per-host 1000 http_batch.js --local-ips '192.168.10.1-192.168.10.99'
./k6 run --vus 30 -d 100s --batch 20000 --batch-per-host 10000 http_batch.js --local-ips '192.168.10.1-192.168.10.99'
*/
let array = new Array(1000);
for (let i = 0; i < array.length; i++) {
array[i] = {
method: 'POST',
url: 'http://192.168.1.220:8000/api/v1/demianhjw/aigic/0129',
body: {
"model_name": "Realistic_Vision_V1.4",
"model_type": "tex2img",
"desc": {
"prompt": " a small car",
"steps": 20
}
},
params: {
headers: { "Content-Type": "application/json",
"apikey":"6r9aCCENYah5KPARJ4GLFmlOLs0uAEr2",
"async":"true"},
},
};
}
const responses = http.batch(array);
// httpbin.test.k6.io should return our POST data in the response body, so
// we check the third response object to see that the POST worked.
// check(responses[0], {
// 'form data OK': (res) => JSON.parse(res.body)['form']['hello'] == 'world!',
// });
const res = Promise.all(array)
check(res, {
"status is 200": (r) => r.status === 200,
// "is key correct": (r) => j.json.key === "value",
});
}
// export let options = {
// stages: [
// // Ramp-up from 1 to 5 VUs in 10s
// { duration: "20s", target: 2000 },
// // Stay at rest on 5 VUs for 5s
// { duration: "10s", target: 1000 },
// // Ramp-down from 5 to 0 VUs for 5s
// { duration: "15s", target: 0 }
// ]
// };
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment