Skip to Content

In this post, I think about the importance of core technologies, and how the arrival of functions-as-a-service might be merely the next incarnation of an idea that’s existed for a while.

This weekend I picked up on a conversation about RSS (alternatively standing for RDF Site Summary, Really Simple Syndication and Rich Site Summary) and how authors should include the whole blog post contents in the RSS feed. There was some wonder within the conversation thread that RSS was still being used; despite the disappearance a few years ago of arguably the pre-eminent RSS reader, Google Reader, RSS is alive and well and powering syndication & sharing on the web even today. (If you want to know more about RSS, its history and its relation to OData, you might want to read “Monday morning thoughts: OData“.)

That got me thinking of the protocol upon which RSS relies – the venerable HyperText Transfer Protocol (HTTP). HTTP has been around for a long time, and in the same way that email has become a sort of universal mechanism for asynchronous communication, HTTP is a universal mechanism for all sorts of things. Why is that? Well, I think one reason is its beautiful simplicity. When HTTP first arrived on the scene, I remember being delighted by it and indeed by the similarities with email.

 

The beautiful simplicity of email and HTTP

The official request for comments (RFC) document number 822, from the Internet Engineering Task Force (IETF) describes, amongst other things, what an email looks like. There are headers, and a body – the email message, effectively. Headers are name:value pairs, and the headers are separated from the body by an empty line. Here’s a simplified example:

Message-ID: <23944892.154212220.SomeMail.root@2ea9232e1>
From: Sender <sender@example.com>
To: recipient@example.com
Subject: The email subject line
Date: Sat, 10 Nov 2018 14:25:13 +0000 (UTC)
Content-Type: text/plain; charset=UTF-8

Greetings, earthling!

In HTTP, described in RFC 2616, messages are either requests or responses, and in both cases, the structure is the same: headers in the form of name:value pairs, an empty line, then the payload of the request or the response. Here’s a simplified example of an HTTP request (this one doesn’t have a payload) and the corresponding HTTP response:

Request:

GET /qmacro/blog/ HTTP/1.1
User-Agent: Mozilla/5.0 (X11; CrOS x86_64 11151.17.0)
Host: pipetree.com
Accept-Language: en-gb
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

Response:

HTTP/1.1 200 OK
Date: Mon, 12 Nov 2018 06:43:07 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Type: text/html; charset=utf-8
Content-Length: 10557

<!DOCTYPE HTML>
<html>
<head>
<title>DJ's Weblog</title>

There’s a beauty in the simplicity and similarity across all these different examples – they follow the same pattern, even sharing some headers (such as Date and Content-Type), and above all they are human-readable*.

*the advent of HTML email has made that a little more challenging, and brought about the death of many excellent text-only email clients such as (my favourite email client of all time) mutt, but that’s a story for another time.

There have been attempts at improving upon today’s HTTP, and you can see those attempts in the form of SPDY and HTTP/2.0. And of course we have web sockets and the WS protocol prefix being utilised between server and client (browser) … but ultimately the core of HTTP remains strong and ubiquitous. Indeed, in the Las Vegas and Barcelona editions of one of my SAP TechEd sessions this year – LT106 “Understanding the Available Paths for Developers Throughout SAP“, I have exhorted the attendees to learn core technologies regardless of the path they take. One of these core technologies that I think everyone should learn is HTTP.

 

Probot and Webhooks 

Something else I looked into this weekend was a result of my attendance last week at DevRelCon 2018 London, where, amongst other things, I learned about all sorts of tools that GitHub has to offer above and beyond what I consider core (social coding via repository & project management based around the distributed source code control system “git”). One of these tools is Probot, which allows you to use apps to extend processes managed within GitHub.

Probot logo

The Probot character

The apps can be pre-built, or you can create your own. Essentially Probot is a layer built on top of a couple of fundamental mechanisms – webhooks and the GitHub event API, making it easier for these apps to be constructed.

Let’s look at webhooks for a minute. What are they? Think of webhooks as an architectural pattern based usage of HTTP. The concept of webhooks has been around for more than a decade – first invented and popularised by Jeff Lindsay – see his post “Web hooks to revolutionize the web” from 2007. He describes them as “user defined callbacks made with HTTP POST”*, and a core use case for webhooks at the time was to address the challenges of polling – the repeated requests one piece of software makes to another, asking, over and over again: “anything new?”, “have you finished it yet?”, “do you have anything for me?” and similar requests. The polling pattern is often the simplest to think about and implement, but it’s rather wasteful and inefficient.

*Interestingly, Jeff likens webhooks to pingbacks, which I wrote about in last week’s post: “Monday morning thoughts: on starting blogging“.

Back in 2007 when Jeff described this architectural pattern, we immediately saw the possibilities of a web of event-driven services, loosely connected via HTTP. At that time, HTTP was the lingua franca of inter-application communication.

Today, it still is. Look at the other half of what Probot is built upon – GitHub’s event API. Want to have some checks automatically carried out when source code is updated? Want to trigger a process in your organisation when a pull request is made to a specific repository? Register a callback, to be executed when these events happen. The form of that execution is simply some code, somewhere, that responds to an HTTP request, a request that is made by the system that is raising the event (GitHub in this case), and making that HTTP POST to the callback endpoint you registered. Again, this is where knowing about the HTTP protocol in general, and understanding the nature of how HTTP server frameworks function, is an essential skill, in my opinion*.

*one of the ideas that drove me originally to create the Alternative Dispatcher Layer (ADL) for the ABAP stack was the lovely similarity between HTTP server frameworks large and small, across different languages and environments. See “A new REST handler / dispatcher for the ICF” and Nigel James‘s presentation “Alternative Dispatcher Layer Overview” for a little bit of background reading.

 

Functions-as-a-Service (FaaS)

Today’s serverless paradigm is a utility computing model where cloud vendors (such as SAP) provide compute resources, dynamically managing the allocation according to load, and charging based directly (and only) on resources consumed, rather than on pre-allocated units. This is a perfect example of cloud native computing, and amongst other things, it allows, even encourages us to think in terms of small computational executions, and to construct solutions out of loosely coupled building blocks.

I’ve written about FaaS in a previous post: “Monday morning thoughts: functions – what functions?” but I thought it was worth continuing the “loosely coupled” idea in this direction. The appeal of SAP’s FaaS offering is especially interesting to us as folks who build enterprise business solutions because the serverless fabric extends into the business processes themselves, as we saw for example in the SAP TechEd 2018 Las Vegas keynote demo from Jana Richter and Ian Kimbell (see “Speed with Serverless Apps: SAP Cloud Platform Functions at SAP TechEd 2018“).

Essentially we can see that there are commonalities between various FaaS solutions, not only with SAP but with the hyperscale providers too, on how code is invoked:

  • Triggers: you can invoke a function directly with an HTTP call
  • Events: functions can be invoked as and when appropriate, based on the occurrence of various events, whether those events are business related or service related (for example – Google Cloud Functions offer events based upon Cloud Storage and Cloud Pub/Sub)
  • Timers: in a wonderful acknowledgement of the enduring nature of various Unix designs, you can use the language of cron to schedule time-based invocations of functions on SAP Cloud Platform

Moreover, the commonality doesn’t stop at the invocation level. At the end of the day, what are being invoked are functions, and the API is HTTP flavoured. Discrete functions with a well-defined, (well-loved, perhaps?) interface: The function receives the call and its context, in the form of an object representing the HTTP request, with the method, the URL path of the resource, the headers and any payload that is sent. It also receives an empty object representing the HTTP response, and it can and should populate that object appropriately, before “letting go” and allowing the server infrastructure take care of what happens after that.

Note that the primary purpose of these loosely coupled HTTP-invoked functions is not always to return a rich response, but to perhaps perform some computation, store some data, change some state, as an appropriate reaction to the original event. These are not pure functions – many will have side effects (so it’s appropriate for the method to be POST). But now I’m (semi-deliberately) mixing in functional programming concepts, which is a valid thing to think about here too, but perhaps I’ll leave that for another time.

 

Loose coupling and management

I’d like to end this post by encouraging you to think about the nature of this idea of loose coupling of functions, and event-based invocation. There’s a huge amount of potential, and of flexibility, especially in the context of trying to keep the core clean (see “Keep the Core Clean: Clarifying Points from Björn Goerke’s Keynote” by Jerry Janda) by extending computation for business services in the cloud.

One challenge is the management of the events and the functions written to be invoked at the events’ occurrences. In a similar way to how we have to think about managing a large software project, with modules and libraries, we have to think about how we will go about managing this new style of resources.

How will we retain an overview of what we have, and what is invoked when? Our tools should help us there to some extent. How do we manage the intersection of business process requirements and the triggering of actions and reactions? Perhaps that’s more of a human-led activity that is only assisted by tools. I don’t know yet. It’s something that Dennis Howlett and I touched upon at SAP TechEd 2018 Barcelona (see the audio content “Towards a more open SAP?” that Den and I recorded at the event), and a topic that we should explore more together.

 

If you learn about one thing this week, I hope I can make an argument for it to be about HTTP, and how you write HTTP services in the framework relating to your favourite language. As well as being a meditation on a now-venerable protocol, it will help you step into this new era of cloud computing.

 

This post was brought to you by the prospect of a relaxing week off, by the distraction of the falling leaves outside, and by Pact Coffee’s Asomuprisma.

 

Read more posts in this series here: Monday morning thoughts.

 

Update 20 Nov 2018: See James Governor’s post “GitHub Universe 2018: Low Key Revolutionary” on the recent GitHub conference and more on serverless in relation to the recently released GitHub Actions.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Michelle Crapo

    Love your posts.  HTTP – it was one of the first things I learned with xMII or whatever they are calling it these days.

    It can be so simple and easy to use.  (Of course for me, easy can be hard some days)

    (1) 
    1. DJ Adams
      Post author

      Thanks Michelle, always good to hear from you in the comments to these posts too. HTTP is simple, yes. But of course, like most things, it’s not *always* simple 🙂

      (1) 
  2. Nabheet Madan

    Super thoughts sir, one thing which i would like to provide my 2 cents about is Loose coupling. I don’t know whether i am wrong or right  but i see a lot of similarity in most of the architectural styles who want things to be loosely coupled. That similarity I feel  is the loosely coupled integration between events on one side and reacting to those event via microservices or http calls something on similar line.

    I have been trying to get my head around Docker and Kubernetes off late and luckily stumbled on Kyma the project which is built by SAP running on K8S. I was looking for some resource to understand what it is. Just today i watched the video of one of the CFNF conference. Trust me sir its what you have described. Events from cloud-> Connector-> extensions consisting most lambda functions or serverless running on top of K8S.-> Some cool dashboard for logging and all. -> FaaS calling another API’s etc.

    The way applications are loosely coupled and how they interact via api’s or microservices is something i see everywhere in modern cloud related stuff whether it is AWS or GCP or Azure etc.

    I still have an unanswered question isn’t a FaaS an is just like another API call? For example if i have a server with Node/express running with different endpoints isn’t each endpoint as good as a FaaS. The only difference i see is the way how client is billed for using it. What are your thoughts sir?

    Nabheet

     

     

    (3) 
    1. DJ Adams
      Post author

      Hey Nabheet, great thoughts as usual, thanks for your interaction! To your question, I do think you are going in the right direction. For me a large part of FaaS is the platform and runtime / billing philosophy. There’s nothing new in how functions are actually implemented. But sometimes incremental changes outside the core (in this case how things are put together) can make a big difference.

      (0) 
  3. Nigel James

    Thanks for the shoutout DJ. Ahh those ADL days. It was such a simple idea and one that many languages still implement well today. It would be well for the ABAP in the cloud to include access for the creation of HTTP handlers as in reality that what is serving the whole box and dice anyway.

    N

    (1) 
    1. DJ Adams
      Post author

      Cheers Nigel. The simplicity and ubiquity of HTTP is still a big selling point today, even though there are of course other protocols for messaging. Not better, not worse, just different.

      (0) 

Leave a Reply