MySQL and Postgres
In 1998-2003 if you wanted to start a serious database driven web site/service and didn't have money to pay Microsoft or Oracle for their databases, you picked either MySQL or Postgres. A lot of people picked MySQL because it was faster, and much of that was due to the MyISAM storage engine that traded performance for a lack of transaction capability - speed is speed. Some people went with Postgres because despite its measurably slower performance on the same hardware, you could rely on Postgres to not lose your data (to be fair, the data loss with MySQL was relatively rare, but data loss is never fun).
A lot of time has passed since then; MySQL moved on from MyISAM as the default storage engine to InnoDB (which has been available for a long time now), gained full transaction support in the storage engine, and more. At the same time, Postgres got faster, and added a continually expanding list of features to distinguish itself in the marketplace. And now the choice of whether to use MySQL or Postgres usually boils down to experience and preference, though occasionally business or regulatory needs dictate other choices.
TL;DR; data integrity
In a lot of ways, Redis up to now is a lot like MySQL was back before InnoDB was an option. There is already a reasonable best-effort to ensure data integrity (replication, AOF, etc.), and the introduction of Lua scripting in Redis 2.6 has helped Redis grow up considerably in its capabilities and the overall simplification of writing software that uses Redis.
- The script exits naturally after finishing its work, all writes have been applied
- The script hits an error and exits in the middle, all writes that were done up to the error have occurred, but no more writes will be done from the script
- Redis is shut down without saving via SHUTDOWN NOSAVE
- You attach a debugger and "fix" your script to get it to do #1 or #2 (or some other heroic deed that allows you to not lose data)
Transactions in Lua
I am seeking to eliminate cases #2, #3, and #4 above, replacing the entire list with:
- The script exits naturally after finishing its work, all writes have been applied
- The script exits with an error, no changes have been made (all writes were rolled back)
The current pull request is a proof of concept. It does what it says it does, removing the need to lose data as long as you either a) explicitly run your scripts using the transactional variants, or b) force all Lua script calls to have transactional semantics with a configuration option.
There are many ways the current patch can be made substantially better, and I hope for help from Salvatore (the author of Redis) and the rest of the community.
Check out http://github.com/tarantool/tarantool
ReplyDeleteWe've had transactions for a while now.
Looks like an interesting software. I'll probably stick with Redis for the foreseeable future, as the market makes paying for legitimate enterprise hosting actually viable.
Delete