This is an educational project to show a simple Uber backend architecture.
1.git clone
from master
2.npm install
to install all dependencies
3.git submodule update --init
to install s2-geometry-library
1.node simpleuber/simple_uber.js -n geo_sharding -s 3
to run three nodes on local address
2.node simpleuber/simple_uber.js -n geo_sharding2 -s 3 -p 3003 -b '["127.0.0.1:3000"]'
to add three nodes into cluster (known bug: could not add into cluster that is runnign on different ip address)
3.curl -X GET '127.0.0.1:6000/loc?lat=10&log=20'
to test geo-based sharding
You should get this Ringpop 127.0.0.1:3000 handled direct request { lat: '10', log: '20' } in cell 1236273900560580608
4.curl -X GET '127.0.0.1:6000/loc?lat=10&log=22'
to test another geo-based sharding
You should get this Ringpop 127.0.0.1:3001 handled forward request { lat: '10', log: '22' } in cell 1236947351432593408
In near future, I'm going to...
-
Add different requests to this backend system to implement Uber's most basic features, including updating drivers' location/status, handling riders' requests.
-
Use Riak as a backup database to increment fault-tolerance.
-
Add business when adding/removing nodes so to make full use of consistent hashing.
-
Use Kafka as streaming information provider and gatherer.
To know more about uber's backend architecture, checkout this tech talk.
Here are some good references for...
A number-theoretic approach to consistent hashing
SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protoco