Code Monkey home page Code Monkey logo

location-tracker's Introduction

Location tracker

Consistency-aware durability + Causal consistency

Each object is an independent CRDT (Guarantees eventual convergence of replicas)

Async replication. It means that you can do writes on the primary, and it will replicate writes eventually.

A trade-off between throughput and consistency.

The primary reflects some order of operations

Eventual durability:

  1. Master-acknowledged writes. For each write, the associated entity writes to its local replica, and then using gossip (asynchronously) replicates it to other replicas.
  2. Async replication (To ensure independent and simultaneous progress on various locations) makes writes eventually durable, but enables only weak consistency due to data loss upon failures. If a failure arises before writes are made durable (fully replicated), they can be lost.

Cross-client monotonic read: Every time the system satisfies a query, the value that it returns is at least as fresh as the one returned by the previous query to any client.

Key idea: Shift the point of durability from writes to reads. In other words, data is replicated and persisted before reads are served.

https://github.com/phiSgr/gatling-grpc/blob/master/src/test/scala/com/github/phisgr/example/GrpcExample.scala


http GET 127.0.0.1:8079/rides/cluster/members`

http GET 127.0.0.2:8079/rides/cluster/members`


http GET 127.0.0.1:8079/rides/cluster/shards/vehicles

http GET 127.0.0.2:8079/rides/cluster/shards/vehicles

grpcurl -plaintext 127.0.0.1:8080 list grpcurl -plaintext 127.0.0.2:8080 list

com.rides.VehicleService
grpc.reflection.v1alpha.ServerReflection

grpcurl -plaintext localhost:8080 list com.rides.VehicleService

com.rides.VehicleService.GetCoordinates
com.rides.VehicleService.PostLocation
com.rides.VehicleService.Subscribe

grpcurl -d '{"vehicleId":1,"lon":1,"lat":1.1}' -plaintext 127.0.0.1:8080 com.rides.VehicleService/PostLocation

grpcurl -d '{"vehicleId":5,"version":53}' -plaintext 127.0.0.2:8080 com.rides.VehicleService/GetCoordinates

{
  "vehicleId": "5",
  "point": { "lon": 1, "lat": 1.2 },
  "statusCode": "NotDurable",
  "durabilityLevel": "Majority",
  "versions": { "current": "52", "requested": "53" }
}

grpcurl -d '{"vehicleId":1}' -plaintext 127.0.0.1:8080 com.rides.VehicleService/Subscribe

location-tracker's People

Contributors

haghard avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.