文章太长了,下面是其中的一小部分
转:http://simonwillison.net/static/2010/redis-tutorial/
![Redis workshop NoSQL Europe, 22nd April 2010 Simon Willison - @simonw - simonwillison.net](http://simonwillison.net/static/2010/redis-tutorial/redis.001.jpg)
These slides and notes were originally written to accompany a three hour Redis tutorial I gave at the NoSQL Europe conference on the 22nd of April 2010.
Please post any comments, feedback or corrections to theaccompanying blog entry.
You can find me online at simonwillison.net and @simonw.
![What is Redis? Remote Dictionary Server? A key-value store? ... but it does list and set operations A data-structure server? ... but it has pub/sub and notifications A non-blocking event bus? Network accessible shared memory?](http://simonwillison.net/static/2010/redis-tutorial/redis.002.jpg)
Redis is currently one of my favourite open source projects. I like it because it scales down as well as up - it's equally useful for tiny projects running on a single VPS as it is for huge services running across dozens of servers. At either end of the scale it lets you build things that would be a lot harder (and more expensive) using traditional tools.
Because Redis does so much, it's hard to precisely categorise it. It feels substantially different to the other software that tends to be packaged under the NoSQL brand.
![A photo of a pen-knife, subtitled A little server of awesome](http://simonwillison.net/static/2010/redis-tutorial/redis.003.jpg)
It's like a good pen-knife or multitool - it solves a bunch of different but related problems, all in a convenient pocket sized wrapper.
(Photo by herzogbr)
![Whatever it is... It’s screamingly fast Non-blocking I/O, single threaded 100,000+ read/writes a second It’s tiny: ~16,000 lines of C It scales down: single VPS friendly It makes new types of feature - in particular write-heavy ones - feasible for small apps It complements your existing storage layer](http://simonwillison.net/static/2010/redis-tutorial/redis.004.jpg)
Performance is Redis's killer feature. I get 80,000+ operations a second on my laptop - proper server hardware will get even more. It handles writes even faster than it handles reads, which makes it useful for a whole bunch of interesting problems. Because it's so fast, a whole class of features which most resource-constrained web applications would never even consider suddenly become feasible.
The performance is principally down to Redis keeping the entire dataset in memory, and only periodically syncing to disk. You can trade performance for improved durability in various ways.
![(Very) brief background Created by Salvatore Sanfilippo, aka antirez (Possibly my favourite open source maintainer of all time) First release March 2009 “Acquired” by VMWare March 2010 Open source, BSD licensed](http://simonwillison.net/static/2010/redis-tutorial/redis.005.jpg)
Salvatore is fantastic. He's incredibly responsive to feature suggestions and bug reports, a constant presence on the mailing list, churns out an astonishing amount of high quality code and displays excellent taste in picking which features go in to the product. Irequested a feature on Twitter once (SRANDMEMBER) and he checked in an implementation less than 12 hours later!
Up until March, he was working on Redis in addition to consulting and his own startup. He's since been hired by VMWare, which means he'll be working full time on the Redis project.