facebook / facebook/hhvm

Add `getMulti` to `mcrouter` extension

Open
#9,009 1 comment 1 reaction 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

**Is your feature request related to a problem? Please describe.**
`memcached` (and `mcrouter` since it also implements the `memcached` spec) allows multiple keys to be provided to the `get` and `gets` commands which in turn will return multiple results. ([Protocol Reference](https://github.com/memcached/memcached/blob/master/doc/protocol.txt#L296))

However, the API offered by the HHVM Extension for McRouter only has a single-key `get` method implemented. ([HHVM Docs](https://docs.hhvm.com/hack/reference/class/MCRouter/get/))

However, the `memcached` extension included in HHVM _does_ include a `getMulti` which offers this functionality. ([phpdoc reference](https://www.php.net/manual/en/memcached.getmulti.php))

**Describe the solution you'd like**
It'd be great if the `mcrouter` HHVM extension also offered a binding for `getMulti` to bring parity with the `memcached` extension.

**Describe alternatives you've considered**
Two main alternatives

1. Keep using `mcrouter` but just only with single-key fetches
This is a fine workaround and what I've been doing for now. But just thinking longer-term, it's not exactly ideal to have to make a single request per key fetched from memcached when potentially dozens of objects might be fetched (e.g. to load a feed).

2. Switch to the `memcached` extension instead of `mcrouter`
This is what I will probably wind up doing if I eventually need this functionality. `mcrouter` is nice but I'm definitely not working at such a scale where I need its functionality more than vanilla `memcached`'s

**Additional context**
I'd be happy to work on this in spare time. I'm sure the core team has more important things to tackle. I mostly want to make sure there isn't anything in the pipeline that'll jeopardize the value of embarking on this work on my own e.g. if the `mcrouter` extension were gonna be wholesale replaced or something.

Contributor guide

Open the contributing guide

Research direction

Start by locating the mcrouter extension's existing `get` binding and compare it with the `memcached` extension's `getMulti` API and the referenced memcached protocol behavior. Done means the mcrouter HHVM extension exposes equivalent multi-key fetching and returns multiple results consistently with the existing memcached extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.