[Tsung] Dynamic vars and module initialization

Vincent Bernat bernat at luffy.cx
Wed Nov 27 21:26:42 CET 2013

 ❦ 27 novembre 2013 21:18 CET, Rodolphe Quiédeville <rodolphe at quiedeville.org> :

>> I am pretty new to Tsung and Erlang. I would like to extract data from a
>> MySQL database to build POST requests to be used by Erlang. 
> It may be dangerous to do that if you plan to play with high rate, the
> bottleneck will be mysql IMHO.

I can scale the MySQL on multiple slaves if needed.

>> I cannot
>> afford to put the whole requests in memory because they are pretty
>> big. I need to initiliaze ODBC, prepare and execute the request and then
>> each time the function is called, pop a result. I have come with this
>> code to do this:
>>   https://gist.github.com/7681851
>> However, how could I tell Tsung to call `elasticsearch:start()` at the
>> beginning of the test to spawn the processes?
> What about patch the tunsg bash script used to launch tsung or just do
> an alias which will start elastic search and start tsung just after ?
> You can have a look to escript may be.

Maybe you think that `elasticsearch:start()` is to start Elasticsearch,
but no, it is to initialize my elasticsearch module that is used through
dynamic variables `%%elasticsearch:search%%` and
`%%elasticsearch:autocomplete%%`. The `start()` function will spawn two
SQL processes that will give a JSON request to be executed at each call
to `search()` or `autocomplete()`.
Don't stop with your first draft.
            - The Elements of Programming Style (Kernighan & Plauger)

More information about the Tsung-users mailing list