Update load generation logic#1582
Conversation
src/test/TestAccount.cpp
Outdated
There was a problem hiding this comment.
Note that current version of updateSequenceNumber on master breaks the code (because of usage of REQUIRE), so this change is copied from bump sequence PR.
748043d to
f4dfeae
Compare
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
It ensures mRoot is set, in case an outside method calls clear before generateLoad.
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
I think that name and return value of this method are misleading.
This method does not return root account, and its return value is never used.
I propose to either:
- rename it to void LoadGenerator::createRootAccount
- make it return
resornullptr, removemRootfield and pass returned value tocreationTransactionas a parameter
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
Never mind, found that case:)
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
It looks for me as if there are 2 different methods hiding inside this loop, one for isCreate == true and one for == false. Or maybe it is even small interface with 2 implementation. Following all those if (isCreate) branches one after another is quite hard.
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
I think it deserves separate method.
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
I think we could just make std::vector return type and result result.
RVO will take care of copying and having that gives us enough information to get the synced value as well.
src/simulation/LoadGenerator.cpp
Outdated
There was a problem hiding this comment.
it is duplicated in CommandHandler, I think we need to extract that to somewhere
src/main/CommandHandler.cpp
Outdated
There was a problem hiding this comment.
what about displaying message that such values of batchSize are illegal?
src/main/CommandHandler.cpp
Outdated
There was a problem hiding this comment.
looks like name of this function is misleading - mode is not Num
|
Thanks for reviewing! Will update the code based on the suggestions. |
|
Looks good to me! |
341d372 to
4888e8e
Compare
|
Marking this PR as dependent on #1533 (for the changes in test accounts) |
1ba4e6f to
ab1f6ff
Compare
src/main/ApplicationImpl.h
Outdated
There was a problem hiding this comment.
typo - function arguments should start with lower case
ab1f6ff to
662d653
Compare
|
r+ 662d653 |
|
@MonsieurNicolas looks like a clang-format issue. Fixed now. |
|
r+ 31a038d |
|
@latobarita: retry |
Update load generation logic Reviewed-by: MonsieurNicolas
-- Description
* Refactor LoadGenerator to achieve the following:
- Create accounts in a separate step
- Be able to batch up to 100 ops/tx
- Create single payments in a separate step
- Deterministically generate destination account based on the source account and its sequence number
- Mark load generation complete after changes are propagated to the DB
- Update tests to use the new load generator
-- Usage
* A user would hit
generateloadendpoint with the following params:- mode [create|pay] - determines accounts creation or payments
- nAccounts - number of accounts to create or use for payments
- nTxs - num payments to perform
- batchsize - when creating accounts, batch multiple ops in a transaction
- txrate - tx/s injestion rate, (num or "auto")
* Note that accounts creations and payments are separate calls to the endpoint