Wednesday, February 17, 2010

Redis, and why I love it

Redis is a relatively new entry to the 'NoSQL' movement that I've been playing with. It is a in-memory key/value store server, and stands for REmote DIctionary Server. You can think of it as a reverse memcached/MySQL store, that first stores in memory then serializes to disk when it gets a chance. If you've worked with higher level languages, like Python, you know how handy dictionaries are. You can store whatever you want in them in one place and retrieve the data somewhere else. Redis is a dictionary server with some very nice built-in primitives and functions. It has lists, sets, sorted-sets and atomic operations to operate on those. Redis makes implementing things like a worker queue using the RPOPLPUSH function trivial, and that is just the beginning.

What's even better is the code is in very clean C, and the relatively small size (~10k LOC) makes it easy to read and study. There are plenty of clients (C, Python, Ruby, PHP, etc) which makes this a nice drop in to almost anywhere in your stack.



I was thinking of implementing something like GFS with it - using Redis to look up the location of a file on a NFS server. For scaling horizontally, Redis supports master/slave replication out of the box. Add a consistent hash on a filename with one master server for writes, and multiple slaves for reads and you're in business.




This is just the tip of the iceberg. There are some many uses for Redis. I look forward to working more with it!

Friday, February 12, 2010

Windows: The ultimate Fractal of Suck

It's time to wake up. Windows is not a serious platform to do any kind of development on. It's just a waste of time. From MFC to WPF to XAML. From COM to COM+ to DCOM to .NET. From the command "shell" to WSH to PowerShell - it's all just one giant Fractal of Suck. Each one sucking in more ways than the previous version.

My boss coined this term a few years ago: "Fractal of Suck". Any part you zoom into, sucks as much as the whole. Windows is one giant Fractal of Infinite Suckage. Most people have already figured this out and moved on to greener pastures like OSX or Linux, but there are still those holding on to the latest Microsoft offering like it'll FINALLY save them. Well, guess what - it won't. It's just more garbage on top of the garbage that Microsoft has been feeding us for well over a decade and a half.

I've been doing Windows development for a long-ass time. I drank the Kool-Aid. I bought into whatever their latest bullshit was. Anybody remember COM? ActiveX? How about DirectShow? Didn't think so. Every time I was so excited about their latest "technology", thinking that they'll get it really right this time. Just like forgiving your cheating girlfriend just-one-more-time, you're the one who gets ultimately fucked over.

Some of us don't have a choice. We have to do Windows development for work. I'm one of those people. However, I get to do other development too and that makes up for it. I cringe every time I have to open Visual Studio and see the little text on the status bar telling me that "Intellisense" is scanning my code. I've switched to just using vim+ctags and a batch file to build my project. A 100x improvement over the complete and utter crap that Visual Studio is. WTF is so Visual about VS? Thanks for re-inventing make and doing it in a completely half-assed and broken manner. Does anybody use the built-in 4gb MSDN "help"? You're lucky if it ever finds any useful information. It's a billion times faster to Google for help. Hell, even searching the actual MSDN site doesn't work. Google finds way more relevant links. Integrated my ass.

If you want to be a serious developer, do yourself a favor and get yourself a Linux box. If that's too much of a leap for you, get OSX. Even your grandma can use that and you'll get a proper development environment.

All the new and exciting stuff is being done on OSX/Linux. That's a fact. Get off the Microsoft crack, learn vim/emacs and ditch Windows like the abusive bitch you didn't have the balls to dump in high school.