News for hackers. Stuff that matters.
Re:Learn Redis the hard way: in production by antirez on Wednesday March 29, 2017 @12:05PM (#13987582)
One problem with Redis is that it looks superficially simple, but actually, like any tool used in critical contexts, there are two possibilities: 1) Know how it works very well and do great things with it. 2) Don't understand it properly and find yourself in big troubles soon or later. Because Redis, in order to provide the good things it provides, has, on one side, a set of limitations, and on the other side is strictly coupled with a number of things related to the operating system, tradeoffs in the configuration and so forth.

Certain things I understood over the years that made it better are, of course, improvements in the implementation, but especially things like LATENCY DOCTOR and MEMORY DOCTOR (this one only for versions >= 4.0), that is, most of the things a Redis operations expert can tell you, Redis can tell you directly... without any other help, just observing its internal behavior.

There is another aspect. For a long time I believed a Redis book was not really needed. Now I changed my mind, and I see no good enough Redis book out there, and I'm almost planning writing one... I was writing for a long time, incrementally, a C book, that is currently just an incomplete draft. I'm thinking about abandoning for now this project, and start with a Redis book.

Re:Learn Redis the hard way: in production by jarpineh on Wednesday March 29, 2017 @12:36PM (#13987961)
Please, do consider writing the C book as well. Most publishers have beta programs these days (O'Reilly, Manning, Pragmatic Programmers). Don't leave it in a desk drawer (so to speak).

Perhaps simplified Redis example could work as a good base to learn C. Single threaded, memory only persistence, network communication service so no complex stuff like concurrency and file management. Though there's probably a lot more going on in there...

Perhaps "Redis for devops" is another book waiting to happen, or how to write Redis modules. By the way, Manning's book (from 2013) is freely available these days: https://redislabs.com/resources/ebook/

Re:Learn Redis the hard way: in production by antirez on Wednesday March 29, 2017 @01:14PM (#13988435)
Yep I don't want to abandon the C book... Since is already halfway and is something more general and long lasting than Redis probably. The book indeed has certain Redis internals examples, but isolated so that you don't need to understand the Redis code base.
Re:Learn Redis the hard way: in production by avtar on Wednesday March 29, 2017 @08:30PM (#13991917)
I really hope you end up releasing this C book. Sounds like it will be a keeper.
Re:Learn Redis the hard way: in production by anezvigin on Wednesday March 29, 2017 @09:59PM (#13992287)
Just wanted to express my support for the C book as well. I'd even pre-order a copy.
Re:Learn Redis the hard way: in production by netten on Thursday March 30, 2017 @01:37AM (#13993186)
+1 for the c programming book, would love to see it in it's current form too.
Re:Learn Redis the hard way: in production by jamiesonbecker on Wednesday March 29, 2017 @01:13PM (#13988429)
I would also love to read a C book by @antirez! It'd go up there next to my K&R.*

I think a redis book is good, but your docs and blog articles are already excellent. If you combined them into a single document (slightly updated or curated blog articles as chapters, with the second half of the book as reference section/appendix for redis.io commands) then your book is done. You could probably even just hire someone to handle this formatting.

The C book sounds really fantastic.

* (btw, antirez wrote redis.)

Re:Learn Redis the hard way: in production by andygrunwald on Wednesday March 29, 2017 @01:36PM (#13988661)
Original author here. First of all, thank you antirez for this beautiful piece of software. And i agree you 100%.

At the first glance it looks simple. Later if you use it, it can get a beast very fast. But after you get some more knowledge about this, you know how to deal with it.

What i really like is your approach you mentioned: "Over the last years i learned...". And the users of redis can feel this. More and more commands and tools are implemented in redis that makes handling of bigger envs way easier or tools to speed up your debugging sessions like WATCHDOG, SLOWLOG, latency based testing (as mentioned in the article).

Don't get me wrong. This article is not about blaming redis. I and we as a company, love redis. Thank you.

Re:Learn Redis the hard way: in production by aequitas on Wednesday March 29, 2017 @12:26PM (#13987824)
As with many things, it's not the solution thats complex, the problem is. A seemingly simple solution to a hard problem often just shifts the problem to a different domain for you to deal with it.

Understanding your problem and the tools as you mentioned deeply allow the great things, or just, keep fingers crossed and hope for the best.

A lot of problems can often be reduced in complexity by really understanding what you need vs. what you think you want or your user wants. The real challenge is translating what is wanted into what is needed (which is often hard to explain to clients).

Re:Learn Redis the hard way: in production by dotancohen on Wednesday March 29, 2017 @01:36PM (#13988664)
Hi, Salvatore. I was actually just recently deciding how to contact you as I saw an earlier comment of yours about wanting to switch you site over to Markdown.

Obviously I've benefited from your work on Redis, so if you'd like a hand converting the site over to Markdown or with the books (proofreading, technical editing) I'm happy to help. Let me know!

Re:Learn Redis the hard way: in production by btilly on Wednesday March 29, 2017 @01:04PM (#13988324)
The biggest lesson that I think that most need is that Redis is a very sharp knife. It is perfect for some problems, and a horrible fit for others. Understanding what it is for is critical to having it work out well for you.
Re:Learn Redis the hard way: in production by antirez on Wednesday March 29, 2017 @01:16PM (#13988453)
Exactly, but the use cases for it cannot be easily put into obviously delimited things. There are use cases where Redis is a good fit as a primary database, and use cases where it should not be used even if data is ephemeral, to make an example. The right applications depend on the exact problem, and even problems that are not a fit can be re-stated so that they become good enough for Redis, and similarly, problems that in theory are a great fit can be mis-implemented easily. As I said IMHO it's a matter of understanding how Redis works exactly... in order to make great choices both in applying it or not, and how to apply it.
Re:Learn Redis the hard way: in production by btilly on Wednesday March 29, 2017 @01:36PM (#13988670)
Here is my understanding.

Redis pushes the limit of what can be accomplished using a single-threaded in memory data store. If your processing can be done by such a thing, Redis is probably the most efficient option available. (With, of course, persistence, replication, and so on for managing your data.)

But if you throw blocking operations or too much data at it, Redis is going to demonstrate the inherent limitations that come with being a single-threaded in memory data store.

Re:Learn Redis the hard way: in production by misterbowfinger on Wednesday March 29, 2017 @09:45PM (#13992238)
Just curious - what's an example where Redis is a good fit as a primary database?
Re:Learn Redis the hard way: in production by kakapupu on Thursday March 30, 2017 @02:10AM (#13993297)
> The right applications depend on the exact problem, and even problems that are not a fit can be re-stated so that they become good enough for Redis, and similarly, problems that in theory are a great fit can be mis-implemented easily

How about adding something about this in the documentation, if you haven't already?

  - Do use Redis for <X>
  - Do NOT use Redis for <Y>
Re:Learn Redis the hard way: in production by andygrunwald on Wednesday March 29, 2017 @01:37PM (#13988680)
Original author here. I agree with this. And i tried to deliver this sentence between the lines within this article.
Re:Learn Redis the hard way: in production by esterly on Wednesday March 29, 2017 @02:39PM (#13989251)
Redis is one of the most reliable pieces of software we have used. We ran it in the debugger in our staging environment for 2years hoping to supply a good bug report years ago. Zero crashes to report on in two years under cache and analytics load. Please write the book, I have always appreciated your writing.
Re:Learn Redis the hard way: in production by SmellTheGlove on Wednesday March 29, 2017 @02:39PM (#13989255)
> One problem with Redis is that it looks superficially simple, but actually, like any tool used in critical contexts ...

Definitely. And on top of that, Redis is very easy to get started with, and as the article illustrates, you can plug along very smoothly until you suddenly find a mountain to climb. Shouldn't scare someone off, but one of the lessons is to understand what you're implementing and where the bottlenecks will eventually be - much easier said than done, in my experience, but something to aim for.

Re:Learn Redis the hard way: in production by spenuke on Wednesday March 29, 2017 @12:21PM (#13987775)
I for one would be interested in seeing the C book even in draft. :)
Re:Learn Redis the hard way: in production by dpeck on Wednesday March 29, 2017 @01:38PM (#13988696)
A Redis book in the same vein as Erlang in Anger, would be greatly received and appreciated by all.
Re:Learn Redis the hard way: in production by Pfiffer on Wednesday March 29, 2017 @01:28PM (#13988581)
I personally would love a C book.
Re:Learn Redis the hard way: in production by atxcrab on Wednesday March 29, 2017 @11:02PM (#13992528)
Redis code is poetry in c. Please don't abandon c book