Commit 7157878f authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update http task

parent 9ce6bbdb
This diff is collapsed.
checks.........................: 100.00% ✓ 560 ✗ 0
data_received..................: 356 kB 591 B/s
data_sent......................: 58 kB 96 B/s
http_req_blocked...............: avg=17.33µs min=1µs med=8µs max=553µs p(90)=19µs p(95)=25.04µs
http_req_connecting............: avg=5.35µs min=0s med=0s max=521µs p(90)=0s p(95)=0s
http_req_duration..............: avg=8.6s min=4.52s med=8.91s max=9.07s p(90)=8.99s p(95)=9s
{ expected_response:true }...: avg=8.6s min=4.52s med=8.91s max=9.07s p(90)=8.99s p(95)=9s
http_req_failed................: 0.00% ✓ 0 ✗ 280
http_req_receiving.............: avg=194.4µs min=38µs med=150µs max=3.48ms p(90)=278.2µs p(95)=363.54µs
http_req_sending...............: avg=51.39µs min=9µs med=40µs max=808µs p(90)=72.09µs p(95)=105µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=8.6s min=4.52s med=8.91s max=9.07s p(90)=8.99s p(95)=9s
http_reqs......................: 280 0.464687/s
iteration_duration.............: avg=8.6s min=4.52s med=8.91s max=9.07s p(90)=8.99s p(95)=9s
iterations.....................: 280 0.464687/s
vus............................: 4 min=4 max=4
vus_max........................: 4 min=4 max=4
✗ status is 200
↳ 98% — ✓ 622 / ✗ 10
✗ task is success
↳ 98% — ✓ 622 / ✗ 10
checks.........................: 98.41% ✓ 1244 ✗ 20
data_received..................: 752 kB 1.2 kB/s
data_sent......................: 130 kB 214 B/s
http_req_blocked...............: avg=1.9ms min=1µs med=7.5µs max=127.31ms p(90)=20µs p(95)=34.89µs
http_req_connecting............: avg=1.89ms min=0s med=0s max=127.21ms p(90)=0s p(95)=0s
http_req_duration..............: avg=9.55s min=4.49s med=8.88s max=1m0s p(90)=8.93s p(95)=8.98s
{ expected_response:true }...: avg=8.74s min=4.49s med=8.87s max=9.21s p(90)=8.92s p(95)=8.95s
http_req_failed................: 1.58% ✓ 10 ✗ 622
http_req_receiving.............: avg=396.04µs min=0s med=159µs max=43.92ms p(90)=371µs p(95)=680.45µs
http_req_sending...............: avg=51.89µs min=5µs med=41.5µs max=516µs p(90)=82µs p(95)=123.44µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=9.55s min=4.49s med=8.87s max=1m0s p(90)=8.93s p(95)=8.98s
http_reqs......................: 632 1.040663/s
iteration_duration.............: avg=9.56s min=4.49s med=8.88s max=1m0s p(90)=8.94s p(95)=9.01s
iterations.....................: 632 1.040663/s
vus............................: 2 min=2 max=10
vus_max........................: 10 min=10 max=10
✗ status is 200
↳ 99% — ✓ 3594 / ✗ 10
✗ task is success
↳ 99% — ✓ 3594 / ✗ 10
checks.........................: 99.72% ✓ 7188 ✗ 20
data_received..................: 4.4 MB 2.4 kB/s
data_sent......................: 742 kB 412 B/s
http_req_blocked...............: avg=630.19µs min=0s med=8µs max=119.23ms p(90)=12µs p(95)=16µs
http_req_connecting............: avg=618.04µs min=0s med=0s max=118.66ms p(90)=0s p(95)=0s
http_req_duration..............: avg=5s min=4.49s med=4.54s max=30.3s p(90)=4.66s p(95)=8.86s
{ expected_response:true }...: avg=4.93s min=4.49s med=4.54s max=13.89s p(90)=4.64s p(95)=8.86s
http_req_failed................: 0.27% ✓ 10 ✗ 3594
http_req_receiving.............: avg=209.86µs min=0s med=167µs max=32.25ms p(90)=259µs p(95)=312µs
http_req_sending...............: avg=56.23µs min=6µs med=47µs max=5.94ms p(90)=72µs p(95)=85µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=5s min=4.49s med=4.54s max=30.3s p(90)=4.66s p(95)=8.86s
http_reqs......................: 3604 1.998079/s
iteration_duration.............: avg=5s min=4.49s med=4.54s max=30.3s p(90)=4.66s p(95)=8.86s
iterations.....................: 3604 1.998079/s
vus............................: 4 min=4 max=10
vus_max........................: 10 min=10 max=10
✓ status is 200
✓ task is success
checks.........................: 100.00% ✓ 1362 ✗ 0
data_received..................: 828 kB 1.4 kB/s
data_sent......................: 140 kB 231 B/s
http_req_blocked...............: avg=41.22µs min=2µs med=6µs max=2.6ms p(90)=13µs p(95)=19µs
http_req_connecting............: avg=25.55µs min=0s med=0s max=1.95ms p(90)=0s p(95)=0s
http_req_duration..............: avg=8.88s min=4.6s med=8.88s max=9.27s p(90)=8.95s p(95)=8.99s
{ expected_response:true }...: avg=8.88s min=4.6s med=8.88s max=9.27s p(90)=8.95s p(95)=8.99s
http_req_failed................: 0.00% ✓ 0 ✗ 681
http_req_receiving.............: avg=199.58µs min=28µs med=123µs max=14.11ms p(90)=257µs p(95)=354µs
http_req_sending...............: avg=47.7µs min=6µs med=33µs max=1.4ms p(90)=66µs p(95)=101µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=8.88s min=4.6s med=8.88s max=9.27s p(90)=8.95s p(95)=8.99s
http_reqs......................: 681 1.122725/s
iteration_duration.............: avg=8.88s min=4.6s med=8.88s max=9.27s p(90)=8.95s p(95)=8.99s
iterations.....................: 681 1.122725/s
vus............................: 4 min=4 max=10
vus_max........................: 10 min=10 max=10
\ No newline at end of file
import http from 'k6/http'; import http from 'k6/http';
import { check, fail } from 'k6'; import { check, fail } from 'k6';
import { apiKeys } from './apikey.js';
export const options = { export const options = {
vus: 2, vus: 10,
duration: '3600s', duration: '3600s',
}; };
export default function () {
const url = 'http://18.167.103.232/api/v1/txt2img/base/llm';
export default function() { const params = {
const url = 'http://43.198.252.255:8000/api/v1//txt2img/base/llm'; headers: {
const payload = JSON.stringify({ 'apikey': apiKeys[Math.floor(Math.random() * apiKeys.length)],
"test": 1
})
const param = {
headers:{
'apikey': 'L6eXzteHYa2Uq0ar4kdMaBOiOIjmRI08',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, }
}; }
var res = http.post(url, payload, param); const body = JSON.stringify({ 'test': 1 })
const res = http.post(url, body, params)
// const res = responses[i];
const statusCheck = check(res, { const statusCheck = check(res, {
'status is 200': (r) => r.status === 200, 'status is 200': (r) => r.status === 200,
}); });
...@@ -26,22 +28,24 @@ export default function() { ...@@ -26,22 +28,24 @@ export default function() {
'task is success': (r) => r.json('task.is_success') === true, 'task is success': (r) => r.json('task.is_success') === true,
}); });
if (!statusCheck) { if (!statusCheck) {
// console.log('task status failed', res.status); // console.log('task status failed', res.status);
fail('task ' + res.headers['Task-Id'] + ' failed with status error: ' + res.status); fail('task ' + res.headers['Task-Id'] + ' failed with status error: ' + res.status);
} else if (!taskCheck) { } else if (!taskCheck) {
// check res.boy is empty // check res.boy is empty
if (res.body == null ) { if (res.body == null) {
fail('task ' + res.headers['Task-Id'] + ' failed with empty response'); fail('task ' + res.headers['Task-Id'] + ' failed with empty response');
} else { } else {
if (res.json('task.api_error.message') !== undefined) { if (res.json('task.api_error.message') !== undefined) {
console.log(res.body)
fail('task ' + res.headers['Task-Id'] + ' failed with api error: ' + res.json('task.api_error.message')); fail('task ' + res.headers['Task-Id'] + ' failed with api error: ' + res.json('task.api_error.message'));
} }
if (res.json('task.error') !== undefined) { if (res.json('task.error') !== undefined) {
console.log(res.body)
fail('task ' + res.headers['Task-Id'] + ' failed with execute error: ' + res.json('task.error')); fail('task ' + res.headers['Task-Id'] + ' failed with execute error: ' + res.json('task.error'));
} }
} }
} }
// console.log("res is ", res); // console.log("res is ", res);
} }
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