This proposal is a to outline an approach to OpenWhisk as a source for HTTP APIs that are used to drive UIs in browsers or mobile apps - "UI driven use cases" - compared to use cases where no user is present at the time of activation processing - "Event driven use cases".

Authors

Feedback

Original OpenWhisk Behavior

Original behavior is according to this diagram:

 

In this workflow the execution of an activation is:

Primary bottlenecks in throughput with this arrangement is per activation isolation. This means that even if the same user submits the same action for invocation (less likely, but not in all cases), the container usage is serialized so that a single activation is in flight at any given time. This is enforced by:

Secondary complications are:

 

OpenWhisk use cases

Currently OpenWhisk offers both

These "realtime API usages" are cases where latency fluctuation based on concurrent loads is not tolerable, compared to event processing cases where an additional n seconds of latency during peek event generation is not noticeable, in most cases, and in many cases the response is not ever seen by the event producer (sensor data collection, etc). The specific differences between UI and event-driven cases are listed below:

 UI driven use caseevent driven use case
blocking parameteralways usedsometimes used
desired timeout behavior504 response - response will never be provided202 response - response will be provided later
activation concurrencyoften concurrent with activations of the same action (to support scaleout independent of container resources)never concurrent with other activations
action container life cyclealways reused (without re-initialization)may be reused (only for same action+subject)
comparison to conventional web application life cycle
(start once, serve many requests)

same as conventional web application

  • start web application
  • process many requests concurrently
  • stop web application (only for deploy of new action container, idle for some period)

more like:

  • start web application,
  • process single request, (or a sequence of single requests, for same action+subject)
  • stop web application
affects on container resource requirements

number of containers required is

  • directly bound to the number of unique actions, and
  • indirectly bound to the number of concurrent users (only for horizontal scaling, same as a web server)

number of containers required is

  • directly bound to the number of unique actions, and
  • directly bound to the number of concurrent users
log collectioncannot harvest logs for activations as part of activation processing - log collection must be performed at an aggregate level, and made available to developers via query toolscan harvest logs for storage as part of activation processing - since each run will leave the container in a state where the most recent logs are associated with the most recent activation run

 

Proposed OpenWhisk Behavior

In general, this proposal presents an option for UI driven activation processing for enabling realtime API consumption cases like:

Proposal for using http for activation transport is below:

Important points:

 * Although extending the Controller LoadBalancer component to leverage a clustering system instead of "a set of Invokers" should also be optional and have the same affects on throughput. 

Benefits:

*Until saturating capacity is reached based on similar deployment of the same technology as "a conventional web application wrapped in a container" - e.g. if I can deploy a conventional nodejs application deployed as a container to service 4000 concurrent user, I should be able to implement an action that services similar traffic, using a single container within the OpenWhisk system

Isolation details

This proposal purposefully decreases isolation for the gain of throughput. It is true that this exposes action developers to risks such as:

However, these are the same risks that web developers take when building conventional web applications, so generally developers should not be averse to these issues. 

Resource Requirements Estimation

The area of "incorrect resource usage estimation" is one where any container based applications are susceptible to starvation ("I thought my app/function would only require 128m") - this does not change with this proposal, except that it is somewhat simpler to simulate a single user for measurements used for estimation. Estimating resource requirements is a challenge regardless of whether the application is built into a custom container, running as actions in OpenWhisk, and servicing 1 user or 100 users. There are areas where we can help, such as:

Sample Data

In a simple prototype, creating load using the https://github.com/markusthoemmes/openwhisk-performance throughput.sh test, throughput increases tested locally (default configs except for extended throttling limits) were measured at metrics below. This test used a simple async action that produces a result after 175ms, to simulate waiting for a downstream external API to return, which would be a common scenario for actions that service UI driven use cases:

function main(params) {
    console.log("testing async-noop.js");
    return new Promise(function (resolve, reject) {
        setTimeout(function () {
            resolve({done: true});
        }, 175);
    })
}
 original deploymenthttp activation processing approach
mean latency8642.7 ms915.1 ms
requests per second11102
number of action containers21