https://www.growthbook.io/ logo
#announcements
Title
# announcements
b

billions-arm-13894

11/14/2022, 2:08 PM
hi all! is there a recommended way of handling the case when self-hosted (or any) growthbook service goes down and other services rely on it? the naive solution is to hardcode fallback values in the codebase but is there any other option?
f

future-teacher-7046

11/14/2022, 2:12 PM
We recommend persisting the features JSON in a database or cache system (e.g. Redis) instead of fetching it directly from the GrowthBook API. Then, use webhooks or simple polling to keep the cached copy up to date.
b

billions-arm-13894

11/14/2022, 4:25 PM
thank you, that seems reasonable! we placed aws api gateway in front of the instance but it doesn't persist cache if the instance goes down. we'll probably have to go with the approach you mentioned
f

future-teacher-7046

11/14/2022, 4:27 PM
The features endpoint does send a
stale-if-error
header, which should tell cache layers to serve a stale copy if the back-end goes down. I'm not sure about API Gateway, but I know CDNs like CloudFront support that automatically.
b

billions-arm-13894

11/15/2022, 9:10 AM
hmm didn't know about that. it might work for us then! will take a look
38 Views