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

Proxy Mesowest API calls through backend #35

Open
Syntaf opened this issue Mar 21, 2021 · 0 comments
Open

Proxy Mesowest API calls through backend #35

Syntaf opened this issue Mar 21, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Syntaf
Copy link
Owner

Syntaf commented Mar 21, 2021

Background

Wetrockpolice.com relies on the free tier of the Mesowest API for precipitation observations. Each time a user visits wetrockpolice, we make a call to the Mesowest API for these observations then use javascript to parse out intervals.

Over the last 4 years, the site has organically grown from roughly ~3,000 page views per month during busy season to over 10,000 page views per month today with March 2023 alone generating 20,000 page views.

While this is great news, it does highlight a need to scale the weather API usage before the site is throttled and forced to pay for an enterprise tier.

Implementation

We do know that precipitation observations are generally only updated every 30m or hourly, depending on the weather station being requested. The way I see it we can implement a short term solution followed up by a long term solution

Short Term

Instead of requesting the weather API directly, we can proxy the call behind a WRP api view and apply a micro-cache of 5-10 minutes through a redis instance (which we do have available). This API call can simply forward the data back to the FE.

Long Term

As an improvement of using a micro cache and proxy API, we could configure a cron job that periodically pulls and parses rain interval information to be stored under a new persistence model. This model would represent the result of the parsing and contain easily referenceable information like the last seen rain interval, etc...

@Syntaf Syntaf added the enhancement New feature or request label Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant