Saturday, March 28, 2009

Facebook architecture & lessons learned

There is a very nice and useful talk given by Aditya Agrawal (director at engineering at Facebook) about Facebook architecture and lessons learned. The presentation is called Facebook: Science and the Social Graph (I am not sure why they picked up this name, sounds little misleading to me).

I have seen it just ones and I didn't get all of this but there are a few points that cought my attention:
  • No distributed transations at the database level (the way they ensure or better fix data integrity is similar to what eBay engineers are using - i.e. offline background jobs). The database schema is probably very simple (keeping things simple helps a lot if your system is expected to grow fast and needs to be scalable [i.e. distributed]). They hold only static data in the database and only the most recent one. Older data are moved to the warehouse. I guess it is then analyzed by Hadoop and Cassandra.
    There is also one older blog post by Greg Linden about scailing Facebook databases.
  • PHP for front end works well now BUT the question is if they would have used it again if they had been given a chance to write the system again. It turns out the that PHP is a good language for web programming but it is not very fast language and code base maintenance cost can grow high. It seems that the only justification for them to use PHP is (was) that it allowed them to start quickly and probably it was the only front end language they had enough experience with. They try to stick to principle known as "Use the right language, library and tool for the task" (see 46:00) so it is funny to see how Aditya gets an question from audience "Is your bet on PHP driven by the same principle?" (see 48:40). To me it is obvious that the fact that the PHP is dynamic (no typing = much harder code analysis and debugging) and interpreted language causes them a lot of troubles.
  • Memcached is one of the biggest star in their stack although they had to implement several customizations (probably the hardest one was switching it to UDP).
  • Thrift (50:00) seems to be one of their most interesting open sources project.
For more information you can also go to

Thursday, March 12, 2009

Troubles getting Manning MEAP books

Preambule: The following problem was fixed for me by the Manning team. Anyway, if you are facing similar issues, then be sure to check the Ebook support policy (link below in the text).

Manning MEAP book program provides very useful way of getting books on one of mostly bleading edged and very interesting technology topics at very nice price. I really like this service but I encountered issues with my recent order of two very promissing books (Hadoop in Action and Algorithms of the Intelligent Web). My order has been confirmed by email, my bank account was charged appropriately and I got an order code from Manning along with instructions about downloading books from their web. Everything worked fine up to this point. But the rest of the service did not work very well for me. I was not able to download books from the sandbox download page. It just tells me:

The order number and email address entered can not be validated. Please contact Manning support.

Please note that the downloads are available for 5 days from the initial order time. If your links are not available anymore, please contact Manning support centre.

Although this may sound unusual I am used to get this message after every MEAP order. In a normal situation I just contacted their support center via email and they fixed this problem for me. But not this time. I don't know what has changed with their support center but in spite of the fact that I have sent them 4 emails I did not get any response from them for more then 9 days now. I also did check that I follow their Ebook support policy. But still I don't have my books nor any response from them.

I hope I will be able to solve this issue soon and I also hope that the problem is on my side, not on Manning. However, without possibility to call them I don't see any easy way how I can check with them (because emailing obviously does not work for me this time).  Does anybody have any idea?

UPDATE (03/13): I have to say that the Manning team contacted me and promised quick fix. Will keep this post updated as things are moving forward...

UPDATE (03/14): I received download links today. Worked fine for me. Big thanks to Otis Gospodnetic, Steven Hong and Manning support team. (I was told that the problem was caused by my name having exotic diacritical characters.)

Monday, March 9, 2009

How to switch on Strings in Java?

Starting with Java 1.5 it can be very easy, check the following useful post about using switch on String values in Java: