sharded_counter

package module
v0.0.0-...-b635e71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

sharded_counter

Go Google App Engine scalable sharding counters.

Copied from appengine articles

...it is important to note that you can only expect to update any single entity or entity group about five times a second

If you had a single entity that was the counter and the update rate was too fast, then you would have contention as the serialized writes would stack up and start to timeout. The way to solve this problem is a little counter-intuitive if you are coming from a relational database; the solution relies on the fact that reads from the App Engine datastore are extremely fast and cheap. The way to reduce the contention is to build a sharded counter – break the counter up into N different counters.

Sharding counter is an alternative solution for count the number of votes in a poll, the number of comments, or even the number of visitors to your site.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(c context.Context, name string) (int, error)

Count retrieves the value of the named counter.

func IncreaseShards

func IncreaseShards(c context.Context, name string, n int) error

IncreaseShards increases the number of shards for the named counter to n. It will never decrease the number of shards.

func Increment

func Increment(c context.Context, name string) error

Increment increments the named counter.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL