Skip to content

Conversation

@rdh
Copy link
Contributor

@rdh rdh commented Nov 24, 2020

The Split.configuration.cache boolean value will enable in memory caching of infrequently changing values from Redis. Changes to these values will not be reflected until restart, or when Split::Cache.clear is called.

Copy link
Contributor

@amangup amangup left a comment

Choose a reason for hiding this comment

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

I think for merging it to main branch, we need to make a few more changes, but for us it works (except the winner caching). I will test it out.

@rdh
Copy link
Contributor Author

rdh commented Nov 24, 2020

I think for merging it to main branch, we need to make a few more changes, but for us it works (except the winner caching). I will test it out.

Yeah. I'm not sure about disable_metrics either. In our world, saw a lot of read-only access, but I think that may not be appropriate for wider usage. May back that one out and eat the Redis spam.

@andrehjr andrehjr self-assigned this Nov 24, 2020
@andrehjr
Copy link
Member

andrehjr commented Dec 3, 2020

Thanks for working on this ✨

I haven't tested this fully, but I like where this is going.

I have some plans to reduce/refactor some calls on split codebase to reduce the amount of Redis calls. But until that happens, having this cache around would be nice.

@rdh
Copy link
Contributor Author

rdh commented Dec 3, 2020

Thanks for working on this ✨

I haven't tested this fully, but I like where this is going.

I have some plans to reduce/refactor some calls on split codebase to reduce the amount of Redis calls. But until that happens, having this cache around would be nice.

Happy to contribute. We use your gem like crazy. Have about 50+ experiments and we're bucketing into every experiment on every request, due to some dubious architectural choices.

We just pushed this logic cherry-picked onto 3.4.1 to our production servers today, and our average Redis burn dropped from ~60m to ~30ms. Still too high, but a lot better ;-)

@andrehjr
Copy link
Member

andrehjr commented Dec 3, 2020

Awesome, good to know @rdh ! I wanna release v4 soon, this PR would be a great addition :)

@rdh
Copy link
Contributor Author

rdh commented Dec 4, 2020

OK. I've added minimal docs, so this is discoverable. I think this PR hangs together, and is already doing good stuff for us. I think it's mergeable "as is" and can convert to real PR, if you're cool with it.

Some possible additions:

  1. If you know of any other places that are obvious candidates for caching, I'm happy to wrap them. I just hit the biggest offenders in our app, but suspect there may be other relatively static bits of data we could cache.

  2. We discussed adding a TTL for cache entries. I'm fine with "until reboot", and feel like the TTL would add complexity. Would prefer to defer that to a later PR.

  3. I feel like the README on this is MVP. Happy to take another swing at wordsmithing, if you'd like a bit more detail?

@andrehjr
Copy link
Member

andrehjr commented Dec 4, 2020

  1. If you know of any other places that are obvious candidates for caching, I'm happy to wrap them. I just hit the biggest offenders in our app, but suspect there may be other relatively static bits of data we could cache.

I'll review it fully tomorrow, and I'll let you know if find anything else. I think it's ok to convert to a PR too.

  1. We discussed adding a TTL for cache entries. I'm fine with "until reboot", and feel like the TTL would add complexity. Would prefer to defer that to a later PR.

Agreed. It's also disabled by default. We can improve it later

  1. I feel like the README on this is MVP. Happy to take another swing at wordsmithing, if you'd like a bit more detail?

I think it's fine for now 👍

@rdh rdh marked this pull request as ready for review December 4, 2020 22:05
@andrehjr andrehjr merged commit 35b5259 into splitrb:master Dec 7, 2020
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.

3 participants