Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface on use of releaseContext and actual use differ, plus use of getContext/releaseContext doesn't seem correct within a worker #1590

Open
davidkel opened this issue Jun 4, 2024 · 0 comments
Labels
bug Something isn't working component/core Related to the core code-base documentation Related to the documentation

Comments

@davidkel
Copy link
Contributor

davidkel commented Jun 4, 2024

In the code and documentation the connector interface for the releaseContext method shows it takes no parameters, yet in the the code we see the worker actually does this

            await this.connector.releaseContext(context);

Also note that a context is both retrieved and released at 2 stages not 1.

  1. In prepareTest of the worker to pass something into the workload module at initialisation time, but is released after that
  2. in executeRound of a worker

Now the concept of the context is a bit vague but it is a way to prepare a connector for execution of a round and this is exactly what the fabric connector does by creating connections then dropping them after the round has finished which makes sense for 2. What doesn't make sense is it's use in 1

If this is about providing a context to the workload module then why is is released at the end of prepareTest ? It would mean that the context provided to the workload module is now not valid as the context created at prepareTest doesn't have to the be same as the context created when the round is executed. In the case of fabric although it won't be the same object, it will be an object that would equate to the one provided to the workload module but contains no useful information really so is irrelevant.

For ethereum, it never does anything in releaseContext, but creates a new context object which provides a lot of information and this may or may not equate to the same object between prepareTest and executeRound.

Given that prepareTest is always done before executeRound, surely it makes sense for the context to be obtained during or before prepareTest and only released after executeRound ? that should provide performance improvements to caliper and the connectors as it means that doing a load or work twice for no reason will be eliminated. It would also mean that the context provided to the workload is actually meaningful.

@davidkel davidkel added bug Something isn't working documentation Related to the documentation component/core Related to the core code-base labels Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/core Related to the core code-base documentation Related to the documentation
Projects
None yet
Development

No branches or pull requests

1 participant