location_based_sharding

Crates.iolocation_based_sharding
lib.rslocation_based_sharding
version0.1.4
sourcesrc
created_at2022-01-23 08:34:52.936329
updated_at2022-02-06 09:59:23.845786
descriptionRight sized sharding algorithm
homepage
repository
max_upload_size
id519545
size39,805
Stephen Leyva (srleyva)

documentation

https://docs.rs/location_based_sharding

README

Location Based Sharding Algorithm

Docs.rs

Based off Tinder own location based sharding algorithm, the algorithm will create shards based off of the "heat" of users in a particular location. This flexible sharding schema allows less dense locations to be encompassed in less shards and more densely populated areas to be split in to different shards.

Sharding metadata

When sharding is initiated, it creates shards based off the current user score. These shards need to be persisted in some sort of persistent store or database. This can be used for something like elastic search or location based sharding in any kind of database.

Some trade offs for consideration:

  • Users in dense cities may have to hit multiple shards
  • uses who live on edges may wander across and their information will have to moved across

Example

// This can also be serialized and pulled from Redis
// let geoshards = GeoshardBuilder::from(&json_string_from_ddb)).unwrap();
let geoshards = GeoshardBuilder::user_count_scorer(8, Box::new(vec![].into_iter()), 40, 100).build();
let shard_searcher = GeoShardSearcher::from(geoshards);
let shard_user_is_in = shard_searcher.get_shard_user(some_user);
// Query you index based off the shard ^^^
Commit count: 0

cargo fmt