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

Remove the in-memory cache #6037

Merged
merged 4 commits into from
Jan 11, 2021
Merged

Remove the in-memory cache #6037

merged 4 commits into from
Jan 11, 2021

Conversation

paulmelnikow
Copy link
Member

@paulmelnikow paulmelnikow commented Jan 8, 2021

Shields has long had an in-memory cache with some complex logic for determining when the cached values are used and when they are flushed. At the time this was implemented, squeezing cache performance was helpful since there was no downstream cache. For years now we've used Cloudflare as a CDN, so trying to cache onboard is less useful than before. Furthermore, since the cache is very small and only used in fairly restrictive ways, it probably has very little impact on performance.

This feels like "step one" in addressing #3368 and #4655, as it's disabling most of the complicated behavior in the existing request-handling code.

In addition, #3368 is a dependency for #3328, and given issues like badges/sc#5 (a DOS vulnerability in Shields), ScoutCamp feels like a liability. Getting the train rolling toward #3328 feels useful.

There was some discussion on this in the ops meeting today. This change is slightly experimental (I think there is maybe a 1% chance it causes a serious problem) but it's easy enough to roll back if it does.

Ref #3368

@shields-cd shields-cd temporarily deployed to shields-staging-pr-6037 January 8, 2021 20:06 Inactive
@shields-ci
Copy link

shields-ci commented Jan 8, 2021

Warnings
⚠️ This PR modified service code for maintenance but not its test code.
That's okay so long as it's refactoring existing code.
⚠️ This PR modified service code for debug but not its test code.
That's okay so long as it's refactoring existing code.
Messages
📖

Thanks for contributing to our documentation. We ❤️ our documentarians!

📖 ✨ Thanks for your contribution to Shields, @paulmelnikow!

Generated by 🚫 dangerJS against 0a252d1

// be cached _downstream_. This is governed by cache headers, which are
// configured by the service, the user's request, and the server's default
// cache length.
module.exports = class NonMemoryCachingBaseService extends BaseService {
Copy link
Member Author

Choose a reason for hiding this comment

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

This class only existed to dodge the cache behavior which is being removed herewith. The two services using this can now use BaseService directly.

@paulmelnikow paulmelnikow temporarily deployed to shields-staging-pr-6037 January 8, 2021 20:13 Inactive
Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

For years now we've used Cloudflare as a CDN, so trying to cache onboard is less useful than before

Also helps that we require traffic to ingress via cloudflare (no more possibility of hitting badge servers directly).

Changes LGTM, though image the merging and deployment of this one will be done at a predetermined time so the experiment can be executed in isolation for clean observation.

I assume we'll want to keep an eye on the overall request load and uncached requests hitting the backend, with a reference to trending response time to see what, if any, impact this has from the removal.

May be interesting to see if there's any minor drop in memory usage too, though don't expect much on that front

@paulmelnikow
Copy link
Member Author

I just deployed the last commit to master and could merge and deploy this one next. We could give it the weekend and maybe Monday morning for observation, and roll back if necessary.

@paulmelnikow paulmelnikow temporarily deployed to shields-staging-pr-6037 January 10, 2021 16:17 Inactive
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.

4 participants