This PR extends a CLI for user command by ops() and clustering= parameters.
The semantics of parameters:
ops -> defines a ratio with which the operation/queries will be
sampled. For example ops(foo=1,bar=2) means that the tool will
approximately execute 2 bar queries per 1 foo query. These queries
must be defined in the profile yaml.
clustering -> a distribution. The tool will sample a value from
this distribution to decide how many times to execute
current operation/query (which was sampled based on ops). The value
will be treated as a counter. When counter reaches 0, new operation
is sampled, and so, the new value of counter is sampled as well.
The struct that will make use of these parameters is OperationSampler. At first, I wanted to implement it in a way so it can be used for both user and mixed commands. The reason for this is that mixed command supports two analogous parameters: ratio and clustering. However, due to the Rust language limitations it's really hard (or even impossible) to implement the operation sampler this way. CassandraStressOperation trait declares async methods, thus it is not object-safe, and so we cannot create trait objects based on this trait (Box<dyn CassandraStressOperation>).
I decided to leave the code for mixed command as is for now.
Fix: https://github.com/scylladb/cql-stress/issues/80
This PR extends a CLI for user command by
ops()
andclustering=
parameters.The semantics of parameters:
ops
-> defines a ratio with which the operation/queries will be sampled. For exampleops(foo=1,bar=2)
means that the tool will approximately execute 2bar
queries per 1foo
query. These queries must be defined in the profile yaml.clustering
-> a distribution. The tool will sample a value from this distribution to decide how many times to execute current operation/query (which was sampled based onops
). The value will be treated as a counter. When counter reaches 0, new operation is sampled, and so, the new value of counter is sampled as well.The struct that will make use of these parameters is
OperationSampler
. At first, I wanted to implement it in a way so it can be used for bothuser
andmixed
commands. The reason for this is thatmixed
command supports two analogous parameters:ratio
andclustering
. However, due to the Rust language limitations it's really hard (or even impossible) to implement the operation sampler this way.CassandraStressOperation
trait declares async methods, thus it is not object-safe, and so we cannot create trait objects based on this trait (Box<dyn CassandraStressOperation>
).I decided to leave the code for
mixed
command as is for now.