Set Runtime Property Action¶
To understand the purpose of the property action, first we need to talk about properties and their differences with variables.
Variables already do the heavy lifting by providing a lot of options, but variables are local to each Virtual user.
Properties on the other hand are saved on the load generator machine and shared with all other Virtual users running from this machine. You can use the runtime properties screen to edit them at runtime, which is a good way to change your virtual users behavior while the test is running.
The only issue with this is that since OctoPerf will distribute your load automatically, it might be hard to predict how many different load generators will be created and even harder to pass values from one to the other.
That is exactly why we created the Property action:
To add the property, simply pass the name/value of the property to be added.
This action will create or edit the specified property on our API and propagate it to all the users running. It is an effective way of sending a token to all groups of users to login with or any similar mechanism.
Using a property value¶
The syntax to use a property anywhere in your script is as follows: ${__property(sessionToken)}
.
You can use additional settings, for instance ${__property(sessionToken,,defaultvalue)}
this way if sessionToken
doesn't exist, defaultvalue
will be used. Combined with conditions you can make sure to avoid any inconsistencies.
Rate limiting¶
Runtime properties should not be updated from several concurrent users, that would cause concurrency issues because messages queue up on the load generators. Since the same message queue is being used for other technical operations like starting another test, it could block other users or simply make the agent unavailable.
To prevent this we have implemented a rate limitation. If a runtime property is already being updated, it is not possible to send another update until it is finished. If you use one virtual user to send a property to all others this will not have any impact, but in other situations, you may see this in the test logs:
2021-01-28 09:47:09,437 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] key=_sourcePage, value=testestest
2021-01-28 09:47:09,637 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] status code: 409
2021-01-28 09:47:09,739 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] status code: 409
2021-01-28 09:47:09,789 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] status code: 409
2021-01-28 09:47:09,789 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] status code: 409
2021-01-28 09:47:09,790 INFO c.o.SetRuntimeProperty: [SetRuntimeProperty] status code: 409