Websocket,set progressive scenario vu10, the output result ws_sessions number is not 10

export let options = {
stages: [
{ duration: ‘20s’, target: 10 },
//{ duration: ‘50s’, target: 600 },
],
};
输出结果:
ws_sessions9个,如下:

running (48.6s), 00/10 VUs, 9 complete and 0 interrupted iterations
default ✓ [======================================] 00/10 VUs 20s

 ✓ Connected successfully

 checks................: 100.00% ✓ 9         ✗ 0
 data_received.........: 254 kB  5.2 kB/s
 data_sent.............: 157 kB  3.2 kB/s
 iteration_duration....: avg=30.77s   min=30.72s   med=30.74s   max=30.94s   p(90)=30.85s   p(95)=30.9s
 iterations............: 9       0.185118/s
 vus...................: 1       min=1       max=9
 vus_max...............: 10      min=10      max=10
 ws_connecting.........: avg=636.92ms min=608.95ms med=643.28ms max=669.49ms p(90)=650.62ms p(95)=660.05ms
 ws_msgs_received......: 692     14.233527/s
 ws_msgs_sent..........: 285     5.862074/s
 ws_session_duration...: avg=30.66s   min=30.62s   med=30.66s   max=30.69s   p(90)=30.68s   p(95)=30.68s
 ws_sessions...........: 9       0.185118/s

ws_sessions13个,如下

running (32.2s), 00/10 VUs, 13 complete and 0 interrupted iterations
default ✓ [======================================] 00/10 VUs 20s

 ✓ Connected successfully

 checks................: 100.00% ✓ 13       ✗ 0
 data_received.........: 97 kB   3.0 kB/s
 data_sent.............: 80 kB   2.5 kB/s
 iteration_duration....: avg=12.17s   min=10.9s    med=12.34s   max=12.77s   p(90)=12.76s   p(95)=12.76s
 iterations............: 13      0.403712/s
 vus...................: 1       min=1      max=10
 vus_max...............: 10      min=10     max=10
 ws_connecting.........: avg=632.99ms min=614.27ms med=628.95ms max=682.33ms p(90)=640.94ms p(95)=657.58ms
 ws_msgs_received......: 229     7.111542/s
 ws_msgs_sent..........: 150     4.658215/s
 ws_session_duration...: avg=11.34s   min=10.71s   med=11.25s   max=12.56s   p(90)=12.03s   p(95)=12.29s
 ws_sessions...........: 13      0.403712/s

先2分钟内连接上1000个vus,然后10分钟内压测老师和学生互相收发消息,用下面的场景,对吗?
export let options = {
stages: [
{ duration: ‘2m’, target: 1000 },
{ duration: ‘10m’, target: 1000 },
],
};

Hi @bingbing, Welcome to the community forum :tada:

Unfortunately I don’t think anyone on the team knows chinese :grimacing: . Can you please ask your question in English if possible :pray: , thank you.

Websocket, set progressive scenario vu10, the output result ws_sessions number is not 10.What are ws_session_duration and WS_sessions? What does it have to do with the following scene setup
export let options = {
stages: [
{ duration: ‘20s’, target: 10 },
],
};

[1000 VUs are connected in 2 minutes, and then in 10 minutes the teacher and the student send and receive messages to each other, using the following scenario, right?
export let options = {
stages: [
{ duration: ‘2m’, target: 1000 },
{ duration: ‘10m’, target: 1000 },
],
};

I still understand your question is.

Websocket, set progressive scenario vu10, the output result ws_sessions number is not 10.What are ws_session_duration and WS_sessions? What does it have to do with the following scene setup

stages is a shortcut for ramping-vus

and

export let options = {
stages: [
{ duration: ‘20s’, target: 10 },
],
};

means over 20 seconds go from the initial vus number(by default 1) to 10 so in this case around every 2s it will start 1 more vu.

Each VU on it’s own will execute the default function and when it’s done, it will start again and so on.

So in this case you are having 10 VUs that manage to finish 13 iterations - likely because they seem to take around 11s+.

With

export let options = {
stages: [
{ duration: ‘2m’, target: 1000 },
{ duration: ‘10m’, target: 1000 },
],

you will start 1000 VUs over 2m and then keep them for another 10m . How many iterations will be done is dependand on what the default function does.

I understand. Thank you.

Is there a way to connect all VUs first (Enter the studio) and then execute the default functions for all VUs

Is there a way to connect all VUs first (Enter the studio) and then execute the default functions for all VUs

The execution of the default function is where the connect to the websocket server happens, if that is what you meant.

If you want to just start with a number of vus (and still use `stages) you can do something like

export let options = {
stages: [
{ duration: ‘0’, target: 1000 },
{ duration: ‘10m’, target: 1000 },
],

This will start 1000 VUs at the beginning and then keep them running for 10m.

If you want to start sending messages only after all 1000 VUs are connected - you will need to implement this somehow … through the web server :shrug:. VUs in general don’t have any way of communicating in between themselves that aren’t through outside sources, such as a websocket server