Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My boss recently asserted, in conversation, that Redis supports some configuration options for controlling maximum key or key/value sizes ... so we could set some option to prevent our applications from creating keys or key/value pairs larger than, say, 50KB.

My impression is that no such option exists and that we'd have to patch the sources and build our own to add such feature. (For this question forcing the applications programmers to mediate all access through Lua scripts or through something like twemproxy would NOT be an option).

Did I miss something in the Redis: Documentation somewhere?

Also what are the best practices for failover these days? Is Redis Sentinel ready for prime time? Is the Linux-HA OCF Heartbeat/Pacemaker/Cluster Glue trio still the best for this?

share|improve this question

Pretty sure no such feature exists. All you can limit is an instance's total footprint with maxmemory.

But, it'd be tricky to enforce the limit in a way that made sense - I'd argue that working with the application developers to use Redis in a way that makes sense, instead of kicking an error when their value size goes over an arbitrary boundary, is better. (Why would you want to have this kind of limit, anyway - what's a large key or value hurting?)

Redis doesn't seem to be very interested in preventing people from shooting themselves in the foot; FLUSHALL or DEBUG SEGFAULT are right there at your fingertips.

For failover, I've been hammering on the new version of Sentinel and it seems solid - some rough edges, but on the whole it works as expected. Probably going to start using it in production on a limited basis soon.

share|improve this answer
From some vague hearsay: we've had some very large keys (set by one application component) cause issues (in other components unwittingly receiving the unexpectedly large values) and also when re-syncing the slaves to the masters. – Jim Dennis Jan 5 '14 at 6:51
Perhaps we could find a enhanced (PHP) Redis library to enforce the limits? – Jim Dennis Jan 5 '14 at 6:51
@JimDennis Yeah, or tweaking the existing PHP libraries to add the limits, which would definitely be preferable to tweaking Redis itself.. but, the best solution to a badly behaving application is always to get the application behaving correctly. – Shane Madden Jan 5 '14 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.