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 allocation counting tests #1150

Merged
merged 1 commit into from
Mar 17, 2021
Merged

Add allocation counting tests #1150

merged 1 commit into from
Mar 17, 2021

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Mar 17, 2021

Motivation:

Memory allocations are a useful tool when evaluating performance. As
such it's useful to have a framework where tests can run continually and
be checked against an expected limit.

Modifications:

There are three groups of related changes in this PR.

First, shuffling existing performance test code so that it may be used
with NIOs allocation counting test framework. This includes dropping the
dependency on the 'EchoModel' target and symlinking in the generated
protobuf and gRPC code services instead. Some of the benchmark code was
split into separate files as well (we'll symlink some code to the
allocation counting test). The 'Benchmark' protocol for the tests now
returns an 'Int' from the 'run' function (a requirement of the NIO
allocation counting test framework).

Second, the addition of various scripts to run allocation counting
tests. These were lifted from SwiftNIO and slightly modified to fit our
use case. As such a NOTICES.txt was also added. Three tests were also
added which make use of code from the existing performance tests. The
shared code is symlinked in (to avoid adding an additional library
product to the package).

Third, the Travis configuration was updated to run the tests on 5.2 and
5.3 on Linux only. A script was also added to parse the output from
running tests and produce an allocation limit.

Result:

We can track our allocation counts.

Motivation:

Memory allocations are a useful tool when evaluating performance. As
such it's useful to have a framework where tests can run continually and
be checked against an expected limit.

Modifications:

There are three groups of related changes in this PR.

First, shuffling existing performance test code so that it may be used
with NIOs allocation counting test framework. This includes dropping the
dependency on the 'EchoModel' target and symlinking in the generated
protobuf and gRPC code services instead. Some of the benchmark code was
split into separate files as well (we'll symlink some code to the
allocation counting test). The 'Benchmark' protocol for the tests now
returns an 'Int' from the 'run' function (a requirement of the NIO
allocation counting test framework).

Second, the addition of various scripts to run allocation counting
tests. These were lifted from SwiftNIO and slightly modified to fit our
use case. As such a NOTICES.txt was also added. Three tests were also
added which make use of code from the existing performance tests. The
shared code is symlinked in (to avoid adding an additional library
product to the package).

Third, the Travis configuration was updated to run the tests on 5.2 and
5.3 on Linux only. A script was also added to parse the output from
running tests and produce an allocation limit.

Result:

We can track our allocation counts.
@glbrntt glbrntt marked this pull request as ready for review March 17, 2021 12:58
@glbrntt glbrntt added the semver/none No version bump required. label Mar 17, 2021
@glbrntt glbrntt requested a review from Lukasa March 17, 2021 12:58
@glbrntt
Copy link
Collaborator Author

glbrntt commented Mar 17, 2021

cc @weissi

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM.

Copy link
Contributor

@weissi weissi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@glbrntt glbrntt merged commit 31003a1 into grpc:main Mar 17, 2021
@glbrntt glbrntt deleted the gb-allocs branch March 17, 2021 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants