Where Servers Are Going
There was a brief era when everything had “Flavor Crystals:” chewing gum, deodorant, sports drinks mix, toothpaste, air fresheners, whatever. If you had a product, it could be made more compelling with flavor crystals. When the term “Cloud” was first coined, it simply referred to the idea that computing power on the Internet should be bought and sold like electricity. Gradually “Cloud” has taken on lots of meanings and become the Flavor Crystal of the modern IT world. I wonder, however, if Cloud-related technologies (including DevOps and containers) have received all the attention and left no space to discuss other trends. In this post, I thought I would mention some interesting stuff that the web team at Big Nerd Ranch is working on.
Trends That Are Pushing Server Technology
There are three big trends that are pushing server-side innovations:
- The next billion users are in the developing world, where connectivity is not as reliable.
- Users are expecting real-time collaboration.
- The Internet of Things will begin to generate billions of streams of events to be processed and stored.
Let’s start with a reaction to the first trend: Facebook acknowledged the growing importance of users in the developing world by creating the Facebook Lite app for Android. In their write up about Facebook Lite’s architecture, they describe a system that:
- Doesn’t use web services, rather it communicates over raw TLS.
- Compresses messages in each direction.
- Pushes assets before the client requests them, where possible.
Thus, Facebook is able to create a very responsive user experience over 2G networks.
For twenty years, we have been writing servers that respond to HTTP requests coming in from clients. And now Facebook is writing a server that doesn’t use HTTP?! And the server doesn’t wait for requests, but pushes stuff to the client that it thinks the client might need?! Everything has changed.
Second trend: users want to collaborate in real-time. If one user changes a piece of data while another user is looking at it, the server should push the change to the client. How do we write clients that are always listening for new data from the server? How do we write servers that perform two-way communications over WebSockets?
Third trend: The Internet of Things means that billions of new devices will be given IP addresses and put on the internet. And then they will begin to spew events. Processing and storing these streams is leading to a lot of interest around stream-processing technologies (like Apache Kafka) and databases that deal with time-series data with grace (like Cassandra).
Just like a collaborative app, a thermostat on the internet demands two-way communication with the server. The thermostat sends a stream of temperatures to the server and waits to get orders from that server.
Learning From Game Companies
Fortunately, there are engineers who have been working very hard to create servers that can support two-way communication with millions of clients: the servers for massively multiplayer online games. If you want to know what the future of client/server communication looks like, think of World of Warcraft. Each server will have hundreds of thousands of clients attached. For each user, the server will have a socket open to the user that will enable two-way communications.
In the game server development community, there are two popular approaches to this problem. One approach is to have a single-threaded server that never blocks. The poster child for this approach is Node.js. The other approach is to use a language with very lightweight threads so that each socket can be monitored by its own thread. The poster child for this approach is Erlang.
At Big Nerd Ranch, we appreciate both approaches. We teach how to write a chat server using Node.js in our book “Front-End Web Development: The Big Nerd Ranch Guide”. However, we find Erlang’s approach (lightweight threads coordinated using message passing through channels) to be consistently elegant and efficient. Erlang’s syntax can be a bit inscrutable if you haven’t worked in it before, so we typically work with its cousin Elixir. Erlang/Elixir also comes with OTP, a very mature and sophisticated framework for developing networked servers.
How We Can Help
Maybe you are thinking about developing a mobile or web app that requires more sophisticated server smarts than your team feels comfortable creating. Big Nerd Ranch can help.