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

Add a couple of performance benchmark tests #24

Open
Bamieh opened this issue Mar 23, 2022 · 4 comments
Open

Add a couple of performance benchmark tests #24

Bamieh opened this issue Mar 23, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Bamieh
Copy link
Member

Bamieh commented Mar 23, 2022

Given that the underlining Jose package performance might fluctuate between releases it might be a good idea to add some tests to block us from doing upgrades or code changes that degrade performance.

Some additional context: cisco/node-jose#335

Proposed implementation:

A simple way of doing this is to measure the number of decrypts/encrypts the library can do for a minutes duration and a comfortable threshold for failing CI when the threshold is unmet.

  • Real-world scenario: Encrypting and decrypting A 30kb object (the telemetry snapshot object)
  • Basic scenario: Encrypting and decrypting A 1kb object

Node version to use for benchmarking:

Nodejs 12 will automatically adjust the old space size based on the available OS memory. Since we are using version 12 or above in Kibana (and most other users of this package) it makes sense to use nodeJS 12 for running the benchmarks similarly to what we do with running the (unit tests on CI)[https://github.com/elastic/request-crypto/blob/main/.github/workflows/prepare.yml#L17]

It might make sense however to specify the max space size for the node process

@Bamieh Bamieh added enhancement New feature or request good first issue Good for newcomers labels Mar 23, 2022
@ghost
Copy link

ghost commented Oct 13, 2022

@Bamieh
The only telemtry object that I see in this project is a function that calls out to get the object from the endpoint which this case can almost function as an integration test.

async function getTelemetryMetrics() { return fetch(server.telemetryEndpoint); }

@Bamieh
Copy link
Member Author

Bamieh commented Oct 20, 2022

@WingZer0123 yea getTelemetryMetrics is only in the README as an example. The integration tests would look something like that however, it'll basically encrypt an object and then decrypt it.

@ghost
Copy link

ghost commented Oct 22, 2022

@Bamieh I noticed that you are a maintainer of mocha.js. Attempting to reproduce this functionality with in a test case in Mocha has lead to some asyc behavior I am having a hard time getting around. Even with a promises, async/await use setInterval. Do you have any suggestions?

Thanks for collborating.

@Bamieh
Copy link
Member Author

Bamieh commented Oct 26, 2022

Yes, I used to co-maintain mocha.js for a while. Do you mind sharing the code you have so I can take a look? My initial thoughts are that the encryption time varies between runs so it might cause mocha to timeout if not given enough leeway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant