Hi Growthbook team! I’m implementing the sticky b...
# ask-questions
b
Hi Growthbook team! I’m implementing the sticky bucket in the Python SDK. I just want to confirm that when using AbstractStickyBucketService, it’s my responsibility to handle and persist all the data. The GrowthBook server does not handle or store this information, even when using a self-hosted GrowthBook instance GrowthBook doesn’t provide this capability, right? Another question: if I have one server-side SDK and one client-side SDK, both using a self-hosted GrowthBook instance, can they communicate so the client can retrieve the sticky bucket? Or does GrowthBook not support this kind of communication?
👀 2
w
@powerful-spoon-16837 Could you help us here? 🙏
p
Hi! @best-photographer-83931 and @wide-refrigerator-45896 Thanks for your questions. 1. Yes, you're correct - when using
AbstractStickyBucketService
, it is entirely your responsibility to handle persistence. GrowthBook (including self-hosted instances) does not store or manage sticky bucket assignment data on the server side. The GrowthBook server provides the experiment configuration and rules, but the actual sticky bucket assignments are stored and retrieved through whatever service you implement. The Python SDK ships with
InMemoryStickyBucketService
, which is useful for testing but loses all data on process restart. For production, you'll want to implement your own subclass of
AbstractStickyBucketService
backed by a persistent store like Redis, PostgreSQL, DynamoDB, etc. 2. Communication between server-side and client-side SDKs GrowthBook does not provide a built-in mechanism for server-side and client-side SDKs to exchange sticky bucket data directly. However, this is a well-supported pattern that you implement on your side using a shared storage layer. The recommended approaches are: - Cookies (most common): Your Python backend reads/writes sticky bucket data to cookies. On the client side, use
BrowserCookieStickyBucketService
. Since cookies are automatically sent with HTTP requests, both sides share the same data. Make sure to use the same cookie name prefix on both sides. - Shared database / Redis: Your Python backend persists sticky buckets to a shared store (e.g., Redis). Then expose an API endpoint that serves the assignments to the client SDK, which can use them during initialization. - Hybrid: You can wrap multiple strategies (cookies + Redis, etc.) in a custom
AbstractStickyBucketService
implementation. The GrowthBook docs describe this pattern in the "Front-end and Back-end" example using the JS SDK with
BrowserCookieStickyBucketService
on the frontend and
ExpressCookieStickyBucketService
on the backend — the same principle applies to Python + any client-side SDK. Hope this helps! Let me know if you have any further questions.
😁 1
🙌 1
b
Thank you!