Api authorizer performance - #947
Merged
greglucas merged 3 commits intoOct 18, 2025
Merged
Conversation
laspsandoval
approved these changes
Oct 17, 2025
laspsandoval
left a comment
Contributor
There was a problem hiding this comment.
The caching will help a lot. Thanks Greg.
| handler=self.api_key_authorizer_lambda, | ||
| response_types=[apigwv2_authorizers.HttpLambdaResponseType.SIMPLE], | ||
| identity_source=["$request.header.x-api-key"], | ||
| # Cache multiple requests with the same API key so we don't |
| handler="lambda_api_key_authorizer.lambda_handler", | ||
| code=lambda_.Code.from_asset("sds_data_manager/lambda_code/authorization"), | ||
| timeout=Duration.seconds(10), | ||
| memory_size=512, # Increase memory for larger network |
Contributor
There was a problem hiding this comment.
How did you come up with this number?
Collaborator
Author
There was a problem hiding this comment.
ChatGPT told me this is a common number. I've used it other places too to get more throughput (1k seems excessive and probably wouldn't be worth the cost). We could go to 256 as well probably. Might be something we play with if needed.
Collaborator
Author
|
Agreed, the caching is the big win I think |
This moves the table instantiation into the main body of the code to cache it in the lambda execution environment. Also inline the simple functions and remove the unnecessary logger.
Multiple requests with the same key will return the same result rather than going through a lambda every time.
We don't care if the tests import things later which enables mocks to be set up before any external imports
greglucas
force-pushed
the
api-authorizer-performance
branch
from
October 18, 2025 01:40
7085448 to
73832c1
Compare
greglucas
merged commit Oct 18, 2025
52ad711
into
IMAP-Science-Operations-Center:dev
2 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Overview
Improve performance of authorization of API Keys
closes #945