How it works: VKontakte

vkontakte_logo

Informations about VKontakte, the largest european social network, and its infrastructure are very few and fragmented. The only recent insights, in english, about its technology is a BTI’s press release which talks about VK migration on their infrastructure. Everything was top secret.

Only on 2011 at Moscow HighLoad++Pavel Durov and Oleg Illarionov told something about the architecture of the social network and insights are collected into this post (in russian). 

VK seems not different than any other popular social network: is over a LAMP stack and uses many other open source technologies.

  • Debian is the base for their custom Linux distro.
  • nginx mange load balancing in front of Apache who runs PHP using mod_php and XCache as opcode cacher.
  • MySQL is the main datastore but a custom DBMS (written using C and based on memcached protocol) is used for some magics. memcached helps also page caching.
  • XMPP is used for messages and chats and runs over node.js. Availability is granted by HAProxy who handle the node’s fragility.
  • Multimedia files are stored using xfs and media encoding is made using ffmpeg.
  • Everything is distributed over more than 4 datacenters

vk_logoThe main difference betweek VK and other social network is about server functions: VK servers are multifunctional. There is no clear distinction between database servers or file servers, they are used simultaneously in several roles.

Load balancing between servers occurs on a layered circuit which includes at balancing DNS, as well as routing requests within the system, wherein the different servers are used for different types of requests. 

For example, microblogging is working on a tricky circuit using memcached protocol capability for parallel sending requests for data on a large number of keys. In the absence of data in the cache, the same request is sent to the storage system, and the results are subjected to sorting, filtering and discarding the excess at the level of PHP-code.

The custom database is still a secret and is widely used in VKontakte. Many services use it: private messages, messages on the walls, statuses, search, privacy, friends lists and probably more. It uses a non-relational data model, and most operations are performed in memory. Access interface is an advanced protocol memcached. Specially compiled keys return the results of complex queries. They said is developed “best minds” of Russia.

I wasn’t able to find any other insight about VK infrastructure after this speech. They are like KGB 😀

A week with Jawbone UP

A couple of weeks ago @lastknight lent me his Jawbone UP because I want to buy an activity tracker in order to log my sleep “performances” and my workouts and I was undecided between the Jawbone UP24 and the Fitbit Force.

The UP is really interesting from a technical point of view. Is a small set of sensors (mostly accelerometers) with a battery (up to 10 days of use).

jawbone_up_tech

jawbone_up_app_logoFeelings are good: is lightweight enough to don’t notice when you wear it. You can track steps, sleep and a large set of activities (giving a different meaning to steps informations). There is not web interface yet. The only way to sync your device and view you data is your smartphone.

I started using the new 3.0 version of the app so i don’t know how the previous versions were.

I added my friends @gigisommo, @luka_bernardi and @dieguitoweb and I started to track all my activities. Dashboard shows your everyday progress:

IMG_6799

And there are details about walk, sleep and workouts:

IMG_6797

IMG_6796

IMG_6798

After a week I’m quite happy with this device. Steps are probably overvalued and sleep tracking is not perfect but data seems near enough to reality to be useful. Since I started to test it I tried to sleep more and do more steps and challenge with my friends was really fun. I really miss the web interface. Would be the best addition to this ecosystem.

Anyway I’m probably going to buy an UP24 on january. If you are part of this network add me as friend 😉

Running Pidora on RaspberryPi

Last week I started to play with my RaspberryPi (thanks @dani_viga). It seems simple and funny. I’d like to run an Hadoop cluster like LinkedIn or others geeks but first of all I need to setup the system.

My RaspberryPi kit includes the board, an USB-microUSB cable (as power supply), an SD card (16 GB) and an ethernet cable.

raspberry_kit

pidora_logoAs Linux distribution I choose Pidora because I like CentOS and this a Fedora/RedHat-like distribution. Base image can be downloaded from official page. Then you have to burn the image on the SD card. It seems that RaspberryPi can boot only from SD card. I can’t find any guide to boot it from USB key without SD card. Anyway is possible to use it as main drive. To burn it on SD on Mac o Linux you can use dd

dd if=/path/to/image/pidora-18-r1c/pidora-18-r1c.img of=/dev/disk3 bs=1m

First parameter is the path of the downloaded image, the second one is the endpoint of the SD drive (you can find it using diskutil list).

After this I simply plugged USB to my Mac and ethernet to a connection. After a dozen of seconds lights start blinking!

raspberrypi_running

System is already configured and on port 22 runs SSHd. If you try to connect to the IP using root as username and raspberrypi as password the RPi answers!

raspberrypi_shell

Next week I’ll try to install a LEMP stack on it. FUN! 😀