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

Cache more responses from the database #780

Closed
tjenkinson opened this issue Feb 22, 2016 · 8 comments
Closed

Cache more responses from the database #780

tjenkinson opened this issue Feb 22, 2016 · 8 comments

Comments

@tjenkinson
Copy link
Member

Things like stream urls and media item cover art files should be cached for a few seconds (or longer) as they don't change very often. Each page request shouldn't result in queries to the db to get information like this.

@tjenkinson
Copy link
Member Author

Laravel's built in cache service provider only allows minutes for cache expiration which is not flexible enough.

@stephenrob
Copy link
Member

Wouldn't minutes be useful for image assets and stream URLs as they are unlikely to change that often and you can expire the cache on the admin side if you change them ?

@tjenkinson
Copy link
Member Author

Maybe. But even just a few seconds would be a lot better than now which ended up being many times a second when there were many requests.

@stephenrob
Copy link
Member

Just thinking about how to make it as simple as possible to implement and setting it to minutes would allow you to use the build in cache service provider.

@tjenkinson
Copy link
Member Author

Yeh. Minutes is too long for things like watching now though. Shouldn't be too complicated to write a separate cache driver that uses redis and allows seconds.

tjenkinson added a commit that referenced this issue Mar 17, 2016
tjenkinson added a commit that referenced this issue Mar 17, 2016
tjenkinson added a commit that referenced this issue Mar 17, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
tjenkinson added a commit that referenced this issue Mar 28, 2016
@tjenkinson
Copy link
Member Author

Can now handle when hitting around 90% cpu

  • 100 requests a second to a player page

  • 100 requests a second to a playlist page

  • 100 requests a second to a show page

  • 100 requests a second to the shows page

  • 100 requests a second to the playlists page

  • 70 requests a second to the player information endpoint. Expecting around 50 requests a second for 800 concurrent viewers

@stephenrob
Copy link
Member

Is that requests able to be made when the server is around 90% CPU or is that the number of requests that cause 90% CPU ?

100 requests a second to a player page

Also is that a figure for just making a request to the player page or as well as making it to the other endpoints as well ?

Reasonable numbers for current use anyway.

@tjenkinson
Copy link
Member Author

All the 100 ones were actually less than 90% but I didn't bother going higher as I don't think it'll ever get that high. People will only generally load a page once then stay on it.

It's 90% cpu as a result of the requests.

The 100 to player page is just getting the html back for the page. The one below is the ajax endpoint that the player periodically makes requests to get it's urls, view count etc.

I don't think we'll go over 800 concurrent viewers but might get a few more cores added to the vm anyway.

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

No branches or pull requests

2 participants