-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow connection to a gRPC server in the init context #2719
Comments
Sorry for the super-long delay in responding, I forgot to do so earlier in the week 😞 We don't want to implement features that require network connections in the init context, for a few important reasons:
So, we'd prefer to keep VU initialization as side-effect free as possible. What you can do instead is to use the import grpc from 'k6/net/grpc';
import exec from 'k6/execution';
const client = new grpc.Client();
client.load(/* ... */);
export default () => {
if (exec.vu.iterationInScenario == 0) {
client.connect(/* ... */);
}
client.invoke(/* ... */);
// ...
// Do NOT close the client
}; It's not a great workaround, since it will increase the |
Thank you for the detailed reply. At least we can get a lower bound on performance 🙂 I'm really loving this tool. And thank you for the workaround, we'll give it a shot. |
Feature Description
When performance testing a gRPC server, it would be ideal if k6 allowed grpc::connect to be called in the init context so that the channel can be reused for the same VU across iterations. As noted here:
Enabling this would make for more realistic performance tests.
Any thoughts on whether this might be feasible?
Suggested Solution (optional)
No response
Already existing or connected issues / PRs (optional)
No response
The text was updated successfully, but these errors were encountered: