Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
Daniel Krook edited this page Mar 9, 2017 · 15 revisions

OpenWhisk Hands On: Cloudant Data Processing

This wiki contains the getting started content posted to both Bluemix and the Accelerate developer advocacy site.

Bluemix tile title and description

Respond to database changes Create auto-scaling actions that execute logic when text or images are inserted into a Cloudant database.

Accelerate intro

Serverless platforms like Apache OpenWhisk provide a runtime that scales automatically in response to demand, resulting in a better match between the cost of cloud resources consumed and business value gained. One of the key use cases for OpenWhisk is to execute logic in response to records inserted or updated in a database.

Instead of pre-provisioning resources in anticipation of demand, OpenWhisk actions are started and destroyed only as needed in response to demand. Each event handler action scales (and is billed) independently in direct correlation to the volume of requests.

Accelerate overview

This project shows the power of serverless, event-driven architectures to execute code in response to database changes.

It shows two OpenWhisk actions (written in JavaScript) that write and read text and image data to Cloudant, a hosted Apache CouchDB service. The use case demonstrates how actions can work with data services and execute logic in response to database changes.

One action connects to Cloudant and inserts text and binary data as an attachment. It is defined with package variables that provide it with Cloudant credentials as environment variables. It is uploaded to the OpenWhisk platform, where it can be invoked manually to test.

A second action is created to respond to changes inserted into Cloudant by the first action. Instead of being manually invoked by the developer, a trigger and mapping rule are defined that bind it to the Cloudant database and listen for changes.

Accelerate flow and diagram

  1. The developer uploads and invokes the first action manually, this connects to Cloudant and inserts data.
  2. The data inserted by the first action in turn fires an event called a trigger. This trigger is mapped to a second action by a rule.
  3. The second action executes in response to the event, inspects the data, and logs information to the console.

Accelerate components

  • OpenWhisk
  • Cloudant

Accelerate technology

  • OpenWhisk
  • Cloudant

Accelerate links

  • What makes serverless architectures so attractive? - Serverless architectures are one of the hottest trends in cloud computing this year, and for good reason. There are several technical capabilities and business factors coming together to make this approach very compelling from both an application development and deployment cost perspective.

  • Build a cloud native app with Apache OpenWhisk - At this live coding event, Daniel Krook provides an overview of serverless architectures, introduces the OpenWhisk programming model, and then deploys an OpenWhisk application on IBM Bluemix, while you watch, step-by-step.

Accelerate blog post

Analyze Cloudant database changes with OpenWhisk

In many of today's cloud-native applications, data is generated at huge volumes. It's often collected as a raw feed of information that must be replicated, processed, and transformed to extract value. Many NoSQL platforms provide built in map/reduce functionality, but what if you have to invoke another data service or system instead?

With an event-driven architecture built on OpenWhisk, you can write functions that respond to changes in databases and execute logic to process or send data to other systems in a modern distributed architecture. And you would only pay for the resources consumed by your analysis logic for the fractions of a second that it runs.

This is the promise of an event-driven, serverless architecture for new cloud-native analytics applications such as those that support database transformations. Check out the new OpenWhisk demo on responding to Cloudant data changes and start realizing the value in your data, not worrying about whether you'll have enough servers to extract insights from it.