Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
/ sfc Public archive

Implementation of singleflight-cluster. With zk + consistenthash. Also has herd watch call prevention. Intended as an exercise, and example for future work

License

Notifications You must be signed in to change notification settings

aarondwi/sfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sfc

Implementation of singleflight-cluster.

By default, it uses consistent hashing on top of zookeeper + kazoo to handle service discovery and use falcon web framework for backend server.

All of the parameters are duck-typed, so you can look at the example implementation if you want to use another implementationn.

This implementation is eventually consistent, in which during any request lifetime, the instances known to each one may be different, but the force_this_node paramater is used on backend call path, so it would never live-locking, calling each other believing the other is still the rightful owner. This approach works because zookeeper will return a snapshot of instances, in which the requested node might be the rightful owner of the key, one time in the past.

If disconnected from zookeeper for too long (in kazoo term, SUSPENDED or LOST), after a specified disconnected_timeout (default 60s), the instance will no longer be valid and start rejecting request, to prevent further membership drifting

See tests/core.py for example on how to initialize and use this implementation.

About

Implementation of singleflight-cluster. With zk + consistenthash. Also has herd watch call prevention. Intended as an exercise, and example for future work

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages