-
Notifications
You must be signed in to change notification settings - Fork 67
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
Introduce ability to constrain cache storage by size #116
Comments
We need a database agnostic way of doing this and there's no way to get the table size like that. Also at least for MySQL, the table size wont be reduced unless you re-write the table so even if you can get it, it is useless as a measure for cache size. We could store the total size of the cache values in a separate table, but that's got issues:
So I don't think that's a valid option. A second approach is to store the size as a separate column on each row of the We could try to sample the size column to generate an estimate. If we assigned each row to a random bucket and created an index on I think that will quite often give a fairly accurate estimate. However large sized outliers could be a problem. If we also indexed the size column, we could read the N largest records and use that to adjust our estimate. Will need some thought into how we do that exactly. This probably needs some testing to see how accurate the estimate is across different sets of sizes. There's a couple of other things to note here:
|
See #139 |
To better support constrained environments with low storage for DB's (e.g. Heroku), it would be nice to constraint Solid Cache by size of cache table to ensure that cache will not consume all available space in database.
DHH mentioned this here:
rails/rails#50443 (comment)
The text was updated successfully, but these errors were encountered: