Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

OpenWhisk: A FaaS Platform to Create and Run Event-Driven Apps that Scale on Demand

DZone's Guide to

OpenWhisk: A FaaS Platform to Create and Run Event-Driven Apps that Scale on Demand

OpenWhisk is a powerful tool for creating both web and mobil applications. Learn how to set it up and use OpenWhisk's CLI.

Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

This blog post introduces you to Serverless computing, OpenWhisk (a serverless, open 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 computer part of the cloud? Will that be in minutes or less than a 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 everything 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 it 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 computer 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 encapsulated 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.
  • 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, and run the below command:


echo $PATH

Command output:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/usr/local/git/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/IBM/MobileFirst-CLI:/Users/VMac/Downloads/apache-maven-3.3.9/bin
  • 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…..)

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:
mobile ,application development ,cli ,openwhisk

Published at DZone with permission of Vidyasagar Machupalli, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}