Skip to main content

RESP2/RESP3 and Valkey compatibility

The RESP gateway listens on 127.0.0.1:6380 by default and supports RESP2 and RESP3 framing. Existing redis-cli, valkey-cli, and many RESP clients can connect without an SDK.

redis-cli -h 127.0.0.1 -p 6380 PING
redis-cli -p 6380 SET session:1 active EX 60
redis-cli -p 6380 GET session:1

Enable RYME_RESP_PASSWORD for password authentication. Use the dedicated resp_tls_listen listener with TLS rather than exposing plaintext RESP.

Implemented command families​

FamilyCommands and behavior
Strings/keysGET, SET, SETNX, GETSET, GETEX, GETDEL, MGET, MSET, APPEND, STRLEN, DEL, EXISTS, TYPE
ExpiryEXPIRE, PEXPIRE, EXPIREAT, PEXPIREAT, TTL, PTTL, EXPIRETIME, PEXPIRETIME, PERSIST
CountersINCR, DECR, INCRBY, DECRBY, INCRBYFLOAT
HashesHSET, HGET, HDEL, HEXISTS, HLEN, HGETALL, HKEYS, HVALS
ListsLPUSH, RPUSH, LPOP, RPOP, LLEN, LRANGE, BLPOP, BRPOP, BLMOVE
SetsSADD, SREM, SMEMBERS, SCARD, SISMEMBER
Sorted setsZADD, ZSCORE, ZRANK, ZREVRANK, ZRANGE, ZREM, ZCARD, ZCOUNT, ZINCRBY
StreamsXADD, XRANGE, XREVRANGE, XLEN, XTRIM, XREAD, XDEL, XGROUP, XREADGROUP, XACK, XPENDING, XAUTOCLAIM, XINFO
ScriptingSandboxed Lua 5.4: EVAL, EVALSHA, SCRIPT LOAD, SCRIPT EXISTS, SCRIPT FLUSH, PCALL
TransactionsMULTI, EXEC, DISCARD; staged writes commit atomically
Pub/subSUBSCRIBE, UNSUBSCRIBE, PSUBSCRIBE, PUNSUBSCRIBE, PUBLISH, PUBSUB
OtherSCAN, KEYS, HyperLogLog, geospatial commands

EXPIREAT uses an absolute Unix timestamp in seconds; PEXPIREAT uses Unix milliseconds. Relative EXPIRE/PEXPIRE and SET EX/PX plus GETEX EX/PX use precise relative deadlines. PXAT absolute values retain millisecond precision. PTTL reports remaining milliseconds; TTL reports whole seconds and may return 0 while a key has less than one second remaining. Existing persisted expiry timestamps remain readable. EXPIRETIME and PEXPIRETIME return absolute expiry timestamps; both return -1 for a persistent key and -2 for a missing or expired key. Expiry conditions NX, XX, GT, and LT are mutually exclusive; repeated or conflicting conditions return a syntax error without changing the key.

The exact compatibility suite is in crates/ryme-wire-resp/tests/. Unsupported option combinations should be treated as errors, not silently assumed to have Redis semantics.

Request limits​

Each incoming RESP command is limited to a 1 MiB frame, including RESP framing bytes, and may contain at most 1,024 arguments. Larger commands are rejected before bulk arguments are copied into command storage. This is a deliberate resource bound; clients sending large values should split the data or use another gateway with a suitable request limit. Commands invoked inside Lua scripts use the same argument-count and encoded frame limits as network commands. RESP command names and inline commands must be valid UTF-8; array bulk-string arguments remain binary-safe. Commands may be split across TCP reads; incomplete frames remain buffered until the rest of the command arrives, subject to the frame and process-wide memory limits. RESP connections use 16 KiB read buffers and share a 256 MiB process-wide budget for read buffers and pending framed input. A connection is closed if it cannot reserve input memory from that budget. SCAN returns at most 10,000 matching keys and 16 MiB of key bytes per call; KEYS uses the same result limits and returns an error if the keyspace matches more. Scan pages read four records at a time to bound temporary memory. MGET returns an error when the combined value bytes exceed 16 MiB. PUBSUB CHANNELS returns an error when matched channel names would make the response exceed 16 MiB. Pub/sub shares a 64 MiB budget for retained messages and another 64 MiB budget for concurrent socket writes. Delivery is best effort: local PUBLISH returns an error when the retained-message budget is full, and cluster or subscriber delivery may drop messages under memory pressure or when a receiver falls behind.

Transaction notes​

Commands inside MULTI execute against one transaction. A queue is limited to 10,000 commands and 16 MiB per connection; active queues also share a 256 MiB process-wide memory budget. A command rejected by these limits marks the queue dirty, so EXEC aborts. Blocking list and stream reads wake on commits and take a fresh transaction for each check. The aggregate EXEC reply is limited to 16 MiB; exceeding it aborts the transaction before commit. Queued EXPIRE and PERSIST commands plus TTL/PTTL queries evaluate keys and deadlines against earlier staged writes in the same MULTI transaction. Sorted sets use score ordering with lexicographic member tie-breaks. Stream consumer groups and pending entries are persisted with the stream document.

RESP writes publish to the same tenant-scoped CDC path as SQL and REST writes; the realtime page explains how to consume them.