Search code examples
pollingconfigcat

How ConfigCat webhooks would work in application running behind load balancer?


There are 4 instances of an application running behind a load balancer. How the ConfigCat webhook would work in this case? Do we need to configure 4 public URL's for all 4 servers in webhook settings?


Solution

  • Could you share some details about your use case? What would you like to achieve with webhooks? What kind of SDK are you using? What is the polling mode?

    If you want to refresh the SDK's cache on Feature Flag value changes, you should consider using a distributed cache implementation (e.g. redis). Example custom cache in Java: https://configcat.com/docs/sdk-reference/java#custom-cache If you implement a custom distributed cache, you'll only need to add your load balancer's url to the webhook because refreshing the cache in one instance will refresh the cache in the distributed cache so all of your instances could work with the latest configurations.

    If you want to get notified about changes in each applications, there are different possibilities:

    • You can configure 4 public urls and use the webhooks just like you mentioned it.
    • If you are using auto polling mode, you can skip the webhooks part and start using the SDK's built-in configuration changed callbacks. e.g. in java: configurationChangeListener part at https://configcat.com/docs/sdk-reference/java#auto-polling-default. When the auto poll mode's polling happens the SDK detects if the configuration changed and it fires this event.

    If you could share more details I could help you more.

    Disclaimer: I am one of the founders of ConfigCat.