Centrifugo in 2016

Alexander Emelin
3 min readDec 28, 2016

--

As many people do I will also try to summarize what had happened to Centrifugo project in 2016. It will be a short post mentioning only the brightest events occurred during this year of development.

This year Semyon Danilov and German Saprykin created client libraries for Android and iOS devices on top of Websocket protocol. I think this is awesome because Centrifugo can now work in all popular client environments — web browsers and mobile devices that use operating systems from Google and Apple. It’s the strength of open-source — I personally too far away from mobile development so could not do this myself.

In January with great help, advices and many contributions from Paul Banks we drastically improved Redis Engine — using Redis pipelining, lua scripts, smart batching — it became more performant and robust for production usage. We also refactored some other important Centrifugo parts such as error handling, metrics etc.

Another important step was packaging Centrifugo for various Linux distributions. Ah… It was a hell:) So many differences — init.d, systemd, upstart systems… But looks like I did it! Now we package Centrifugo automatically in Travis CI for Debian, Centos and Ubuntu. I am happy that Linux distributives finally came to the common daemon managing tool — systemd. And it’s cool that we also have Docker now — which allows to abstract host machine distributive nuances away.

Another interesting feature we have now is HTTP/2 support. And it was just a free gift from Go language developers. Starting from Go 1.6 HTTP/2 natively supported by Go standard library.

Next, we refactored Redis Engine to use protobuf encoded messages between nodes. Protobuf allows to encode message up to 10x times faster than standard library JSON encoder. The same for unmarshaling. As most of messages do not have current active receivers this was a great benefit for us.

In autumn I started a grand refactoring of Centrifugo internals. Thousands of lines changed during it:

Screenshot of pull request summary on Github

The goal was to separate code into different packages with well-defined exported API. It was a hard work but now it’s done and I am happy that we released Centrifugo 1.6.0 (and soon 1.6.1 with some fixes) recently.

Latest release includes more Redis engine performance improvements and Redis sharding support. Now we can finally use the word “scalable” towards Centrifugo:) We use consistent hash algorithm called Jump (pdf) to spread load between several Redis instances.

And we also support a modern stuff — automatic TLS certificate handling from Let’s Encrypt. In most cases you will put TLS termination work on your reverse-proxy/load-balancing software but for some scenarios when you want to put this on Centrifugo — it will handle certificates for you.

What I worry about is state of SockJS client library which seems abandoned by maintainer last months. It has always been best in class so I hope everything will be fine soon.

I want to thank all Centrifugo contributors and users for all the help, pull requests, ideas, bug reports and feedback! Happy New Year everyone:)

--

--