We want to provide a proxy to users of GrowthBook who can deploy to their infrastructure which will take care of keeping the feature list updated in almost real time. To do that we can make use of webhooks. This will have the added benefit of all services calling GrowthBook API frequently.
The proxy needs to support both use case of polling based data fetching and webhook based data fetching. GB users should be able to select only the polling based or only the webhook or even be able to enable both if they wanted to.
Every time there’s a new data, it’d be nice if we could send out an update to clients based on websocket. This would mean, with the combination of webhook based data and websocket, a change in feature config would reflect instantly.
When using webhook, if the proxy is scaled out in any way (in a lot of situation people use minReplica: 2
) webhook would require some shared state.
In addition to that, let’s say it’s running in both webhook and polling mode. Once we get a webhook, it shouldn’t rewrite the state with cached data from CDN if the CDN hasn’t refreshed yet.
To solve the shared state challenge, we can try one of the following
To solve the problem of maybe data being out of date through CDN, we can try one of the following:
I propose to declare dependency on non HA redis. This will help by doing two things. The pubsub mechanism of redis will allow us to do websockets more easily. It will also solve the problem of shared state as well as it makes it easy to solve the CDN cache problem.