Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: AllSizeRoute #180

Open
amcrn opened this issue Mar 8, 2017 · 0 comments
Open

Feature Request: AllSizeRoute #180

amcrn opened this issue Mar 8, 2017 · 0 comments

Comments

@amcrn
Copy link

amcrn commented Mar 8, 2017

I have a feature request for a new Route: AllSizeRoute.

Properties:

  • size: max or min

Immediately sends the same request to all child route handles.
Collects all replies and responds with the size reply.

For numbers => min == smallest reply value (e.g. If 0, 5, & 14 came back, return 0)
For numbers => max == largest reply value (e.g. If 0, 5, & 14 came back, return 14)

  • If all replies are errors, returns the last error.
  • If all replies are not numbers, returns an error.
  • If some replies are not numbers, return the size reply of those that are numbers.

Why:

If using mcrouter to create a highly-available (replicated, no spof)
counter cluster, where counters can only increase, no existing routes
can return the largest value from all child route handles. The best
that can be achieved at the moment (afaik) is:

{
  "pools": {
    "main": {
      "servers": [
        "memcached1:11211",
        "memcached2:11211",
        "memcached3:11211"
      ]
    }
  },
  "route": {
    "type": "OperationSelectorRoute",
    "operation_policies": {
      "add": "AllFastestRoute|Pool|main",
      "get": {
        "type": "MissFailoverRoute",
        "children": [
          "AllMajorityRoute|Pool|main",
          "AllFastestRoute|Pool|main"
        ]
      },
      "incr": "AllFastestRoute|Pool|main",
      "decr": "AllFastestRoute|Pool|main"
    }
  }
}

Using AllMajorityRoute on get ensures that a missed incr on
one memcached doesn't impact the returned value, but it's far from
bullet proof (ex: if incr is applied only on 1 of the 3, it undercounts).

Note: Concept could be extended to Strings (Min/Max == Smallest or
Longest value length (e.g. "foo" < "foobar").

Note: size option list could be extended to include median, avg,
95th%, etc.

If there's already a better way of achieving this, please let me know,
I might have missed an available Route (or a clever way of composing
them). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant