Today just an idea came to my mind how facebook is handling so many of users ...what technologies they are using and how ? so I did a little bit of googling and what i found I am just pasting over here.
I found Developers in facebook are using a stack of open source technologies and it is LAMP (Linux , Apache , MySql , PHP ) with MemCache. I will give a brief introduction of all of these technologies. For now MemCache is a distributed Cache which make facebook users request fast.
MYSQL
For the database, Facebook utilizes MySQL because of its speed and reliability.MySQL is used primarily as a key-value store as data is randomly distributed amongst a large set of logical instances. These logical instances are spread out across physical nodes and load balancing is done at the physical node level.
As far as customizations are concerned, Facebook has developed a custom partitioning scheme in which a global ID is assigned to all data. They also have a custom archiving scheme that is based on how frequent and recent data is on a per-user basis.
Most data is distributed randomly.
PHP
Facebook uses PHP because it is a good web programming language with extensive support and an active developer community and it is good for rapid iteration. PHP is a dynamically typed/interpreted scripting language.Developers in facebook have done a lot of customization over here they have written there own compilers to compile the code.
MemCache
This is the part where I was very much interested to know. You should read following journal if you really want to know in detail http://www.linuxjournal.com/article/7451?page=0,0. I am giving a brief introduction here.
Memcached is a high-performance, distributed caching system. Although application-neutral, it's most commonly used to speed up dynamic Web applications by alleviating database load. Memcached is used on LiveJournal, Facebook,Youtube, Wikipedia and other high-traffic sites.
It is basically a collection of machines where we cache the data from the data source so maximum queries are replied back from the MemCache only and because a query from this cached data is faster than querying to data source ( database ) it makes the overall user's experience fast.
Mamcache is stored in the form of huge hash tables so all the query to Mamcache happens in O(1) or can say in constant time. As already mentioned all the objects have a unique id, Suppose you are on a page and seeing your friend's pic and when you click next, a query go to Mmecache which request for it's unique ID, if the requested ID object is in Mamcache, query will be replied otherwise Mamcache do a query to the database , cache this object and replied back to the user. So we can see the benefits of Mamcache will be much if maximum number of hits are from the Mamcache. I don't want to go much depth but I will like to discuss if you have any query and you post that over here.