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

reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws auth method #22583

Merged
merged 15 commits into from Aug 28, 2023

Conversation

elliesterner
Copy link
Contributor

@elliesterner elliesterner commented Aug 28, 2023

The main purpose of this PR is to reduce calls to c.DetermineRoleFromLoginRequest in order to reduce the latency of login requests.

Benchmarking results:
Main mean: 704.492117ms:
image

Main with changes from PR mean: 341.443427ms:
image

Vault v1.10.4 mean: 180.187269ms:
image

Fixes #21441.

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Aug 28, 2023
@elliesterner elliesterner marked this pull request as draft August 28, 2023 15:54
@github-actions
Copy link

CI Results:
All Go tests succeeded! ✅

@elliesterner elliesterner added this to the 1.15 milestone Aug 28, 2023
@elliesterner elliesterner marked this pull request as ready for review August 28, 2023 16:32
@elliesterner elliesterner changed the title reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws aut… reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws auth method Aug 28, 2023
@github-actions
Copy link

Build Results:
All builds succeeded! ✅

changelog/22583.txt Outdated Show resolved Hide resolved
vault/login_mfa.go Outdated Show resolved Hide resolved
vault/request_handling.go Outdated Show resolved Hide resolved
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
vault/request_handling.go Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
```release-note:improvement
Copy link
Contributor

Choose a reason for hiding this comment

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

I think technically, we can changelog this as bug, since it's a performance regression from past versions that we're fixing.

changelog/22583.txt Outdated Show resolved Hide resolved
@elliesterner elliesterner added backport/1.14.x Backport changes to `release/1.14.x` backport/1.13.x Backport changes to `release/1.13.x` backport/1.12.x labels Aug 28, 2023
changelog/22583.txt Show resolved Hide resolved
@elliesterner elliesterner merged commit cccfdb0 into main Aug 28, 2023
102 checks passed
@elliesterner elliesterner deleted the reduce-role-resolves-part1 branch August 28, 2023 21:01
elliesterner added a commit that referenced this pull request Aug 28, 2023
…h method (#22583)

* reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws auth method

* change ordering of LoginCreateToken args

* replace another determineRoleFromLoginRequest function with role from context

* add changelog

* Check for role in context if not there make call to DeteremineRoleFromLoginRequest

* move context role check below nanmespace check

* Update changelog/22583.txt

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* revert signature to same order

* make sure resp is last argument

* retrieve role from context closer to where role variable is needed

* remove failsafe for role in mfa login

* Update changelog/22583.txt

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
elliesterner added a commit that referenced this pull request Aug 29, 2023
…h method (#22583)

* reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws auth method

* change ordering of LoginCreateToken args

* replace another determineRoleFromLoginRequest function with role from context

* add changelog

* Check for role in context if not there make call to DeteremineRoleFromLoginRequest

* move context role check below nanmespace check

* Update changelog/22583.txt

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>

* revert signature to same order

* make sure resp is last argument

* retrieve role from context closer to where role variable is needed

* remove failsafe for role in mfa login

* Update changelog/22583.txt

---------

Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
elliesterner added a commit that referenced this pull request Aug 29, 2023
…h method (#22583) (#22594)

* reduce calls to DetermineRoleFromLoginRequest from 3 to 1 for aws auth method

* change ordering of LoginCreateToken args

* replace another determineRoleFromLoginRequest function with role from context

* add changelog

* Check for role in context if not there make call to DeteremineRoleFromLoginRequest

* move context role check below nanmespace check

* Update changelog/22583.txt



* revert signature to same order

* make sure resp is last argument

* retrieve role from context closer to where role variable is needed

* remove failsafe for role in mfa login

* Update changelog/22583.txt

---------

Co-authored-by: Ellie <ellie.sterner@hashicorp.com>
Co-authored-by: Nick Cabatoff <ncabatoff@hashicorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.13.x Backport changes to `release/1.13.x` backport/1.14.x Backport changes to `release/1.14.x` hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increased Latency in Auth Calls after Upgrading to Vault 1.13.1
4 participants