Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

A simple application that demonstrates two approaches to sharding counters in Java.

License

Notifications You must be signed in to change notification settings

GoogleCloudPlatform/appengine-sharded-counters-java

Repository files navigation

Sharded Counters for App Engine Java

A simple application that demonstrates two approaches to sharding counters.

To achieve higher throughput across different instances, counters should be sharded to avoid concurrency issues. This application performs this in two different ways:

  • Simple Sharding: Uses a constant to define the number of shards and randomly picks an index up to this number when incrementing the counter. Each shard is stored in the datastore using one of these indices as ID.

  • General Sharding: Stores the number of shards in the datastore and randomly picks an index up to this number when incrementing the counter. Each shard is stored in the datastore using one of these indices as ID, but also using a counter name as an ancestor.

Products

Language

APIs

About

A simple application that demonstrates two approaches to sharding counters in Java.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •