I've been meaning to write this for awhile, but never found the time until now.
I got the new iPhone the day it came out two Fridays ago. I had to wait in line for 5 hours. But there's something about waiting in line for that long, the more you wait, the more you want it. My roommate and I went to the Apple store on Chestnut street at 3pm. At the time we were told there were about 100 people in front of us, and 15 employees selling the iphone with an average of 20 minutes per transaction. So we did a quick back of the envelope calculation, and decided that the line was only going to take 2 hours. We were wrong.
At one point we were told that there may not be enough 16GB iPhones for us (but luckily that wasn't true). Also half way though the line, we were fed pizza and soda. What I found funny was that the people around me weren't what I expected. I had expected to be standing in line with bunch of hard-core nerds. Instead, the guy in front of me is a 50 year old wedding photographer and the lady behind me is a doctor and a mom. The doctor lady only wanted to stay in line until 5pm, but she ended up having to move her dinner reservation and missed the show she was supposed to attend.
Anyways, at 8pm I finally got my iPhone. I got the white one, because everyone else is getting the black one. Also it's way flashier because only the 16GB iPhone comes in white. I loved it. I got through the purchase in record time because my 2 year contract with AT&T is already up for renewal anyways.
This is the first picture I took with my iPhone. The guy standing next to me is the Apple sales guy. He seems a bit weary at this point.
Last weekend I had an epiphany. Maybe epiphany is too strong of a word, but it was a pretty strong realization nonetheless. I'm not giving enough back to the world.
There's no doubt in my mind that I will to do something great that changes the world one day. I don't have a clue what that something would be, but since that's in the distant future, I don't have to worry about it just yet.
What about right now? I'm not a celebrity; I don't have millions of dollars; and I lack any political power or influence. Is there something that I can do, however small, that could make the world a slightly better place? I think there is.
Right now I'm living comfortably. I have a job that pays well and I have spare time that I use to pursue hobbies and recreation. In fact, I'm in the midst of a major quest for personal development. But still, I feel that's not quite enough. I'm intelligent; I have decent skills building software; and I like challenges. So there has to be something I can do that's fun, interesting, and at the same time, help the world.
So, I'm gathering ideas of projects to pursue. One thing I could do is build applications for the OLPC; create something useful for people in developing countries. Or maybe I can create an iPhone or Android application that would be useful to scientists. There are many possibilities and now I just need to do some research before I start on something...
Tonight I just read that Hot or Not sold for $20 Million. This is after the founders, James Hong and Jim Young, cashed out $20 million plus in the 7+ years that Hot or Not has been operating. Since they took no investment, it was pure profit. Quite a nice win, I would say.
Who would've thought, a totally stupid application that appeals to nothing but human vanity, would be so viral, so lucrative, and last so long. This website, not only is it totally unproductive to human progress, probably crushed the dreams and self-esteem of millions of people around the world. I remembered two years ago, I went to a recruiting event at Berkeley, and stopped by the Hot or Not table. I got my picture taken by them (I was naive and young then), but I swore I would never lend my talent to such a retarded endeavor. I have come a long way since.
NOT.
All the tongue in cheek aside, I feel like that my journey in entrepreneurship has been remarkably similar to that of James and Jim. I went to my bookshelf and dusted off my copy of Founders at Work by Jessica Livingston (of Y Combinator fame) and read the chapter where the author interviews James Hong. Here's an excerpt, in response to the question of what he would tell someone in his shoes before he started Hot or Not, James said:
There's kind of a backwards logic that says: when you are young you should learn from people who are experienced, so later on, if you want to do a startup, you can take the risk. And that's a myth that was created from school... Experience will come when you face certain problems and live through them. And the best way to do that is to put yourself squarely in the path of those problems.
This certainly sounds familiar. And later, what he said about the thing that drives entrepreneurs, resonated so perfectly with me, I could've swore I might have said the exact same thing had I been asked. He said:
[I] think a lot of what drives entrepreneurs in the kind of legacy they are going to leave. They want to make a mark in the world and feel like their life mattered. Entrepreneurs are the kind of people who love ideas and want to build things, and add value to the world.
I'm still not sure what kind of legacy he's going to leave with Hot or Not, but I'm confident he's working on it (now that he has plenty of time and money on his hands).
Yesterday, a very opinionated article was posted on the Database Column, a very informative blog about cutting edge database technology written by luminaries of the field. The article, was pointedly titlted MapReduce: A major step backwards.
First of all, I'm pleased that there is a contrary opinion in the room. It seems that these days, all I hear is, "MapReduce is the shit." A little dissent, especially coming from well respected computer scientists, is sorely needed.
Having said that, I must disagree with a few points in the article. Overall, as far as I know, no one has recommended the total replacement of database systems with MapReduce (or variants thereof). As far as I know, Google still uses MySql extensively. MapReduce has always been a batch processing tool, abet, for ginormous amounts of data. It was never designed for transaction processing, query processing, or even data storage. Knowing this, it sorta pulls the teeth out of the article.
A few more criticisms. The point about MapReduce is not "novel" is kind of inane. Dean and Ghemawat never claimed that MapReduce is novel. Besides, if an idea isn't novel, but works, it's not any less useful. The wheel isn't novel, but we sure aren't in a hurry to replace it either.
The authors do hit on some key points, although not directly. They're correct in saying that we need large distributed data storage and manipulation that is online, schema based, transactional, ACID-compliant. Sometimes we have data that we can afford to fudge, but we can easily envision cases where this is not true (think large scale micro-payment systems). Also, having higher level abstractions on top of MapReduce is important too, and they should be more widely accessible so people can build on it. My biggest problem with MapReduce is that it's not something I can build a real system with (Hadoop is, well, immature).
So, maybe out of the ashes of this debate, we'll all find something cool to work on as computer scientists.
Last night I made a simple plan of action. We needed to shutdown one of our applications, delete some data, optimize a table, create a dump, change a few configuration parameters, then restart the application. It was supposed to be straightforward.
In my 8-step action plan, step 6 read simply: restart. It turned out to the the most harrowing step of them all.
Everything went smoothly according to my plan for the first 5 steps. We completely shutdown our application for last night's maintenance. After I brought the database back up, and when we reintroduced traffic, suddenly, we realized something was wrong. None of our pages are loading, and the database is processing only 1 or 2 requests a second.
The strange thing is that we can't find anything that was blatantly malfunctioning. Requests are not going through at all, yet the web server and the application servers were logging normally. The database is up, and has accepted all the incoming connections. We waited for about 10 minutes, and decided to shut the database down and undo the configuration changes (since it was working before the new configurations went into effect). However, nothing changed after the second restart. The application is still not loading.
The answer was actually pretty simple, in retrospect. Our application is very database intensive and our database has been up for more than 2 weeks. All the indices and most of the data are already loaded in memory. The database memory configurations was not set properly, but the disk pages are still mapped in memory by the operating system. When the database was shut down, the disk pages got cleared from the memory, and when the database takes requests again, all the data had to be brought in from disk. But the worst part is that we're suddenly getting so many requests, it was like drinking from a firehose. The database was taking a long time to complete the queries and suddenly our application server is queuing all the requests. A colossal traffic jam developed. Requests are timing out because old requests are not completed and more new requests are piling in after them. The disk is probably thrashing like mad, and the database couldn't bringing in data fast enough.
But that was just an educated guess from my part. At the time, it was frustrating because we couldn't know exactly what was happening. So, boldly, I went forth with my hypothesis and just waited for the database to bring data into memory (after changing some configurations back to the correct values). The only thing that I could do is constantly bouncing the application servers, which clears up the traffic jam by dropping the request queue. After about 45 minutes, it was pretty much back to normal. Then after a final bounce of the application servers, the application is finally up for good.
So, what was supposed to take 30 minutes, took more than 2 hours. By then it was already 3am. It was pretty valuable learning experience. It's not everyday that engineers gets to play with an application at our scale. Needless to say, we won't be restarting that database for awhile.
Well, it was embarrassing. My old homepage was ugly, unprofessional, and grossly out of date. I made it a long time ago, using Ruby on Rails, but it never was the site that I envisioned it to be.
Last night I stayed up until 5am creating a new homepage for myself. I chose to use tiddlywiki, because it was simple. Only 1 file. I can edit it in my browser, then upload it to my server using sftp. One drawback is that I don't get any of the fancy features that I designed for myself (such as a photo gallery with an admin page), but then I realized I never use it anyways. All my public pictures are uploaded to facebook instead.
So, simplicity won. Maybe this time, I'll feel inclined to add content every now and then.
Everyone in Silicon Valley and surrounding hills have seen Richter Scales's first bubble video until it was taken down by a DCMA notice. I'm pleased that a slightly modified version has been reposted. I just can't get enough of this video. It's just too fun.
I missed the first bubble and I can tell you, living in the second bubble is pretty awesome. Everyone is swarming into facebook apps, social networks, mobile devices (again), online videos and everything is funded by advertising (again). We've advanced so much, yet so little. There is something to be said about the excitement and gold-rush mentality. And you know what, it seems to me people this time around have a sense of humor about it.
And yes... it is fun. Whether you participate in the bubble, or not, we should all stop wearing shirts that makes us look like a line of ants.
Today, I would like to discuss briefly about unreliable communication networks. I'm far from a networking expert, but I've read a chapter or two on message delivery. You see, the internet is unreliable. A message sent from one computer to another traverse through many types of infrastructure from routers to proxy servers and from fiber optic channels to wireless airwaves. Sometimes, the message doesn't get through. That's called packet loss. There may be many reasons for packet loss. Some hardware in the path of the message might have exploded, or a server somewhere is configured by monkeys, or the message itself may be corrupted by shady characters. Anyhow, that's why we invented TCP to deal with packet loss (among other things). The receiver will ask the sender to resend the message if it finds the message to be missing or incorrect. This happens under the cover. The cost is extra processing time and add a few round trip time. In the Internet world, that means on the orders of tens to hundreds of milliseconds.
But have you ever considered this problem from the point of view of the machines? Imagine, sitting there, waiting millions of cycles for a packet to be arrive, not knowing if it'll arrive this time. After some time, you get really impatient and call up the sender only to found out that it was sent, but the message somehow got rejected. Yet, you receive other messages in the mean time. So you ask the sender to resend. Do this a few times, and it gets extremely annoying.
How do I know this? Because it's happening to me. For some reason, I'm only getting half of the mail that I should be getting from the post office. I got a new credit card last month, and I still haven't seen it yet. I had the credit card company send it THREE times. I just got a voice mail from my insurance company asking me to verify my address because their letter to me was returned. Yet, I'm getting other mail. I'm getting some of my magazines, some letters, and some bills. But NOT everything. You have no idea how annoying that is.
I'm going to call USPS tomorrow and try to find out what's going on. I don't expect much progress on that front since they're government employees and hate their job almost as much as they hate their customers. If this keeps up, I would have to rent a mailbox somewhere. Preferably somewhere with reliable message delivery.
I didn't sleep last night. I was up finishing work on the demo for the RADLab retreat starting tomorrow. I actually got the thing to work and it's awesome. I architected and implemented this information backplane that constructs path trees from path events using a publish-subscribe system. Then with a visualization web application that uses AJAX to stream the latests data from the pub-sub system. I used both Java and Ruby with lots of multithreaded programming, synchronous non-blocking queues, and XML/JSON data conversions. But the best part of it is, all the pieces fit perfectly together and I got myself a working system at the end.
It's time like this that I remember how much I love programming and making stuff work. I haven't felt like this for a long time. I remember last time I was this excited was when I finished my Operating Systems project back when I was at UT Austin. But that system wasn't nearly as complex or useful as the one I just finished (it's not technically finished, but close enough for a demo).
It really helped that I had a friend also working all night with me. We were able to motivate eachother, and it felt like I got so much work done (which I did). I was hitting a new milestone with every hour. I still have a few finishing touches to do and make a presentation for tomorrow. But right now I'm seriously going to pass out. I can't keep my eyes focused anymore.
So I'm going to take a nap. And then get back to work...
Not that anyone really cares, but my blog and wiki was down for an entire day. So here's the story of how it happened.
Last night I was writing a paper for a class, everything was business as usual. I was adding some stuff to my wiki. Then suddenly my wiki goes out. Just a generic Application Error (Rails) screen that has become a little too common. I think nothing of it, because this happens every few days, and can be easily fixed simply by killing all the ruby fcgi processes (and by the way, fcgi is incredibly fragile). So I ssh into my machine and run killall -9 ruby. And nothing.
No fear. This also happens every few months. The database connection probably got screwed up and I'll just email tech support and tell them to kill my active database connections. So I write a terse email to my hosting company telling them what's up. They write back shortly saying that they restarted all my processes. But still no joy.
This time I noticed a strange phenomenon. My homepage is up and running just fine. But anything that requires database content is throwing errors. I look in the log, and it's cryptic as hell, or so I thought. Something about "Expecting 0 arguments and got 1". What does that mean? By this time I've been passed to level 2 support and still no luck. I got tired, so I went to bed.
In the morning, nothing changed. Blog and wiki are still down. By this time I was asking my hosting company what changes they made last night. And I was told they upgraded Ruby from 1.8.5 to 1.8.6. Ah ha, suddenly the error message made sense. I digged around in the source code and found that in some file called mysql.rb deep in the ActiveRecord library, it was making a call of the form Digest::SHA1.new(arg).digest. However, as I have come to learn, in version 1.8.6, the constructor for Digest::SHA1 changed and the call is no longer valid. Well, so much for preserving backwards compatibility. My hosting company upgraded Ruby, but didn't upgrade the Rails libraries.
So I tell them what I found, and a few hours later, they upgraded Rails to the latest version. Now everything works except my blog showed a big blank spot where all the posts were supposed to show up.
That's no less annoying than before. Again the error log spat me something about RMagick was built using the wrong version of ImageMagick. Somewhere typo (my blog application) is using the ruby sparklines library and the sparklines library uses RMagick for something. I have no idea why I would ever need sparklines or RMagick in my blog, but apparently it's there. I recall setting up this blog on machines without RMagick and it worked just fine. So, I go in and delete the sparklines directory (after making a backup, ofcourse).
Now finally, after 24 hours, everything's back up. Until they go haywire next time. I'm seriously tired of shared hosting, even though my hosting service is super responsive with tech support (considering how little I pay them). I will probably move to a virtual private hosting solution soon, so I can have root access on my own virtual machine. That should cut down on these unexpected problems.