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

Caching / rate limiting for API #3479

Closed
Daniel15 opened this issue Feb 18, 2019 · 3 comments · Fixed by #3481
Closed

Caching / rate limiting for API #3479

Daniel15 opened this issue Feb 18, 2019 · 3 comments · Fixed by #3481
Assignees
Milestone

Comments

@Daniel15
Copy link

I just had an issue where my server got a huge number of hits to the /api/v1/status endpoint, which basically killed my PHP-FPM server (it hit the maximum number of workers, preventing people from connecting to any other sites in the same pool).

Does Cachet cache the response to this API call? It would be good to cache its response (even if only for a short period of time, like 30 seconds), so that a large number of hits don't cause any perf issues. If a lot of hits come in at the same time, they could all receive the cached response rather than having to recompute it + hit the DB.

@jbrooksuk
Copy link
Member

Hey @Daniel15! The API endpoints aren't actually cached at the moment, but they definitely should.

Out of interest, where are you using Cachet? I see you all over the place! 😄

@Daniel15
Copy link
Author

Thanks for the reply! In theory I could use Nginx FastCGI caching to cache the endpoint, but it seems like Cachet is sending a Cache-Control: no-cache header, making the content uncacheable. Is there an easy way to modify /api/v1/status to send a caching header? Then I could just configure Nginx to cache it.

@jbrooksuk Cachet is being used for the status page for Yarn: https://status.yarnpkg.com/

@jbrooksuk jbrooksuk added this to the V2.4.0 milestone Feb 19, 2019
@jbrooksuk
Copy link
Member

I've addressed this is a Draft PR, so that we can talk about it there and then get this fixed for you.

Cachet is being used for the status page for Yarn: https://status.yarnpkg.com/

That's where I know you from! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants