Rendezvous is a French word commonly used in the load testing word. It sounds so fancy!
I believe Mercury first coined and implemented it (I may be wrong) in LoadRunner. NeoLoad has it with the same name, and JMeter calls it Synchronizing timer.
But what is it really, and how may we use it?
Rendezvous is a function that stops the virtual users when they reach that instruction in the script. The function makes them wait until more virtual users get to that step or a timer runs out. Then everyone who reaches that point will execute the next instruction simultaneously.
Sounds complex? Let's detail this a bit more.
Rendezvous in action
Thanks to the contribution of Mark Tomlinson, I have a perfect analogy to explain it. Let's go over it.
Imagine you are at a ski resort or park. In those places, the people would follow these steps:
- Buy passes & rent equipment
- Gear up
- Head to lift
- Wait for the lift - RENDEZVOUS!
- Get on the lift
- Be lifted
- Ski through different lanes
- Repeat step 3 until tired
- Take off & return the gear
- Go home
Step 4 is our point of interest, as it is an excellent rendezvous example.
In a ski park, you have multiple people, each doing their set of steps at their own pace. Some arrived earlier, some just arrived. Once at the park, each person may do things at different speeds. Some may take longer to gear up; for others, the rental area may be slow at rush hours, and some may even pause to go to the bathroom. Once up there, some may ski fast, while others may be slow, depending on if they are beginners or experts.
That sounds a lot like a load test scenario.
Each virtual user executes the steps, iterates, ramps up or down, and has a somewhat different response and wait times on each action. A beautiful load scenario!
But unlike standard scripts where everyone executes at their pace, we have step 4 (wait for the lift), where the users wait as they arrive, and all of them do step 5 (jump on the lift) simultaneously when there are enough people to fill the lift, or the lift has to leave as the next one is coming.
That is rendezvous in essence. It is a process that holds every user arriving at that step (the lift departing) until enough people are waiting, or it has to leave with whoever is waiting there when the next lift comes. In other words, you define time to wait and people per lift.
The rendezvous lift is different from real life, where you have to wait for the next lift once the first one is full. Here, the lift leaves right after it reaches its capacity. There are more ready to get people right away. But, if the time is up and the following lift arrives, it will depart even if there is only one person inside.
How to, in k6
Out of the function's two parameters, a number parameter for users, or the timelapse, I think time is the easiest to implement in k6.
Following the ski lift example, the most straightforward approach for our rendez function is to work like the ski lift, which automatically passes and picks people.
First, we define how many milliseconds the time-lapse should be.
Now here is my proposed first and easy rendez function.
That function will take the start time of the scenario and restart the rendez timer every time it is completed.
With that function, our example script could go like this:
With the code above, the virtual users will execute their steps and wait for the rendez period to happen before executing step 5. Like in the lift example, the ski lift will leave every 30 seconds with whatever users have arrived at the rendez wait. Yes, this one is a lift with infinite capacity.
Let's do a small scenario with arrivals and multiple users.
We will have 20 users gradually arriving at the ski park (the scenario) for 40 seconds (one every 2 seconds). After that, they will continue skiing for 2 minutes.
The rendez timer is set to 30000 milliseconds. In other words, the first lift will leave 30 seconds after the test starts and repeat in the same interval.
In this example, the first ski lift will leave before everyone arrives at the park. Only about 15 users will have arrived when the first lift departs. So only 15 will get on the lift and execute step 5. Then, the last 5 users will gradually enter the scenario. They will wait for the next lift at step 4 and will be joined by whoever of the other 15 who complete the trip before the next 30 seconds.
Running that scenario, we will observe the following results:
As you can see, every 30 seconds, there is a spike in the number of requests. This means that everyone waited for the lift and executed step 5 every time the 30-second lapse was completed.
The entire k6 script is available in this gist.
Implementing other cases
The functionality of waiting based on the number of virtual users is trickier in a distributed environment. Trust me, I have been giving it several tries and thoughts for a while now… So to keep it easier I am sharing this initial functionality while we figure out how to implement the rest. Some ideas have been over redis, proxies, and locks.
These functionalities are continuous work in progress that can be improved by the community as the need arises.
What do you think? Should the user number functionality be fully implemented? Would you like to contribute? You may have a straightforward idea of how to easily implement the functionality based upon VU arrival rate!
Please comment, suggest, or contribute to my gist example!
For now, I will leave it here, hoping that this helped to start implementing the rendezvous functionality on your k6 scripts.
Happy performance tests and besos! -- Leandro