Rate limiting support for mlab-ns.
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:
And, mlab-ns would read this value as: