Add start/duration options to the defined activity configuration
Closed this issue · 5 comments
Describe desired feature
Currently when you are defining specific activity you can only define an interval and amount. It would be helpful to be able to pick a start time and duration so that some nodes are sending transactions at different times throughout the simulation.
Use case for feature
For example:
This activity definition would tell Alice to send 2000 msats every second, starting 10 seconds after the simulation starts and ending after 30 seconds. In other words, Alice would send Bob 30 transactions between 10 and 40 seconds in the simulation.
"activity": [
{
"source": "Alice",
"destination": "Bob",
"start": 10,
"duration": 30
"interval_secs": 1,
"amount_msat": 2000
}
]
Would you like to contribute code for this feature?
I am interested and hope to contribute toward this feature.
I think this would be a very nice feature!
"start": 10,
"duration": 30
Small user-experience related question: WDTY about count
rather than a duration
so that we can save the end user some calculation? I would imagine that people know how many of this type of payment they want and then calculate the duration from that anyway. But defer to your pref since this is a feature that you want/ I know no better!
One thing we'd need to think about in the context of the project is handling shutdown if we have a set of these activitiesf and they all finish. Currently doing some refactoring in #164 to neaten up all of our shutdown mechanics, so it shouldn't be difficult (it should just be handled because the producer/consumer will drop, but just flagging it because we've got tasks flying all over the place and it's easy to lose track).
Yes I like count
better! I think that makes more sense from a user's perspective. I will start looking into implementing this in conjunction with the performance testing I am doing on LND. This will be helpful for my testing because I would like to have varying levels of transaction traffic throughout the simulation and observe the performance difference. So it would be great if I could set some activity to start later in the sim and then maybe drop off at some point.
I will also check out #164 and make sure this effort fits into that refactor. Thanks!
I will start looking into implementing this in conjunction with the performance testing I am doing on LND.
Sounds great!
I am going to try to make this feature backwards compatible with older sim.json
files. In other words.. the start
and count
values will not have to be defined in the sim.json
file.
The count
attribute will be an Optional<u64>
where None
means that the payment activity will continue for the full length of the simulation. If count
is not provided in the sim.json
file it will have a default value of None
.
The start
attribute will be a Duration
and its default value will be 0, meaning the payments will start as soon as the simulation starts.
@carlaKC Any issues with that implementation? Trying to avoid making users re-create their simulation files.
Any issues with that implementation?
SGTM!