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

memcached meta commands support for text protocol #585

Open
TysonAndre opened this issue Mar 9, 2020 · 0 comments
Open

memcached meta commands support for text protocol #585

TysonAndre opened this issue Mar 9, 2020 · 0 comments

Comments

@TysonAndre
Copy link
Collaborator

TysonAndre commented Mar 9, 2020

There have been various extensions to the text protocol starting in memcached 1.5.19, called the "meta protocol", making it on par with the binary protocol.
This is still experimental, but I assume some stable form of it would get added in the near future (https://github.com/memcached/memcached/wiki/MetaCommands), but I'm filing this to

  1. Track the existence of something that users may want as they update their memcache clients and servers months or years in the future, when the meta protocol API is no longer experimental.
  2. Help users searching for whether twemproxy supports meta commands

EDIT: https://github.com/memcached/memcached/wiki/MetaCommands#memcached-text-protocol-meta-commands as of 2021, it's also no longer experimental

NOTE: These commands are new. Please let us know if you run into any trouble with the API or the documentation! The meta protocol is no longer considered experimental, please give it a shot!

I think this is low urgency - I don't think any common clients mandate the meta protocol, but it may improve performance by sending fewer bytes in some cases (haven't read through the protocol to see if there'd be more byte buffer copying with struct mbuf)
(as well as allowing clients to combine multiple commands into one, e.g. get and bump TTL, or to fetch the remaining TTL of a key)

This release contains an experimental new protocol extension for the default
Text Protocol. This extension includes a flexible set of new commands
encompassing features previously unique to the binary protocol, as well as
many new updates allowing a reduction of network roundtrips for advanced
features.
For details, please see the "Meta Commands" section in doc/protocol.txt
https://github.com/memcached/memcached/blob/master/doc/protocol.txt

For use case examples, see the wiki:
https://github.com/memcached/memcached/wiki/MetaCommands

If anyone works on a patch for this, I'd be interested in knowing.

Expected behavior

Support proxying requests from clients sending meta commands in the memcache text protocol, when the API is finalized

Actual behavior

Commands such as mg (multi-get) from https://github.com/memcached/memcached/blob/master/doc/protocol.txt are unsupported
It looks like the parser would need to be updated to allow those commands with a single key in the first position, and any number of flags, and the response parser would need to be updated to recognize the new 2-character response codes and which ones are associated with a value (VA), and so on

EDIT: As of 2021-05-01, this is still experimental. In older 1.5 releases, the protocol was different

According to https://github.com/memcached/memcached/blob/master/doc/protocol.txt this is still experimental in 1.6.9 (this is no longer experimental)

Meta Commands [EXPERIMENTAL: MAY CHANGE]

An example session, with responses manually modified to add > for readability (expires/noexpires are arbitrarily chosen data values for keys with a ttl and with no TTL (T70 = 70 second ttl).

version
> VERSION 1.6.9
ms key T70 S7
expires
> OK
mg key t v
> VA 7 t63
> expires
mg key t v
> VA 7 t57
> expires
ms key S8
noexpire
> OK
mg key t c f h k l q s u v
> VA 8 t-1 c3 f0 h0 kkey l43 s8
> noexpire
TysonAndre added a commit to ifwe/twemproxy that referenced this issue Jun 29, 2021
Note that the meta-text protocol is not marked as stable yet,
but I expect it to be shortly(see memcached/memcached 795)

For twitter#585
@TysonAndre TysonAndre changed the title (Experimental) memcached meta commands support for text protocol memcached meta commands support for text protocol Nov 1, 2022
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