mlab-ns-rate-limit

module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0

README

Build Status Coverage Status

mlab-ns-rate-limit

Rate limiting support for mlab-ns.

Memcache Conventions

mlab-ns-rate-limit writes request signature probabilities directly to memcache. And, within the same project, mlab-ns is able to read request signatures back from memcache.

Because mlab-ns-rate-limit is written in Go, and mlab-ns is written in Python, and memcache exposes a generic byte array in Go but a type-aware serializer for Python, the two services cannot parse each other's data without adopting a shared convention.

In our case, we use base 10, ASCII encoded integers, which encode fixed point decimal values with precision up to 0.0001. For example, to encode a probability value of 0.5, mlab-ns-rate-limit will:

  • string(0.5 * 10000) -> "5000"

And, mlab-ns would read this value as:

  • int("5000") / 10000.0 -> 0.5

Directories

Path Synopsis
appengine
rate_table
Package rate_table contains the top level app-engine code to create datastore and memcache entries to control mlab-ns rate limiting.
Package rate_table contains the top level app-engine code to create datastore and memcache entries to control mlab-ns rate limiting.
Package endpoint contains stats for client endpoints.
Package endpoint contains stats for client endpoints.

Jump to

Keyboard shortcuts

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