Lua: All content tagged as Lua in NoSQL databases and polyglot persistence
Friday, 27 April 2012
Lua Scripting in Redis 2.6
The top comments on Hacker News about Redis 2.6 RC are about Lua scripting.
Lua scripting! Once people figure out what Redis’ Lua scripting is good for, and it gets in a stable release, it’s going to set the world on fire. In a good way.
When one of the services I work on was having huge performance problems, and nothing I did seemed to make it fast enough, I realized that the main data-manipulation logic — previously a combination of Python and SQL — could be rewritten as a Lua script in Redis. I learned the basics of Lua in about an hour, migrated the data over to Redis, made the necessary changes to the code, and everything worked beautifully. Months of crippling speed problems vanished in a single long day.
Redis 2.6 saved my ass. Now, when I need to store data, it’s always one of the first things to come to mind, since I know I can count on it to be fast, solid, and flexible enough to do all sorts of things.
Going through myNoSQL archives, the first mention of Lua scripting support in Redis is from May 2nd, 2011. Salvatore Sanfilippo already wrote of some advanced functionality that would be possible using it, but I expect many more ideas to come out once Redis 2.6 is released.
Original title and link: Lua Scripting in Redis 2.6 (©myNoSQL)
Tuesday, 20 March 2012
Reinventing Reliable Queues With Redis Lua Scripting
Salvatore Sanfilippo:
Redis 2.6 support for Lua scripting opens a lot of possibilities, basically because you can do atomically a lot of things that before required to pay a big performance hit.
In this blog post I want to show a pattern based on the scripting capability that can be used to implement reliable queues.
I know I might upset a few people, but this feels like reinventing some wheels. Having server-side scripting support in Redis makes it a possible good fit for many new use cases, so I don’t think there’s a need to reinvent solutions that can already address an even wider range of scenarios.
Original title and link: Reinventing Reliable Queues With Redis Lua Scripting (©myNoSQL)
Thursday, 15 March 2012
Redis Lua Scripting Is Badass
TJ Holowaychuk:
Lua is a great fit for Redis, they have similar philosophies, being simple, small, and fast.
Hell yeah! I almost can feel it!
Original title and link: Redis Lua Scripting Is Badass (©myNoSQL)
via: http://tjholowaychuk.com/post/19321054250/redis-lua-scripting-is-badass
Friday, 2 December 2011
Redis: What's Coming in the Next Releases
Salvatore Sanfilippo details the features planned for Redis’ near/mid-term future:
- Lua scripting support (Redis 2.6)
- High resolution expires (Redis 2.6)
- Performances improvements when reading/writing big objects (Redis 2.6)
- Redis cluster (Redis 3.0)
> Redis Cluster is a distributed implementation of a subset of Redis standalone. Not all commands will be supported, especially we don’t support things like multi-key operations. In general we are just implementing the subset of Redis that we are sure can be made working in a solid way in a cluster setup, with predictable behaviors.
>
> Redis cluster will stress consistency in favor of ability to resist to netsplits and failures in general. - Replication improvements (Redis 3.0 or post 3.0)
- Persistence improvements (post Redis 3.0)
The post also mentions a very useful gem:
Redis with both AOF and RDB enabled is very durable already, and this is the setup we suggest
Original title and link: Redis: What’s Coming in the Next Releases (©myNoSQL)
Monday, 23 May 2011
LRU Reverse-proxy with Nginx, Redis, and Lua
Enter the nginx modules Redis2 and Lua. The former allows you to make any call you like to Redis, as opposed to HttpRedis which only allows the plain old GET command. The latter allows you do embed Lua scripts in your nginx config, effectively giving nginx a bigger brain and allowing you to do some pretty fancy stuff. In this post we’ll set nginx and redis up to serve as a reverse-proxy LRU cache.
Don’t forget there’s also a Redis with Lua support branch.
Original title and link: LRU Reverse-proxy with Nginx, Redis, and Lua (NoSQL databases © myNoSQL)
via: http://mikeferrier.ca/2011/05/14/my-beautiful-dark-twisted-reverse-proxy-LRU-cache/
Friday, 13 May 2011
An update on Redis and Lua
Salvatore Sanfilippo:
So the scripting feature will be limited to what you can do with vanilla Lua, and with the redis() command that lets you interact with Redis of course, and a few standard additions that will be registered by Redis in the Lua interpreter (so you know every Redis instance with scripting support contains this features by default), basically:
- Bitops lua library, that is, bitwise operations. Not a part of vanilla Lua.
- A Json library.
- SHA1
As one commenter clarified Lua require, dofile, io.* and os.* will not be available to user’s scripts. While this makes Redis Lua scripts safer, using the single redis function and allowing loadstring makes me think injection attacks would still be possible.
Original title and link: An update on Redis and Lua (NoSQL databases © myNoSQL)
via: http://antirez.com/post/an-update-on-redis-and-lua.html
Monday, 2 May 2011
Redis with Lua Server-Side Scripting
One of the reasons I’m positive about integrating scripting into Redis in the near future (but don’t take this as a promise!) is that is almost our only salvation from making Redis bloated. […] But everybody has a different problem. How much commands should we add? With scripting all this specific problems are solved in a general way without making the Redis server a mess with a big number of commands, and without trying to implement our “little language” that will later turn in an ill conceived real language.
Experimental Lua-based stored procedures. Blocking. Redis access through a single function redis handling strings: extensible and unsafe.
The Hacker News thread.
Original title and link: Redis with Lua Server-Side Scripting (NoSQL databases © myNoSQL)