-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feat: Compact metrics #198
Conversation
@vbartusevicius Does this work for you regarding #197? |
As another alternative, consider using a different cache adapter for metrics, for example APCu - metrics are non-critical, so if something gets lost because of a restarting process, nothing really important should be lost (or you can implement a procedure where the metrics bucket gets flushed to server in case of shutdown). By using APCu you would cut the network overhead of Redis and it's not important to have a shared cache for metrics in particular. Alternatively take a look at all the Symfony adapters. You can use something like this (if you use <?php
use Symfony\Component\Cache\Adapter\ApcuAdapter;
use Symfony\Component\Cache\Psr16Cache;
use Unleash\Client\UnleashBuilder;
$unleash = (new UnleashBuilder())
->withMetricsCacheHandler(new Psr16Cache(new ApcuAdapter()))
// your other builder options
->build()
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Would love to see the data on how much denser this is!
Some quick tests I did today: === Toggle amount: 1 === === Toggle amount: 10 === === Toggle amount: 100 === === Toggle amount: 1,000 === === Toggle amount: 10,000 === === Toggle amount: 100,000 === |
Thanks, @RikudouSage - these size savings are amazing. We are patiently waiting for the release, including this improvement! |
@vbartusevicius It was already released a while ago, I just forgot to do the release on GitHub, but composer should have picked up the new version already. |
Description
Instead of serializing the whole object to cache, a simple (and small) string which can be reconstructed to the metrics bucket object is serialized instead. Should massively lower the size of the metrics in the cache storage.
Fixes #197
Type of change
How Has This Been Tested?
Checklist: