OpenWhisk: A FaaS platform to create and run event-driven apps that scale on demand

OpenWhisk CLI

This blog post introduces you to Serverless computing, OpenWhisk (a serverlessopen source cloud platform that executes functions in response to events at any scale) and guides you in getting started with OpenWhisk on IBM Bluemix.

After writing a post on how to transform your idea into an app in minutes. I started thinking  how about the compute part of the cloud? Will that be in minutes or less than minute or can it be milliseconds ?

Then I read this line in an article

With serverless computing there is no virtual infrastructure for the user to manage and the user is only billed for when their code is running, down to the nearest 100 milliseconds.

So, Let’s start with a question

What is Serverless computing?

Is there no server or a process at all? Nah!

Then where is our program or function running? There is no defined definition of Serverless Computing. Here’s one good definition which I think sums up every thing about Serverless Computing

Serverless computing refers to a model where the existence of servers is simply hidden from developers. I.e. that even though servers still exist developers are relieved from the need to care about their operation. They are relieved from the need to worry about low-level infrastructural and operational details such as scalability, high-availability, infrastructure-security, and so forth. Hence, serverless computing is essentially about reducing maintenance efforts to allow developers to quickly focus on developing value-adding code.

Serverless computing encourages and simplifies developing microservice-oriented solutions in order to decompose complex applications into small and independent modules that can be easily exchanged.

Serverless computing does not refer to a specific technology; instead if refers to the concepts underlying the model described prior. Nevertheless some promising solutions have recently emerged easing development approaches that follow the serverless model – such as OpenWhisk, AWS Lambda, Azure Functions and Google Functions.

A good introduction into the serverless programming model is available on Martin Fowler’s blog.

What is OpenWhisk?

OpenWhisk is an event-driven compute platform also referred to as Serverless computing or as Function as a Service (FaaS) that runs code in response to events or direct invocations.

OpenWhisk

  • OpenWhisk hides infrastructural complexity allowing developers to focus on business logic.
  • OpenWhisk takes care of low-level details such as scaling, load balancing, logging, fault tolerance, and message queues.
  • OpenWhisk provides a rich ecosystem of building blocks from various domains (analytics, cognitive, data, IoT, etc.).
  • OpenWhisk is open and designed to support an open community.
  • OpenWhisk supports an open ecosystem that allows sharing microservices via OpenWhisk packages.
  • OpenWhisk allows developers to compose solutions using modern abstractions and chaining.
  • OpenWhisk supports multiple runtimes including NodeJS, Swift, and arbitrary binary programs encapsulate in Docker containers.
  • OpenWhisk charges only for code that runs.

Getting Started with OpenWhisk

The OpenWhisk model consists of three concepts:

  • trigger, a class of events that can happen,
  • action, an event handler — some code that runs in response to an event, and
  • rule, an association between a trigger and an action.

OpenWhisk model

Develop in your Browser

Try out OpenWhisk in your Browser to create actions, automate actions using triggers, and explore public packages. Visit the learn more page for a quick tour of the OpenWhisk User Interface.

Develop using the CLI

You can use the OpenWhisk command line interface (CLI) to set up your namespace and authorization key. Go to Configure CLI and follow the instructions to install it.

wsk: command not found

While using OpenWhisk CLI, If you are seeing this error on a Mac or Linux machine, Follow the below stepsOn your terminal, run the below command

Command output:

  • Move the downloaded wsk unix executable to /usr/local/bin or /usr/bin (preferable).
  • Now run the command ‘wsk’ to see the below output

Using the OpenWhisk CLI

After you have configured your environment, you can begin using the OpenWhisk CLI to do the following:

OpenWhisk Internals

There are two awesome articles which will take you in-depth into OpenWhisk architecture (from Nginx to consul to kafka…..)

Where to go from here

Polyglot & Pragmatic Programmer • Developer Advocate, IBM • Microsoft MVP • Intel software Innovator • DZone MVB
(Visited 63 times, 1 visits today)

Tagged as: , , ,

Author: Vidyasagar Machupalli

Polyglot & Pragmatic Programmer • Developer Advocate, IBM • Microsoft MVP • Intel software Innovator • DZone MVB