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

prehistoric-waitress-6977

05/06/2022, 1:15 PM
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

future-teacher-7046

05/06/2022, 1:18 PM
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

prehistoric-waitress-6977

05/06/2022, 2:34 PM
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

future-teacher-7046

05/06/2022, 2:39 PM
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

prehistoric-waitress-6977

05/06/2022, 2:43 PM
Oh interesting, will check out webhook
f

future-teacher-7046

05/06/2022, 2:44 PM
Sorry, I meant websockets
p

prehistoric-waitress-6977

05/06/2022, 2:46 PM
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

future-teacher-7046

05/06/2022, 2:52 PM
p

prehistoric-waitress-6977

05/06/2022, 2:53 PM
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

future-teacher-7046

05/06/2022, 2:57 PM
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

prehistoric-waitress-6977

05/06/2022, 2:59 PM
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

future-teacher-7046

05/08/2022, 1:27 PM
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

prehistoric-waitress-6977

05/08/2022, 1:28 PM
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

future-teacher-7046

05/08/2022, 1:33 PM
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

prehistoric-waitress-6977

05/08/2022, 1:34 PM
I didn't know CloudFront works that way, this could be very useful
Thx Jeremy these are helpful šŸ‘