Skip to content

Instantly share code, notes, and snippets.

@sofianhamiti
Created April 12, 2021 23:40
Show Gist options
  • Save sofianhamiti/aba9ab85f8b4fb724049eea14ca2ccf2 to your computer and use it in GitHub Desktop.
Save sofianhamiti/aba9ab85f8b4fb724049eea14ca2ccf2 to your computer and use it in GitHub Desktop.
try:
logging.info('LOAD TESTING THE API')
stats = run_load_test(host=api.api_endpoint)
# get response time percentiles
response_time_percentile = stats['requests']['POST_/']['response_time_percentiles'][95]
logging.info(f'REPONSE TIME PERCENTILES: {response_time_percentile}')
logging.info(f'LAMBDA MEMORY: {args.lambda_memory}')
# we create this aggregate score to optimize both latency and lambda memory allocation (cost)
aggregate_score = int(args.lambda_memory) * response_time_percentile
logging.info(f'AGGREGATE SCORE: {aggregate_score}')
except Exception as e:
logging.error(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment