Closed sevenjay closed 5 years ago
That's a good question! I'v never loaded clientid/username/password combos from resource files like that. Did you scan the examples from MZBench a little? https://github.com/mzbench/mzbench/tree/master/examples.bdl Maybe there's a hint there.
Pinging @parsifal-47 hi... :) maybe you have an idea on this? (looking for a way to loop through a resource file)
that is correct, you may access various resource rows to get credentials for your users, you may use loop iterator for that if you have equal number of iterations to users or you may use randomized access. https://github.com/mzbench/mzbench/blob/master/doc/scenarios/spec.md#iterator https://github.com/mzbench/mzbench/blob/master/doc/scenarios/spec.md#random_number
The only problem if you have big number of these (for example 10^6), you may start to suffer from List access O(N)
complexity.
Thank parsifal-47 and sorry I am newbie with erlang and MZBench. Would you help me to show a grammar to get a value from list by order like below?
include_resource(tsv_resource, "resource_data.tsv", tsv)
pool(size = 5,
worker_type = dummy_worker):
tempRow = round_robin(resource(tsv_resource)) #BDL grammar error
print(sprintf("Client ~p, ID is ~p, password is ~p", tempRow[1], tempRow[2], tempRow[3])) #BDL grammar error
np! the example you gave looks almost valid, first just in case, don't forget shebang at the beginning, second -- there are no assignments and no direct list accessors,
please try running the following:
include_resource(tsv_resource, "resource_data.tsv", tsv)
pool(size = 5,
worker_type = dummy_worker):
print(sprintf("Client creds are ~p", round_robin(resource(tsv_resource))))
or
include_resource(tsv_resource, "resource_data.tsv", tsv)
pool(size = 5,
worker_type = dummy_worker):
print(sprintf("Client creds are ~p", choose(resource(tsv_resource))))
please let me know if you have questions
There are no assignments and no direct list accessors
So it's impossible to extract all value from each index of the list? Or may be we can put info into a list of client like "clientInfoList", and set it to vmq_mzbench? @ioolkos Could it be like below?
make_install(git = "https://github.com/erlio/vmq_mzbench.git",
branch = "master")
include_resource(tsv_resource, "resource_data.tsv", tsv)
pool(size = 100,
worker_type = mqtt_worker,
worker_start = poisson(10 rps)):
connect([t(host, "test-mqtt"),
t(port,1883),
t(clientInfoList, round_robin(resource(tsv_resource))),
t(clean_session,true),
t(keepalive_interval,60),
t(proto_version,4), t(reconnect_timeout,4)
])
set_signal(connect1, 1)
wait_signal(connect1, 100)
wait(4 sec)
loop(time = 10 sec, rate = 1 rps):
publish("test/broadcast", "THIS IS A TEST", 0)
disconnect()
your listing looks valid, yes restructuring or structure conversions supposed to happen inside worker operations
its possible to use many user accounts on test auth to run? I have a tsv file like below:
I can print a random one row by:
but how to put all accounts into test scenario?
just in "client001-100", I cannot find a way to extract the value from the list. there is no operator [] like resource(tsv_resource)[1][1]