-J
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
>
>
If/when Redis server-side scripting is done, I can imagine a syntax
where this kind of thing wouldn't be unreasonable (and I would already
have a few different use-cases for it), but I also think that
simplicity is a goal worth striving for.
- Josiah
2010/10/20 Marcus <gwebmas...@yahoo.com>:
> Yeah, I can see how this could be problematic. This users will request
> lists of sets, hashes of lists, lists of lists, etc, etc. It could be
> never ending.
>
I guess it's all about what languages you use. I find Redis' use of
data structures restrictive (but sufficient to solve problems with a
little bit of work), but I come from a Python world where arbitrary
structure embedding is easy, free, and expected. When I was using C++
STL, I would have seen Redis as a life-saver (it is now, but for
different reasons).
> complete the evolution, wherein basic and interesting data structures in any
> programming language could be mapped, in completely language-natural ways,
> to a shared memory space, and operated upon with complete confidence in
> atomicity.
> The number of lines of code would actually go down with this approach - e.g.
> note the current redundancy between top level memcached-like hash (SET/GET)
> and the proposed approach, where both are handled by the same set of code.
> This also seems to provide the opportunity to reconcile issues around
> concepts like volatile keys and VM: For VM, if there's no such thing as a
> "top-level key", and if any key at any level can point to something stored
> on disk, then the efficiency of VM can go way up (How many times have we
> seen an entire huge zset get pulled into memory because we only needed one
Sadly, it's not that easy with a ZSET. If you are looking something
up by rank, you need to traverse down your log(n) levels to get to the
proper leaf. If you are looking something up by member, you need to
pull the hash entry and potentially all of the items in the bucket.
During modification, you have to update pointers of adjacent skiplist
nodes for the old and new location. Also, if the values in a ZSET can
be of arbitrary type (number, string, list, set, hash, zset, ...) you
run into sorting issues trying to determine a total ordering of all
values.
I know Redis isn't Python, but Python has at least two applicable zens
in this scenario:
Simple is better than complex.
Flat is better than nested.
> score?). As for keys - if there's no such thing as a level, then the data
> structure currently known as a Hash could contain keys which have
> expirations, and so on.
That would make expiration fairly painful from an accounting
perspective, as every item to be expired would basically need to be
tracked in a zset. :/
Also, the thing to remember is that in order to operate on something
in a nested way, you first need to select the parent item. There is a
reasonable syntax for doing this, but it basically requires performing
an implicit or explicit reset when the final operation is performed.
> It could also be a way to approach clustering: If a "value" is a tuple of
> (type, location), where location could be VM, host/port, etc., then that
> provides a very viable way to distribute redis.
> The changes required to the current code base would likely break all
> clients, perhaps even at a protocol level (in much the same way redis broke
> the memcached protocol). None of this is likely to be in or get into the
> "trunk" any time soon. But it might be an interesting fork, and certainly
> seems worth some discussion.
Well... memcached has a protocol. Redis, being a different piece of
software, chose a different protocol of a specific design. If a
future Redis changes the protocol in such a way to support these kinds
of structures, then it's not like memcached -> Redis, it is Redis X ->
Redis Y.
That said, there is a Python almost-work-alike of Redis that can be
very easily modified to support these kinds of operations (and it
speaks the Redis protocol), which would make for a much faster method
of exploring things. The only annoying part is that Python doesn't
have a fast equivalent of a ZSET, though heapq.merge +
itertools.groupby can get most of the way there.
Regards,
- Josiah