📜 ⬆️ ⬇️

Hola: principles of work

One of the developers talked about where the startup Hola came from, and above all - about the technical aspects of the company.

Background of Hola

Suppose in the average county town of N two providers get along peacefully, and one of them (P1) offers its customers a prize for connecting: a jar of jam, and a packet of cookies. Consequently, he has more customers than the second provider (P2). But the entire budget of P1 was spent on sweets, and his channel is not particularly wide and is constantly loaded. A channel P2 is wide, but most often idle. P1, of course, not in a hurry to share their channel with customers P1. As a result, we have a large part of the population with diabetes, inefficient use of the channel, caused by healthy market competition.

Another situation. In one of the districts of the county town N, all residents are like cats. And they regularly watch themselves and share with each other links to funny videos on Youtube. It turns out that at the same time not only citizen Vasilius drags the rather large video sizes to himself from the overseas store, but all the other residents of the microdistrict do the same. As a result: Youtube has to spend money on caching servers closer to town N, and providers - on expensive traffic across the oceans. But it would be much easier and cheaper to get a video directly from Vasisualiya!

Perhaps it was the thoughts above that prompted two startups who recently sold their previous brainchild, Jungo, for a hundred lemons and vowed themselves not to work anymore in the day in their lives, solemnly promising to break it. And they created Hola.
')
Origins

At the heart of Hall is an HTTP-based protocol, using which peers playing different roles communicate with each other. The traffic is encrypted and then archived using zlib, with one (not very documented) feature of which is an amusing incident. For quite a long time, with enviable periodicity, here and there, the client suddenly broke off all the connections, made his face a brick, and in general behaved asocially. It happened rarely, and everyone diligently pretended that it was necessary. So far, after one of the updates, this phenomenon has not become widespread.

When the patience overflowed, a raid was announced on the bug, which resulted in the following: in the zlib version behind the number 1.2.5, with a very specific content of the input stream, an empty block was added to its end. The modification of the library from this lost faith in humanity and fell into depression, because of which the entire protocol collapsed. And updating client code led to the fact that the ill-fated sequence began to appear much more often. The crutches were bolted to the server with an emergency rate and a patch was applied to the clients with wide ties. Well, at the same time, it was decided to upgrade zlib to version 1.2.8, in which this feature was recognized as a bug and fixed.

Little about hierarchy

The processing of any request from the browser Hall begins with a call to the elder brother - the server. From the point of view of the client, such a server alone is responsible for everything. But in fact, he only forwards requests to the right address. For example, a server that is responsible for authorization, or a dating site server that helps two clients connect to each other, taking into account all their features. So, for example, if one client wants to join another, which does not have an open port, but the first one has that port, the server will send the second command to join the first one. Connection methods are currently being developed, when neither side has an open port.

Also, in addition to clients, there are also many (really many) servers scattered around the world, playing the role of clients and having ports open for connection. Depending on the needs of the client, they can either simply forward traffic through themselves, or mediate in conjunction with another client. This may be necessary when certain services actively ban proxy servers based on a large number of connections from a single address (this includes Netflix with Hulu). And when requests come more or less evenly from all the millions of customers, there’s no particular barking.

And finally - the most interesting and unexpected.

The fact is that Hola has a wide range of possibilities for diagnosing various problems, as they say, in field conditions (people who are to some degree suffering from paranoia and used to know that Hola is just a virus). One of them allows you to strictly specify a group of peers, through which the traffic from the developer's client chases so that specific problems are easily reproducible.

One day, one of the Hola developers noticed that his colleague listens to music from the well-known music service Pandora (which is blocked all over the world outside the US). It turned out that if you take a group of peers, staying in the US, then the traffic will, respectively, chase through them. And blocking it on the basis of the fifth column is impossible. Now the demand for "side effect" even exceeds the need for an Internet accelerator. Gigabit channels and so on each dog, but watch netfliksy from Uruguayan and sit in Facebook from Iran and other Chinas - give two, and at once.

Hola Developers

Even if the request should not bypass any regional restrictions, the server’s task is to decide which client to send it based on the mutual location of the two clients, the presence or absence of the desired content in the cache, peer workload and many other factors.

One day, a relatively fresh developer spoiled the load sharing system between network nodes with his commit, causing the entire network to rest for several hours.

It is the opportunity to break everything with one wrong sneeze that keeps a considerable staff of people who constantly: during the day, at night, on holidays and weekends (and even on Monday!) Monitor what is happening, and at the slightest sign of trouble, those responsible for the head are beaten with alarm.
Of course, only the most hardy cope with such incredible responsibility. As with the writing of programs - only the best. We are looking for them in the daytime - with fire, at night - without fire. And since we only believe in code, we don’t even look at summaries and other achievements.

There is a decent job - send , become a highly paid employee of Hola. Unless, of course, have an interview with a crazy chief programmers, obsessed with the quality of the code.

Source: https://habr.com/ru/post/227189/


All Articles