Hi all, Iā€™m new here. Do you guys have an architec...
# announcements
p
Hi all, Iā€™m new here. Do you guys have an architectue diagram? Iā€™m particularly interested in how feature flag works in details. And how many environments do you support
f
Hi Yang, there's not a great architecture diagram for feature flags yet, but this part of the docs has an overview of how they work - https://docs.growthbook.io/app/features#integration-options
You can add however many environments you want. By default, we create a single "production" environment.
šŸ‘ 1
p
The downside of this approach is that you're adding a network request into your critical rendering path. If the HTTP request is slow (or if the API crashes) for whatever reason, your user experience will suffer.
To overcome this, an idea could be have a cache in browser and a SSE connection between GB and the browser
f
yes, that's possible to add yourself on top of GrowthBook using webhooks and a wrapper around the SDK. We want to add some built-in ways to accomplish this so it's less manual work to set up
One issue to be aware of for SSE is the connection limits, especially if someone has multiple tabs of your site open. Webhooks might be more scalable for that
p
Oh interesting, will check out webhook
f
Sorry, I meant websockets
p
Btw Im from SAP Concur (66mio users), Iā€™m looking for a starting point for future continuous delivery & experimentation platform. Your project is really interesting
Oh I know WebSocket better than SSE
f
p
Another Q is we deploy our SAAS into multiple AWS regions, to get the best response time from app to GB, it is better to have storage (mongdb) close to the app in the region, is there a way to achieve this?
f
I would probably keep the GrowthBook app and Mongo together in a single region. The only part that really needs to be globally distributed are the feature definitions and you can use a distributed cache layer for that
p
Emm this make sense, thx a lot šŸ‘ great work
@future-teacher-7046 what global distributed cache would you recommend for this scenario?
And what if the features json becomes too large so one doesn't want to download the whole features but only the relevant ones, say scoped by project. In this case we would need a service to filter out by project
f
The easiest is probably to use a CloudFront distribution in front of the feature API endpoint. The endpoint already returns proper caching headers, so you don't need anything special in CloudFront.
The feature API endpoint supports scoping by project - https://docs.growthbook.io/app/api#project-scoping
p
Oh nice
That means when we publish to cdns in different aws regions, we distribute one file per project, did I get you right?
f
With CloudFront, it would be more like a reverse proxy. You ask the CDN for features for a specific project and if the region doesn't have a copy yet it will fetch from the origin and cache it. An alternative is a publish step like you mentioned. For that I would use something like S3 instead. GrowthBook could fire a webhook that updates multiple S3 buckets, one in each region
p
I didn't know CloudFront works that way, this could be very useful
Thx Jeremy these are helpful šŸ‘