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

Adding a harness for session resumption in regression test #4706

Merged
merged 45 commits into from
Aug 20, 2024

Conversation

kaukabrizvi
Copy link
Contributor

@kaukabrizvi kaukabrizvi commented Aug 13, 2024

Description of changes:

This PR adds a new regression test for measuring session resumption performance in the s2n-tls library. The test, test_session_resumption, performs an initial handshake without a session ticket and then attempts to resume the session using a session ticket in a subsequent handshake. The test is integrated with the valgrind_test function, allowing Cachegrind instrumentation to measure the performance of the session resumption process.

Call-outs:

  • The test is currently focused on the performance of the session resumption process, and it does not cover other aspects of session ticket handling, such as expiration or rotation.
  • The valgrind_test function is used to start and stop Cachegrind instrumentation around the resumption handshake, ensuring that only the resumption process is measured. This allows for accurate performance analysis specific to session resumption.
  • Currently the pair.client.session_ticket() call is left out of the instrumentation measurement since that occurs in the first handshake.

@kaukabrizvi kaukabrizvi marked this pull request as ready for review August 14, 2024 18:38
tests/regression/README.md Outdated Show resolved Hide resolved
tests/regression/README.md Outdated Show resolved Hide resolved
tests/regression/src/lib.rs Outdated Show resolved Hide resolved
#[test]
fn test_session_resumption() {
valgrind_test("test_session_resumption", 0.01, |ctrl| {
const KEY_NAME: &str = "InsecureTestKey";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd vote for moving the constants into the top level scope of the function.

.add_session_ticket_key(
KEY_NAME.as_bytes(),
KEY_VALUE.as_slice(),
SystemTime::now(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Clock skew will cause this to sometimes be flaky, because the system clock will sometimes jump in time.

Suggested change
SystemTime::now(),
SystemTime::now() - Duration::from_secs(10),

@kaukabrizvi
Copy link
Contributor Author

The regression test will fail since mainline doesn't have the session resumption test yet. Typically changes to solely the regression test will not trigger the test to run but since I changed the .gitignore file (exists outside the regression crate) in a recent commit, the test still runs on this PR.

.gitignore Outdated Show resolved Hide resolved
Co-authored-by: James Mayclin <maycj@amazon.com>
@jmayclin jmayclin merged commit 787db8a into aws:main Aug 20, 2024
35 of 36 checks passed
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