So recently I got into trouble running Redis on a host, because the data no-longer fits into RAM.
As an interim measure I fixed this by bumping the RAM allocated to the guest, but a real solution was needed. I figure there are three real alternatives:
- Migrate to Postgres, MySQL, or similar.
- Use an alternative Redis implementation.
- Do something creative.
Looking around I found a couple of Redis-alternatives, but I was curious to see how hard it would be to hack something useful myself, as a creative solution.
This evening I spotted Protocol::Redis, which is a perl module for decoding/encoding data to/from a Redis server.
Thinking "Ahah" I wired this module up to AnyEvent::Socket. The end result was predis - A perl-implementation of Redis.
It's a limited implementation which stores data in an SQLite database, and currently has support for:
- get/set
- incr/decr
- del/ping/info
It isn't hugely fast, but it is fast enough, and it should be possible to use alternative backends in the future.
I suspect I'll not add sets/hashes, but it could be done if somebody was keen.
Tags: blogspam, redis 2 comments
I don't see how this could possibly be a memory savings unless you're not actually storing anything in the perl process, which is really the antithesis of the point of redis.