0

i'm wondering what could be the best approach to have a world-wide distribute web-application config-synched.

For example, imagine we are using .NET. Suppose also i'm not using web.config for app settings, but an isolated cofngig file (or a NO-SQL DB) where i will put specific app configuration like static servers urls, email templates etc.

I would like to edit a configuration and make sure all servers (in any country) will receive this modification as soon as possible and that if a server is DOWN, it will apply modification as soon as it is back online.

I think it is the worst thing to centralize the configuration in a single server and make all app-server take each time the config from the 'config-server' - latency and other problems could break the entire system.

I imagined something like caching (each server try to donwload once the config from the config server and cache the value until it exipres) but this would bind the config distribution to the expiration lapse....

What do you think is the best approach to this?

Alex
  • 1,237
  • 3
  • 18
  • 29

2 Answers2

0

There are multiple possible approaches, but you don't provide enough information to weigh the tradeoffs.

  • How fast is "as soon as possible"? Is 1-5 seconds OK? how about 30?
  • How many machines need to be kept in sync?
  • How often does the configuration change?

For example, one relatively simple approach would be to keep a version or timestamp value which uniquely identifies the current configuration. This would be cached on the config server so it would be very cheap to query, and the app servers could check the value frequently (every few seconds) to see whether they need to refresh their configurations. That way they are making frequent cheap calls, and only incur the expense of copying data when the configuration has actually changed.

The "end all" approach would be to use a gossip protocol, but that is a significant effort which (based purely on this question) is probably beyond your current skill level.

Addys
  • 2,461
  • 15
  • 24
  • 1) i intended fast like immediate... <1sec 2) 20 to 100 3) 0 to 2 times per day I know about gossip protocol. I never wanted to influence answers... I also agree that it would be a significant effort to implement, especially for sync pieces of data in a NoSql DB. Your simple solution partially mirrors the example i wrote in my question... Is there some other approach that give good results with less efforts/complications of a gossip protocol? – Alex Feb 07 '12 at 23:33
  • OK so now we are getting somewhere: ~100 machines which require sub-second latency. That clarifies the requirements quite a bit. For that scenario I would go with persistent connections and have the central server push notifications to the consumers. So as each consumer comes up it would register with the config server, and receive a callback whenever the config changes. There are endless implementation options for this pattern - via TCP, or using a messaging infrastructure (MSMQ, azure service bus), etc – Addys Feb 13 '12 at 00:08
  • Is there any open source project aiming to solve this problem? – andy May 25 '15 at 13:52
0

DNS

alphazero
  • 27,094
  • 3
  • 30
  • 26