Wednesday, March 6, 2013

Karyon: The nucleus of a Composable Web Service

By Nitesh Kant and Sudhir Tonse


As explained in previous blog posts, Netflix employs a fine grained Service Oriented Architecture. We also believe in and strive towards employing a homogenous architecture. This has the benefit of code and component reuse as well as operational efficiency gained via common understanding and usage patterns.

Given that we have several teams at Netflix that have hundreds of web services built and deployed, how do we ensure a homogenous architecture and share common patterns?

Meet Karyon, the nucleus of our Cloud Platform stack.

Karyon, in the context of molecular biology is essentially "a part of the cell containing DNA and RNA and responsible for growth and reproduction."

At Netflix, Karyon is a framework and library that essentially contains the blueprint of what it means to implement a cloud ready web service.  All the other fine grained web services and applications that form our SOA graph can essentially be thought as being cloned from this basic blueprint.

Today, we would like to announce the general availability of Karyon as part of our rapidly growing NetflixOSS stack. Thus far we have open sourced many components that form the Netflix Cloud Platform, and with the release of Karyon, you now have a way to glue them all together.

Karyon has the following main ingredients.
  1. Bootstrapping, Libraries and Lifecycle Management (via Governator)
  2. Runtime Insights and Diagnostics (via built in Admin Console)
  3. Pluggable Web Resources (via JSR-311 and Jersey)
  4. Cloud-Ready hooks (Service Registration and Discovery, HealthCheck hooks etc.)

Bootstrapping, Libraries and Lifecycle Management

A typical web service needs to load configurations and initialize itself and all its dependencies. Karyon makes this easy with its Component driven architecture.

In Karyon, the Application represents a standalone application or main class of a Web Service. Each Application may consist of many Components.

Each Component can be thought of as belonging to a very complex graph of interdependent components. Karyon relies on Governator to help walk this graph and manage the lifecycle of these components.
You can read more about Governator at our Github location.

Admin Console (Runtime Insights and Diagnostics)

Karyon contains a pluggable Admin Console component that provides a visual interface for observing and managing other components.
The current open sourced version contains only a first-cut stand-in console. We will soon replace this with the more feature rich Console that we use inhouse.

For example, the Admin Console provides a visual interface for the following components.
  1. Libraries (i.e. all the libraries loaded, their versions and other meta data)
  2. Properties Management (i.e Properties inspection and Runtime editing via Archaius)
  3. JMX Console
  4. and more ...  (Servo metrics, Ribbon Clients and Stats, Services discovered via Eureka etc.)


JMX Console

The JMX console shows the list of Beans and its attributes. It is relatively easy to expose your application's operational metrics and data to this console especially when used via Servo.


Properties Console

The screenshot above shows the Properties Console. Karyon offers Archaius as its default Properties Management Component. Note: The more advanced Admin Console shown in the screenshot above will be released in the coming weeks.

Pluggable Web Resources

JSR-311 allows for a very flexible and pluggable Web Resource container. Karyon essentially utilizes and extends this via  Ribbon.

Cloud Ready

Karyon makes it easy to integrate with Service Discovery components such as Netflix's Eureka along with several of the components mentioned below that aid in building a resilient and scalable web service. Karyon forms the nucleus that holds all these together.


Upcoming features

On top of bootstrapping and the features mentioned above, at Netflix, Karyon also provides a flexible runtime semantics, notably:
  1. Request context propagation across services. (when used with Ribbon.)
  2. Enforcing/reporting SLAs.
  3. Request tracing.
  4. Request throttling.
We have focused our current open source offering on bootstrapping. In the coming weeks, we will also open source the runtime aspects of Karyon , which we believe will be immensely helpful in providing added diagnostics and resiliency.


Getting Started

The best way to get started with Karyon and building Web Services is to clone the "HelloWorld" sample web service available at github. The Getting Started page offers more details.



Karyon aims to provide the basic ingredients that form the nucleus of most web services and applications. While Karyon provides the main ingredients for a cloud ready web service, it does not out-of-the-box showcase many of the other components that form the Platform Stack.

A typical web service at Netflix uses many of the building blocks and design patterns in the Netflix Cloud Platform stack. For example:
  1. Runtime Configuration of Properties via Archaius
  2. Inter Process Communication and Resilient Load Balancing via Ribbon
  3. Latency and Fault tolerance via Hystrix
  4. Functional Reactive Programming via RxJava.
Stay tuned for "recipe" applications built around these technologies that will showcase how one can build and implement more nuanced and powerful cloud ready web services.

If you would like to contribute to our highly scalable libraries and frameworks for ephemeral distributed environments, please take a look at You can follow us on twitter at @NetflixOSS.
We will be hosting a NetflixOSS Open House on the 13th of March, 2013 (Limited seats. Please RSVP.) during which we will showcase Karyon and other OSS projects.

We are constantly looking for great talent to join us and we welcome you to take a look at our Jobs page or contact @stonse for positions in the Cloud Platform Infrastructure team.