Any library or service can be implemented as a service in Cocaine using a special API. Several indispensable services have already been implemented this way, including a service for detecting a user's region or language, a service for accessing MongoDB storage, and a URL fetcher.
|Developer(s)||Andrey Sibiryov and Yandex team|
|Initial release||March 20, 2011|
In times when cloud technologies were not yet popular Andrey Sibiryov, the project founder, discovered Heroku. At that time Heroku was an app engine supporting only Ruby but the idea itself was somewhat revolutionary. It was possible to create a Ruby app, push it to the cloud and do not pay attention to any infrastructure problems. Load balance problems were covered as well.
The idea was great but it was hard to find any description how it worked, which became a reason to start yet another open source cloud app engine project. The same logic was followed by many developers, which lead to many cloud project start up.
Initially Cocaine was a developer's pet project. However, everything changed when Yandex discovered an internal need of a scalable platform which could cope with millions of RPS. Cocaine served best for these purposes. Now, Cocaine is used in the Yandex infrastructure.
The cloud is made up of one or more independent machines that have the Cocaine server (Cocained) installed. Users know nothing about the location of the services they are accessing — only the address of the load balancer and the app name are available to them. User requests are sent to the load balancer, which passes them to the cloud. In the cloud, the optimal machine is selected for each request, and then the request is executed. The infrastructure details and the app's environment settings are hidden from the developer, as well. The developer only needs to send the code to the cloud and write a special manifest for executing the code. It is not necessary to set up anything else, such as databases, key-value stores, or HTTP clients. There are services that do this, which from the programmer's point of view are native modules for the programming language the code is written in. For example, the Storage service lets users access Elliptics storage, and the Uatraits service uses data about a client's user agent and its HTTP headers to determine the characteristics of the device that sent the request.
Docker project was chosen as a technology for infrastructure virtualization and app isolation. Docker is an open source technology that provides an easy and effective way to create lightweight, portable and self-sufficient containers from any app. Once created, such containers can run in virtually any environment, from the developer's and tester's laptops to production clusters with thousands of nodes. The Docker technology is based on the well-known Linux Containers (LXC), which, by themselves, only provide the ability to start apps in an isolated environment, due to the use of namespaces and cgroups. In contrast to full virtualization environments such as Xen and KVM, containers share a common kernel and cannot provide device emulation, but their use doesn't incur additional overhead and they start almost instantly. In addition to containerization, Docker provides tools for configuring networks and creating images of apps using a layered filesystem designed to minimize overhead on deployment and distribution of apps. In Cocaine Docker support is implemented as a plugin, which connects to the dockerd daemon and controls it using a rich REST API.
Applying the technology
- Amazon Web Services
- Engine Yard
- Rackspace Cloud
- Windows Azure
- Cocaine PaaS (official site).
- "Search Engine Giant Yandex Launches Cocaine", TechCrunch, 2013-10-16.
- "Russian Google Yandex Free Cloud Service Cocaine", The Guardian, 2013-10-17.
- "Free Cocaine giveaway from Russian Search Engine Yandex", The Register, 2013-10-17.