What are the ways to make sure features can be still served if FH server goes down? #1036
-
For example, could we store values somewhere like S3 bucket? Or are there any other ways? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
While our recommended way to deal with this is to use Fastly, if you are running your own FeatureHub service and don't wish to use Fastly and are happy with non-realtime events, the way that all of our SDKs are designed is to separate the Repository (which holds the features and which your application talks to) from the way that data is received. The functions of the repository are here: https://docs.featurehub.io/featurehub/latest/sdks-development.html#_a_feature_repository For example, you could write a webhook listener that updates your s3 bucket locations with the updated features as they come in. You could then easily grab the feature state from the bucket, hand it over to the repository and then connect to FeatureHub. If FeatureHub goes away at anytime, the SDK clients will continue to request data as long as they don't get a 4xx response from the server. We built an example application for servers that would only start if FeatureHub was up and was able to swap over to something else in the meantime. The process uses the Android SDK (which is a simple GET based API with a URL that could be easily emulated by s3) to grab the initial state and then fall back to SSE once started. That example is here: https://github.com/featurehub-io/featurehub-java-sdk/blob/main/examples/migration-check/src/main/java/io/featurehub/migrationcheck/Main.java |
Beta Was this translation helpful? Give feedback.
So they are all (except Golang) basically the same.
When you get the webhook, you can just save the data into a bucket with a filename like .json - and ensure its the same format as the Edge API (I think its pretty close, I can't remember exactly).
To make the SDK work for you, you just basically need to implement a simple interface that is the new Edge connector. You can if you want just talk directly to S3 or use it to call the proper endpoint and if that fails, call S3, your choice. All it does is pass the data it receives lock-stock into the repository. From there on, its just fully standard use case.
For each SDK, they have a "config" which ties together the "repository" (where the s…