Prana: A Sidecar for your Netflix PaaS based Applications and Services

Netflix Technology Blog
Netflix TechBlog
Published in
6 min readNov 5, 2014

“The Right Tool for the Right Job”

It’s hard to argue against this time tested mantra. At Netflix, an overwhelming part of our applications and services have traditionally been implemented in Java. As our services and products evolved, we asked ourselves if Java was still the right choice for implementing these services/applications. While it’s still true that for most of our microservices Java is the right choice, there were a growing set that begged for a closer look at alternatives.

For example, Javascript is a natural fit for Web Applications and we fully embraced Reactive Extensions pattern via RxJS for our UI layer. While Javascript has traditionally ruled the roost on the Web UI front, the advent of Node.js made Javascript and Event based models a force to reckon with on the server side as well.

Python, for example, is a popular choice for many machine learning and recommendation systems.

Over the years, we have evolved and rapidly augmented our stable of libraries that constitute the Netflix PaaS ecosystem. For the most part these libraries were traditionally implemented in Java. While we wanted to embrace Python and Node.js and other non-java based tools and frameworks for the right reasons, we also wanted to be able to leverage our existing Java libraries and services and continue evolving them. Duplicating the functionalities of these libraries in different languages was undesirable as it would lead to duplication of effort and increased cost in terms of maintenance and developer resources to say nothing of the bug fixes that may need to be ported across these languages.

How could we leverage our Java libraries and services infrastructure while aiding and supporting our increasingly Polyglot ecosystem?

A Polyglot Cloud Ecosystem

A Sidecar was the solution we naturally evolved into.

A sidecar by definition is “A one-wheeled device attached to the side of a motorcycle, scooter, or bicycle,[1] producing a three-wheeled vehicle.”.

Sidecar as a solution for providing applications with “non-intrusive platform capabilities” has gained popularity outside of Netflix as well, especially in the NetflixOSS ecosystem where many users have used this concept. Andrew’s earlier blog post while he was championing NetflixOSS within IBM addresses some of the motivations and philosophies.

Prana is the Sidecar we use at Netflix.

We are happy to add Prana to the collection of open source components under the NetflixOSS banner. Prana is available on Github at http://github.com/netflix/Prana.

Prana is conceptually “attached” to the main (aka Parent) application and complements it by providing “platform features” that are otherwise available as libraries within a JVM-based application.

Architectural Diagram of Prana

The diagram above shows a typical application/service implemented in a non JVM language (Python, RoR, Node.js etc.) accessing various Platform Services via Prana the sidecar which is hosted alongside the main application in the same host/vm.

Motivation

The motivation for creating Prana is to provide Netflix platform functionality for the following two broad application categories:

  • Non JVM based applications: Since, most Netflix platform libraries are written in Java and there is close to no support for any other languages, it becomes increasingly difficult for non JVM based applications to fit into the Netflix environment, eg: register with Eureka, log events to Suro, read Archaius based Properties, invoke other micro-services safely via Ribbon, etc. Prana makes this possible by providing these functionalities over HTTP from a locally available server (on the same virtual instance.)
  • Short-lived processes: Initializing various “Platform” libraries is a heavy operation and for processes that are short-lived, eg: jobs, batch scripts, etc. it is an unnecessary overhead for each of these short lived processes. So, even though these processes are JVM based, Prana will alleviate the overhead of platform initialization.

Key Features

Eureka (Metadata Registry) Registration

  • Prana registers the parent application with discovery and hence makes the parent application “discoverable” inside Netflix infrastructure.

Service Discovery

  • For application client with their own load balancers that don’t need Proxy, eureka/hosts gives you a view of the current set of instances so you can update your own load balancer information.

Dynamic Properties

  • Sidecar integrates with Archaius to allow for side managed processes to get updates to dynamic properties.

Proxy

  • IPC calls that are efficient, high performance and resilient (i.e. employ the concept of circuit breakers, bulk heading and fallbacks) to other Services in the ecosystem is an important aspect of a microservices/SOA based architecture. Prana proxies requests to other micro-services using Hystrix/Ribbon thus enabling the parent(main) application to invoke other micro-services inside Netflix using the same resilient stack as used by other JVM based applications.
  • At Netflix, we are taking measured steps to evolve many of our high throughput IPC based apps/services to employ the new Reactive/Asynchronous programming model. Prana allows the main applications to utilize these high throughput IPC mechanisms via a proxy endpoint.

Healthcheck

  • Advertises the healthcheck endpoint to Eureka and provides extensible healthcheck implementation, which involves checking the health of the parent(main) application.

Admin UI

  • Since Prana is a Karyon application, it can leverage the Karyon feature of an embedded Admin Console. The admin console provides runtime insights and diagnostics of the server and its environment.
  • Prana also comes with a pluggability feature that would allow for other plugins to be added for easy extensibility.

A note on usage

The usage of Prana inside Netflix is mainly in applications where we can’t plug in our JVM based client libraries. We use Prana with non JVM applications and also with any application which is not developed on the Netflix stack. For example, we run Prana alongside Memcached, Spark, Mesos servers to make them discoverable.

Functions such as Hystrix, Eureka registration and health check, when integrated within a JVM based application via the respective java libraries will work better operationally given the internal knowledge the application has of itself as opposed to being accessed via a Sidecar. Also, functions such as dynamic properties and metrics are more efficiently queried and updated within the application process as compared to calling cross process.

Getting Started

You can take Prana for a quick run by following the instructions at https://github.com/Netflix/Prana/wiki/Getting-Started.

Summary

Homogeneity is a great asset while operating and managing a heavily microservices based ecosystem. An effective way to provide such homogeneity in terms of platform-infrastructure is by leveraging the concept of a Sidecar. Prana fulfils this functionality and provides us the ability to employ the best suitable language/framework for our increasingly complex and heterogeneous Cloud ecosystem.

We hope that Prana will be a welcome addition to our already growing NetflixOSS ecosystem. We welcome contributions in terms of code, documentation or ideas to Prana or any of our other NetflixOSS projects.

If building innovative infrastructural components is your passion, we are looking for great engineers to join us and further augment our PaaS infrastructure.

Contributors: Diptanu Gon Choudhury, Sudhir Tonse, Andrew Spyker, and Raju Uppalapati

See Also:

Originally published at techblog.netflix.com on November 5, 2014.

--

--

Published in Netflix TechBlog

Learn about Netflix’s world class engineering efforts, company culture, product developments and more.

Written by Netflix Technology Blog

Learn more about how Netflix designs, builds, and operates our systems and engineering organizations

Responses (1)