×
Vert.x: An enterprise ready backend for the Cloud era

Flashback to 2013. Whatsapp was becoming increasingly popular, I was introduced to it by a friend. What annoyed me was the fact that I needed to allow Whatsapp to collect data about all my contacts for it to work, whether or not a contact was a Whatsapp user. Incidentally in our company we had just completed a two year journey building a very strong mobile app development team. So an idea was born to develop an alternative that respects user privacy – a secure privacy conscious messaging app and ‘xpress yourself’ was born.


Obviously we knew we needed an uber cool user experience and to date we believe we have one of the best user experience among messaging apps. Our UX team even considered the power savings of one touch vs two touches to go from one active conversation to another and saving one full screen repaint each time– think of a billion users saving at least 10 such repaints a day!!. If Whatsapp adopts our design, that’s megawatts of electricity saved per day!!


So what is Vert.x? Vertx.io website says ‘Vert.x is a toolkit for building reactive applications on the JVM’. It is a deceptively simple explanation of what Vert.x is capable of, but yet the best definition I have seen yet, the truth is it is that simple to build a powerful application. Vert.x is not a platform, it is not opinionated, it is polyglot and so what you do with it is completely in your control and imagination. Vert.x just makes the job of making a robust secure and scalable backend, done right, a walk in the park.


Best part about using Vert.x for an enterprise is the fact that it is polyglot. Most likely you will have a team of programmers who already know one of the languages Vert.x supports – Java, JavaScript, Groovy, Ruby and Scala to name a few. The most basic building block of a Vert.x application is a verticle. It is not necessary that you use Vert.x for everything, we can simply embed a Vert.x server as part of your stand alone application or use one or many of the modules provided by Vert.x as needed. Development is fast and less error prone because Vert.x frees the programmer from having to worry about multi-threaded programming – synchronized and volatile.


What does all this have to do with Vert.x you may think. We had no second thoughts on the technology to be used on the mobile. We wanted the best user experience – so native all the way on iOS, Android and Windows. First version of our backend API platform was an Apache/PHP solution. Needless to say we very soon realized that it was not a scalable or practical (aka cost effective) solution to serve millions of users. We wanted a robust, horizontally scalable, secure platform that was easy to build and maintain and yet capable of handling tens of thousands of concurrent connections, not to mention capable of full duplex communication. With a traditional web server, we were to rely on push notifications to pull responses to messages from server, not a good usage of resources for a messaging app.


How did others do it? Almost all roads led to ‘Erlang’ the technology behind Whatsapp. Erlang, a language developed by Ericsson Computer Science Laboratory in the late 80s, is a functional language built to address concurrency. We toyed with the idea of adopting Erlang as our backend. However, being a consulting organization, we were not sure how much of that knowledge we will be able to apply in our usual course of business. Besides, the learning curve for Erlang was rather steep. So it was imperative that we looked at modern day alternatives. Node.js was an early favorite, and it still remains a favorite and used in many of our projects. However Vert.x is what we chose as our backend for ‘xpress yourself’. Since then we have recommended and used Vert.x in several other enterprise projects where performance, security and maintainability were the primary considerations.


We have successfully used Vert.x in various business contexts like real time bidding applications demanding very high concurrency and for development of full fledged backend stack for hyper-scalable applications. Unlike traditional web servers like IIS or Apache, hacking into a Vert.x application is a whole lot more difficult. With traditional servers hackers know what to exploit, with Vert.x each implementation might be different and we have very fine grained control in accepting or rejecting a message.