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

Added response compression to data routes #196

Merged
merged 2 commits into from
Dec 22, 2022
Merged

Conversation

MilanDonhowe
Copy link
Contributor

This PR also helps to address #123 by reducing the response size returned by the Lambda API for the /allbuildings /data and /batchData routes.

Previous to this PR, allbuildings had a response size of 167kb (167,451 bytes). With Brotli compression it's 3kb (3341 bytes).

This PR does require shifting these routes from using AWS's REST API calls to using AWS's HTTP API calls (both of them use http, the name difference is just how amazon distinguishes the services) which means we won't have any fancy AWS caching out-of-the-box, but I expect the speed-up from compression will overcome that particular deficiency.

Copy link
Contributor

@solderq35 solderq35 left a comment

Choose a reason for hiding this comment

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

I can confirm that the response size is only 3kb (looking at inspect element > network > allbuildings) when run locally.

@solderq35 solderq35 merged commit 39f436d into master Dec 22, 2022
@solderq35
Copy link
Contributor

Note so we don't forget: The changes from this PR were later reverted due to CORS issues. Namely, HttpAPI which was used for compression seems to cause CORS errors, so we removed compression and added back API route

Revert commit: 5dbc348

CORS error screenshot
CORS error screenshot

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.

2 participants