Skip to content

Speed up base64 encoding of certs and keys#14405

Merged
chrisvest merged 2 commits intonetty:4.1from
chrisvest:4.1-ssl-base64
Oct 22, 2024
Merged

Speed up base64 encoding of certs and keys#14405
chrisvest merged 2 commits intonetty:4.1from
chrisvest:4.1-ssl-base64

Conversation

@chrisvest
Copy link
Copy Markdown
Member

Motivation:
Our SSL tests spend a lot time encoding certs and keys to their PEM representation, which involves base64 encoding. Our tests also run with leak detection enabled, which may trace on every buffer write. That's very slow.

Modification:
When possible, do our base64 encoding through a flattened unpooled buffer. Unpooled buffers don't have leak detection attached to them. We also ensure that our writes only go through a single buffer layer.

Result:
Our netty-handler tests, many of which involve SSL, now run much faster.

Motivation:
Our SSL tests spend a lot time encoding certs and keys to their PEM representation, which involves base64 encoding.
Our tests also run with leak detection enabled, which may trace on every buffer write.
That's very slow.

Modification:
When possible, do our base64 encoding through a flattened unpooled buffer.
Unpooled buffers don't have leak detection attached to them.
We also ensure that our writes only go through a single buffer layer.

Result:
Our netty-handler tests, many of which involve SSL, now run much faster.
@chrisvest
Copy link
Copy Markdown
Member Author

I suspect this will be big enough to show on the average CI build times.

@chrisvest
Copy link
Copy Markdown
Member Author

Compared to other recent 4.1 PRs this cuts 10-20 minutes off the build time.
This PR: https://github.com/netty/netty/actions/runs/11412536221/usage?pr=14405
Compared to #14391: https://github.com/netty/netty/actions/runs/11192014567/usage

Copy link
Copy Markdown
Contributor

@franz1981 franz1981 left a comment

Choose a reason for hiding this comment

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

Great finding!

@chrisvest
Copy link
Copy Markdown
Member Author

@normanmaurer @franz1981 Updated.

@chrisvest chrisvest merged commit d0d4a51 into netty:4.1 Oct 22, 2024
@chrisvest chrisvest deleted the 4.1-ssl-base64 branch October 22, 2024 20:06
chrisvest added a commit that referenced this pull request Oct 22, 2024
Motivation:
Our SSL tests spend a lot time encoding certs and keys to their PEM
representation, which involves base64 encoding. Our tests also run with
leak detection enabled, which may trace on every buffer write. That's
very slow.

Modification:
When possible, do our base64 encoding through a flattened unpooled
buffer. Unpooled buffers don't have leak detection attached to them. We
also ensure that our writes only go through a single buffer layer.

Result:
Our netty-handler tests, many of which involve SSL, now run much faster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants