The beginning

I was reading an essay by Paul Graham the other day and one line in it stood out to me –

Few people know so early or so certainly what they want to work on.

This got me thinking about what got me interested in programming and computer science when I was growing up.

As I kid I was always interested in computers and I remember reading Digit cover to cover each month. My first foray into programming was when my mother enrolled me in a class to learn basic C and C++. I rebelled initially, before even attending a single session of the class – “I don’t want to learn programming! That’s not cool at all.” I decided to attend at least one session though as I didn’t want to hurt her feelings. And I’m so glad I did that.

I think the phrase “love at first sight” accurately describes what I felt upon looking at my first program (a simple “Hello, World!” in C if my memory serves me right). The feeling was incredible and I knew almost right away that I had found my calling in life.

Thanks mom.

go Resolutions(“Karan Parikh”, 2015)

Writing a post about what my goals and resolutions for 2014 was a great idea. I think being public and open about what I wanted to achieve was added incentive to actually completing those goals. In the same vein here are my resolutions for 2015 –

  1. Start volunteering: It was sometime in November or December of last year that I felt the need to give back to society in some way. While I didn’t act on this desire last year I hope to do so in 2015. I’m still in the process of figuring out exactly what I want to do, but off the top of my head volunteering at a homeless shelter and animal shelter are two ideas that I would like to act upon.
  2. Be less shy: I don’t think of myself as a shy person but I do feel I can be more open about my thoughts and how I feel. There have been instances in the past where I’ve held myself back and I regret doing so. In 2015 I hope to snap whatever weak threads are holding me back.
  3. Learn a new programming language: 2014 was the year I finally picked up Go. I’m still in the process of understanding the ins and outs of the language and actually writing something useful in it. But this hasn’t deterred me from deciding to learn something new in 2015. Current contenders are Rust and Erlang.
  4. Read 12 books: Reading one book per month is very doable. Goodreads, which I started using last year and absolutely love, should help me in achieving (and tracking) this goal.
  5. Read 24 research papers: I think my goal last year of three research papers a month was a bit lofty. I hope by dialing the number down by one I can achieve this goal. I’d also like to diversify the topics a bit – in the past I’ve focused mainly on distributed systems but this year I’d love to read some papers on machine learning and data structures as well.
  6. Write 24 blog posts.
  7. Do one muscle up: I’m quite satisfied with how my fitness improved over the course of 2014 and I hope to continue that trend this year. I was able to progress from assisted pull ups to non-assisted pull ups to weighted pull ups over the course of a year (Yes, my elbow does hurt from patting myself on the back there. Thanks for asking). What I wasn’t able to achieve though was a muscle up. I really hope 2015 is the year that I can do at least one of these.

Here’s to a fantastic 2015. Happy new year everyone!

Paper Review – Paxos Made Live

I read an interesting article the other day that provided a great explanation, with sweet visualizations none the less, of the Paxos consensus algorithm. One of the papers mentioned in the “More Resources” section was Paxos Made Live. This paper has been on my radar for some time now and seeing it mentioned here inspired me to go ahead and read it.

I think this is one of my favorite papers. What I really liked about it is that it details the problems of translating an algorithm from an abstract theoretical concept into an actual living, breathing system.

Sections 5 and 6 of the paper are ridiculously good. Even something simple like taking a snapshot of a data structure has many subtleties associated with it when paired with a replicated log and I quite enjoyed reading about the snapshot mechanism the team had engineered. The idea of using a state machine language to implement their algorithm was excellent as well. One open source tool that comes to mind that allows you to do this now is Apache Helix.

Distributed systems are extremely hard to test. This is why the section on testing was particularly enlightening for me. I think having explicit hooks in source code to inject failures is quite a powerful idea. I particularly loved one line from this section – “By their very nature, fault-tolerant systems try to mask problems.” 

I highly recommend reading this paper.

Jet lag, a book, research papers, and a dog

I reached Vadodara on the 23rd and was hit with jet lag that lasted about three days.

I’d bought Mira Jacob’s The Sleepwalker’s Guide to Dancing with the hope that it would last me a majority of my visit to India. I read ~100 pages of the book while in the U.S. On my first night in Vadodara I woke up around 3.30am (because of the afore mentioned jet lag) and finished the remaining ~400 pages in four hours. This is an incredible book, and I can see why it was a nominee for Goodreads’ Best Fiction books of 2014. Simply put, I loved it. And yes, I did appreciate the irony of the title given my battle with temporary-time-difference-induced sleeplessness.

With my reading plans in shambles (OK not completely in shambles since I am not yet done with Borges’ Labyrinths which is also amazing) I decided to work on one of my 2014 goals and read some research papers.

Here is what I read:

    1. Scaling Memcache at Facebook – This paper talks about how Facebook leveraged memcached to build a distributed key-value store. I thought the usage of UDP for making get requests and flow control mechanisms to combat incast was particularly interesting. Overall this is a very good paper and I would highly recommend it to anyone interested in distributed systems and system architecture. My favorite line in the paper? “Simplicity is vital.” (section 9).
    1. MultiQueues: Simpler, Faster, and Better Relaxed Concurrent Priority Queues – this paper introduces MultiQueues, a concurrent priority queue with relaxed semantics, i.e. you are not always guaranteed to get a globally minimal item from the data structure. Most of the papers I read are systems papers, so it was refreshing to read a paper that dealt more with data structures. MultiQueues are conceptually quite simple and their performance (as shown in section 6 of the paper) is impressive.
    1. You’re Doing It Wrong – this article introduces a B-heap, which is a VM page-friendly implementation of a binary heap. Kamp writes really well, and this article is a joy to read. My main takeaway from this article was the reminder that one should also consider I/O and memory access patterns while analyzing algorithms. This idea was introduced to me in CS-232 at UIUC and it is something that I always try to keep in mind while looking at an algorithm or trying to improve performance.

Oh, and here is the dog!

IMG_2360

Notes of nostalgia

Last night I went to concert at the Warfield in San Francisco, CA featuring Red Fang, In Flames, and Opeth. It was fantastic, and each band put on stellar performances.

What was really interesting for me was how much the concert reminded me of my childhood. In Flames and Opeth were some of the first metal bands I listened to growing up. Even though my music tastes have diversified quite a bit, these bands started a love affair with the genre that is still going strong today.

I still remember listening to Harvest and Bleak by Opeth and being blown away by the two things – how absolutely beautiful their music was, and how different these songs were from each other yet from the same band. I was also flabbergasted that some of the songs were over 7 minutes long. “How do you keep the listener engaged that long?” I wondered. It only took one listen of these songs for me to understand the power of their music.

It didn’t take long for Opeth to become one of my favorite bands, a title they still retain.

Opeth

Opeth

In Flames

In Flames

Red Fang

Red Fang

Go pipelines

As mentioned in this talk the main concurrency features Go provides are goroutines and channels. While these constructs might seem pretty simple they are immensely powerful and one can use them to build advanced systems. One such system is a pipeline as described in this blog post. What I think is really awesome about the system described is that downstream functions can signal to the upstream functions to stop producing values, while still keeping the code easy to understand and not horrendous.