-
Notifications
You must be signed in to change notification settings - Fork 370
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
test: add perf metrics utilities for write 1 / read 3 #1855
Conversation
This is dependent on worker_threads which is not available until we drop node 10 support. Marking it as do not merge in the meantime. |
96380eb
to
b1ad619
Compare
|
||
const randomInteger = (minInclusive: number, maxInclusive: number) => { | ||
return ( | ||
Math.floor(Math.random() * (maxInclusive - minInclusive + 1)) + minInclusive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a comment or rename randomInteger to specify Uniform Distribution is expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const sizeInBytes = generateRandomFile(fileName); | ||
|
||
const stg = new Storage({ | ||
projectId: 'ddelgrosso-test', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to supply this value if it comes from ServiceAccount.json file. I would remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed and made configurable from command line.
appBufferSize: BLOCK_SIZE_IN_BYTES, | ||
libBufferSize: 16384, //Node default | ||
crc32Enabled: false, | ||
md5Enabled: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't validation not used for uploads? I thought it was enabled by default for uploads. Python and Go validate checksums on upload as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it uses same as download now.
@@ -0,0 +1,157 @@ | |||
/*! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend creating a README.md similar to Python to clarify this is for dev team usage:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
} else if (checkType === 1) { | ||
iterationResult.crc32Enabled = true; | ||
start = performance.now(); | ||
await file.download({validation: 'crc32c'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does crc32c
validation in this case expect that nodejs-storage is using the fast-crc32c
package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't expect anything. Validation is currently being offloaded to another library. If fast-crc32c is available it will use it, if not it uses its own logic. See here: https://github.com/stephenplusplus/hash-stream-validation/blob/0aa27468552a2b12cff1813b5ef63ecb4e903621/index.js#L5
const checkType = randomInteger(0, 2); | ||
if (checkType === 0) { | ||
start = performance.now(); | ||
await bucket.file(`${fileName}`).download({validation: false}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per meeting: download to file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
op: 'WRITE', | ||
objectSize: sizeInBytes, | ||
appBufferSize: BLOCK_SIZE_IN_BYTES, | ||
libBufferSize: 16384, //Node default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assign 16384
to a constant variable and link to the where this is defined in the Node.js library for future us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
b1ad619
to
22c14b7
Compare
|
||
bucket = stg.bucket(argv.bucket, { | ||
preconditionOpts: { | ||
ifGenerationMatch: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should go on bucket.upload() call no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we implemented preconditions due to constraints with common (i.e. we couldn't pass preconditions per function), we had to pass them at the constructor level. One of the upcoming refactors with internalizing common is adding the ability to pass these per function. If you look at the code below these lines you will see I re-declare the bucket as necessary to remove the preconditions where appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I literally just spoke with @shaffeeullah and she clarified this as well (in-person no way!!); thanks for clarifying, it will get better just didn't realize this was a trade off with not internalizing common. It's okay, not great but at least it's possible to pass in the precondition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed mostly for code clarity. Will lean on @frankyn to take a closer look at the functionality.
internal-tooling/README.md
Outdated
@@ -0,0 +1,44 @@ | |||
# nodejs-storage benchmarking | |||
|
|||
**This is not an officially supported Google product** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change This is not an officially supported Google product
to This is not a supported Google product
. It's not unofficially supported either.
internal-tooling/README.md
Outdated
|
||
**This is not an officially supported Google product** | ||
|
||
This benchmarking script is used by Storage client library maintainers to benchmark various workloads and collect metrics in order to improve performance of the library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This benchmarking script is used by Storage client" -> "This benchmarking script intended for use by Storage client"
parentPort?.postMessage(results); | ||
} | ||
|
||
async function performWriteReadTest(): Promise<TestResult[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: add a small docstring for each function
I've repointed this at the |
@frankyn any further comments? I would like to get this merged for release with the drop in support for node 10. |
* test: add performance measuring * add threading support to performance tests * linter fixes * rename folder * add precondition to uploads, write to file for downloads * fix pathing * review feedback * linter * disable no unsupported features error now node 10 is unsupported * add jsdoc headers
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕