6 ms·
Redis: Zero to Master in 30 minutes
- latch 15y agoDirect link to part 2: http://openmymind.net/2011/11/8/Redis-Zero-To-Master-In-30-Minutes-Part-2/ http://openmymind.net/2011/11/8/Redis-Zero-To-Master-In-30-M...
- davidw 15y agoAt that rate of learning, you'll surpass antirez in a few days.
- skrebbel 15y agoI started last week and compiled a stable Redis 2.8 this morning.
- simonw 15y agoIf you don't already know how to use Redis, it's hard to think of a technology that offers as good a return on time invested - you really can pick up everything you need to know about it in a few hours, and once you add it to your tool kit you'll find no shortage of problems that it can help solve.
- pjscott 15y agoYour post got me thinking: what other things can one learn that give ridiculously good return on time invested? Not just technologies, but anything. Here's an incomplete list: * Graph flow: a lot of interesting problems can be solved efficiently by converting them to graph flow problems. * Basic microeconomics: the world looks different once you understand it, and it's not that hard to learn. A cheap enlightenment boost! * Monoid-cached trees. Guy Steele explains better than I could. Video and slides: http://vimeo.com/6624203 http://vimeo.com/6624203 http://labs.oracle.com/projects/plrg/Publications/ICFPAugust2009Steele.pdf http://labs.oracle.com/projects/plrg/Publications/ICFPAugust... Any others? I'm sure I haven't done more than scratch the surface.
- code_duck 15y agoI love that this is so direct, and it's helped me learn more about redis. Some of the explanations are a bit confusing though. I'm not sure I know what a List is - though I suspect, knowing JavaScript, Python, and PHP pretty well, I know what a List is. Descriptions like "If a hash is like a string with an extra field layer" are just plain confusing. Why not put it in terms of commonly understood programming languages? The examples are in Ruby, why not let us know which Ruby structures these most closely correspond to, for instance? I do appreciate the particular names in the example text, however so I'm willing to overlook this.
- antirez 15y agoWhat's wrong with the name 'strings' for Redis strings? http://en.wikipedia.org/wiki/String_(computer_science) http://en.wikipedia.org/wiki/String_(computer_science) If you change the title of the wikipedia article you can read it as a description of Redis strings almost verbatim ;)
- latch 15y agoedit: I don't really want to get into a CS/data structures argument with you, 'cuz I like having a chance at winning when I argue stuff. It's not wrong. I think when you say String people think of: String name = "Leto Atreides"; In Redis (and I guess as a Computer Science term) it means: byte[] anything = .... Although, the Wiki page does say: generally understood as a data type...using some character encoding With the redis implementation not having any character encoding. It isn't a big deal, but I think you'd find that it can be a little confusing to us some.
- antirez 15y agobut strings in most languages such as C, Python or Ruby are exactly random access sequences of bytes. And btw 'binary' is a form of encoding in a string. So Redis strings are strings ;) in a full sense. I think that if calling what are strings, "strings", can generate confusion, go figure how much confusion can be created by calling them with another term...
- davedx 15y agoA byte array is not necessarily a string. Is an image a string? Is a video on YouTube a giant string? They happen to be equivalent at a data storage level, but they're not semantically equivalent. I think the article explains the difference quite well to be honest.
- LeafStorm 15y agoMaybe a better term would be "scalar" like in vector calculus or Perl, to emphasize that the larger data structures consist of scalars arranged in some form.
- quadhome 15y agoWhat is the recommended configuration for in-memory stores like Redis? On a separate machine than its client application? If it's all going in memory, why not run the client on that machine and use native data structures?
- antirez 15y agoThere are obvious reasons for needing networking access, but even when you don't need it: 1) Redis is much more memory efficient than your average programming language. 2) Redis handles persistence and replication for you. Not a joke. 3) Accessing data with atomic operations on complex data types from your application using multiple threads can create more problems. 4) Your application is free of doing other stuff if you use a non blocking client, if you are asking Redis to do computationally intensive tasks. 5) There is no easy way to model Redis sorted sets, in many very high level languages, at the same speed, without writing a C extension.
- rarrrrrr 15y agoAnother benefit I run into is sidestepping the GIL in Python or Ruby. Instead of using multiple threads to manipulate data in-process, use multiple processes to manipulate the data in Redis.
- latch 15y agoI'd say it's like anything else. It depends how you are bound. If you can run them on the same machine, go ahead..but if you become resource bound, you split them up, then you shard...common scaling approach. As for why not use native structures? You need to build persistence, transaction support, pub/sub api, thread awarness. Also, if you happen to use a generic data structure, like Java's HashSet, you probably won't get even close to the same level of performance.
- LeafStorm 15y agoOne complaint: Don't actually use the KEYS command. It's not very efficient. Instead, keep a set of all the keys you would want to delete. When you call KEYS, it has to do a linear scan of every key in the database, and since it is stored as a hash table there really isn't a way to optimize it. It's useful for inspecting things in redis-cli, but not much else.
- antirez 15y agoKEYS is indeed only a debugging command, as clearly stated in the documentation.
- wildmXranat 15y agoRead the source code of http://lamernews.com http://lamernews.com on github http://github.com/antirez/lamernews http://github.com/antirez/lamernews .It's written by the author of Redis.
- jeromeparadis 15y agoIn part 2, correct me if I'm wrong, but isn't the member you're adding for jobs a key? Isn't the code to see if it's already a member unnecessary? It shouldn't add duplicates since the member's value doesn't change (it's a key). Granted, it's unnecessary to re-add the key to the jobs sorted set as the code does, but the explanation doesn't seem right. On the other hand, you could call zadd again to change the score.
- latch 15y agouh..ya, ur right. I'll fix it
- jeromeparadis 15y agoI see you fixed it. Cool. By the way, I've been using Redis extensively for a while and your tutorial is quite good. Congrats!
- antirez 15y agoSince this was not posted on HN maybe it is a shameless plug that's worth it: http://antirez.com/post/short-term-redis-plans.html http://antirez.com/post/short-term-redis-plans.html
- wglb 15y agoActually it was: http://news.ycombinator.com/item?id=3208387 http://news.ycombinator.com/item?id=3208387
- feralchimp 15y agoMy first questions about any new dev tool/tech are "Where does it run?" and "What is the primary interface for working with it?" So I'd love to see the paragraph that begins "There are various ways to install Redis" expanded. In particular, what's the workflow between a) I just downloaded something called Redis, and b) I am issuing commands to learn along with these examples. Otherwise very clear and concise. Well done.
- gizzlon 15y agoOnly used Redis on *nix, but there it's very easy: Just download, unpack and compile. No need to install it just to play with it.. Compiles in no time at all =)
- malkia 15y agoI really want to try redis, but Windows is big part of our development. Is there any port of redis to Windows?
- kds 15y agohttps://github.com/dmajkic/redis/downloads https://github.com/dmajkic/redis/downloads
- malkia 15y agoThanks!
- mkramlich 15y agothe #1 rule of Windows development/hosting is to NOT do Windows development/hosting. Bias to Linux, Mac or another Unix-like instead. Life will be so much better in so many ways.
- malkia 15y agoWhatever. Main development for us happen on Windows (Game Development studio doing Console games mainly). Not my choice, at home OSX/Linux, but even then also a machine with Windows XP.
- j_baker 15y agoRedis is just a good piece of software. I don't see any reason why a web programmer couldn't benefit from spending time to learn it. I simply don't think a remotely complex web application can do without it these days.