Distributed sequence number generation?

后端 未结 13 1960
小鲜肉
小鲜肉 2020-11-29 14:32

I\'ve generally implemented sequence number generation using database sequences in the past.

e.g. Using Postgres SERIAL type http://www.neilconway.o

13条回答
  •  佛祖请我去吃肉
    2020-11-29 15:13

    Now there are more options.

    Though this question is "old", I got here, so I think it might be useful to leave the options I know of (so far):

    • You could try Hazelcast. In it's 1.9 release it includes a Distributed implementation of java.util.concurrent.AtomicLong
    • You can also use Zookeeper. It provides methods for creating sequence nodes (appended to znode names, though I prefer using version numbers of the nodes). Be careful with this one though: if you don't want missed numbers in your sequence, it may not be what you want.

    Cheers

提交回复
热议问题