JAX London Blog

JAX London, 09-12 October 2017
The Conference for JAVA & Software Innovation
13
Sep

The Serverless Cloud, part 3

Collaborative economy image via Shutterstock

In the third part of the "Serverless Cloud" series, JAX London speaker Bart Blommaerts looks at serverless as an enabler of a collaborative economy.

This post was originally published on Bart Blommaerts’s blog: Daggie.be

In the first part of this series, I introduced the Serverless architectural style. In the second part, I compared all major serverless providers. In this third and last part, I would like to look at serverless as an enabler of collaborative economy.

Collaborative Economy

What is collaborative ecomomy?

Benita Matofska: The Sharing Economy is a socio-economic ecosystem built around the sharing of human, physical and intellectual resources.

It includes the shared creation, production, distribution, trade and consumption of goods and services by different people and organisations.

The last part of Benita’s quote: shared creation, production .. of services by different people and organisations makes a very nice use-case for the serverless style of building applications.

Your data

In this day and age, all companies have become IT companies, meaning a lot of data is gathered and stored somewhere. Often the usage of the available data changes over time. If data is not used for the benefit of the enterprise or its employees, does it still hold value? Wouldn’t it be great if we could turn cost into profit?

Thanks to its cost model (pay per execution), its focus on scalability (no risk of overprovisioning) and resilience, serverless enables companies to experiment with exposing their data:

  • Offering an API for others to consume
  • Enriching existing API’s with their data

Your ideas

Serverless also makes a lot of sense for companies that don’t want to expose their data, but have great or new ideas on how to use others data:

  • Combining data from multiple providers
  • Filtering and transforming data
  • New business cases beyond the scope of the original API

Example

I implemented a small and simple application that will consume data from different serverless cloud providers. Every “hop” in the system will parse its input and add some new data.

Component diagram

Description

Any client can post a JSON to the first function, made with Auth0 webtask. The body of the post request is simple:

1
{"temp":"42"}

The WebTask will parse that input, add some input of its own and POST request to an IBM OpenWhisk action. The body of this POST request:

1
2
3
4
5
6
7
8
9
10
{
  "hops": [
    {
      "provider": "Auth 0 Webtask",
      "start": "2016-08-24T20:32:03.629Z",
      "temperature": "42",
      "stop": "2016-08-24T20:32:03.629Z"
    }
  ]
}

To continue the chain, IBM OpenWhisk will POST the parsed JSON to a function on the AWS Lambda platform after adding a new “hop”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
  "hops": [
    {
      "provider": "Auth 0 Webtask",
      "start": "2016-08-26T18:38:25.021Z",
      "temperature": "44",
      "stop": "2016-08-26T18:38:25.021Z"
    },
    {
      "provider": "IBM OpenWhisk",
      "start": "2016-08-26T18:38:35.024Z",
      "temperature": "42",
      "stop": "2016-08-26T18:38:35.024Z"
    }
  ]
}

The Lambda, created with Serverless V1.0 Beta 2 will parse the input again and create items in an AWS DynamoDB:

The AWS DynamoDB table will stream events to another AWS Lambda that will log the content of the event to the logs of AWS CloudWatch:

The source code of all these components is available on GitHub.

Best practice

Obviously I wouldn’t recommend anyone to use a different cloud provider for every function. Choosing the right one will depend on your specific needs, goals and current cloud landscape. In the previous part of this series, you may find some tips on how to make a reasoned choice.

Acknowledgement

I would like to thank my Ordina colleague Ken Coenen for working with me on Collaborative Economy a few months ago.

 

Read more:

Serverless Cloud – Part 1

Serverless Cloud – Part 2

JAX London talks by Bart Blommaerts:

Behind the Tracks

Software Architecture & Design
Software innovation & more
Microservices
Architecture structure & more
Agile & Communication
Methodologies & more
Emerging Technologies
Everything about the latest technologies
DevOps & Continuous Delivery
Delivery Pipelines, Testing & more
Cloud & Modern Infrastructure
Everything about new tools and platforms
Big Data & Machine Learning
Saving, processing & more