java - Using Spring Cloud to implement a Global Lock -


i have requirement implement sequence generating service such runs multiple instances of service in n number of data centers (vm or baremetal machines). following rules service regardless of instance of service called (from of data centers):

  • all sequences must unique
  • a sequence number cannot skipped (i.e. cannot generate 2 before 1, etc)
  • if instance of service goes down (or complete data center) others must able handle requests , conform previous 2 rules.
  • must able serve @ least 200,000 sequences per day.

i've thought lot of different solutions, comes down sort of distributed service locking. spring cloud claims have sort of "global lock", however, don't see real description or implementation example. open other solution (except apache zookeeper).

i toyed idea of running each service behind rabbitmq , letting each service notify others when 1 running, doesn't seem efficient.

we haven't released yet, can follow progress of https://github.com/spring-cloud/spring-cloud-cluster has concept of locks implemented various technologies.


Comments