https://www.growthbook.io/ logo
q

quiet-monkey-7986

03/31/2023, 12:19 PM
Hey you all; I need some help :3 What are some best practices for configuring CDN caching when using GrowthBook for experimentation? Are there any specific settings or configurations that we should be aware of to ensure that experiment variations are properly cached and displayed to our users?
f

fresh-football-47124

04/01/2023, 2:34 AM
Hi Pedro - it depends a lot on your specific goals. You can set a long cache and use server send events to expire it (like our proxy does) or use a webhook. You can also just set a shortish TTL and let new experiments/flags expire within that time.
q

quiet-monkey-7986

04/03/2023, 4:36 PM
Hey Graham, thank you for your answer. What do you guys recommend to ensure that cached variations do not leak across experiments or between users? Cookies?
f

fresh-football-47124

04/04/2023, 4:54 AM
GrowthBook uses deterministic hashing, so as long as your hashing attribute is the same, they’ll get the same variation - how you store that ID is up to you, typically its from a cookie, but not managed by us (or you, really) - often it comes from GA or the event tracker
❤️ 1
q

quiet-monkey-7986

04/06/2023, 12:49 PM
Hey Graham, is there a way to get this hash?
f

fresh-football-47124

04/06/2023, 12:50 PM
From the SDK?
q

quiet-monkey-7986

04/06/2023, 1:00 PM
From the SDK?
Yep.
f

fresh-football-47124

04/06/2023, 1:41 PM
No, I don’t think it’s exposed in the eval features
But you can run the hashing fn yourself if you need the number
q

quiet-monkey-7986

04/06/2023, 2:07 PM
Thank you so much for your answer and attention, Graham.
@fresh-football-47124 getting back with the subject. I was thinking of using the polyfill to set the featureFlags at the cookie and use it to cache at CDN (https://docs.growthbook.io/lib/js#nodejs) Using it, we would have the CDN caching it through the
gbFeaturesCache
. The CDN will deliver then the static files cached (already rendered on the server with the experiments) to whoever needs them. What do you think? By the way, we are using nextjs.