openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Sciabarra <mich...@sciabarra.com>
Subject The ActionLoop based runtime for Python3.6 for OpenWhisk is 5 times faster than the current runtime
Date Sun, 18 Nov 2018 12:27:57 GMT
Hello all, before commenting, here there are the numbers:

*** Testing OpenWhisk Classic Python ***
Running 1m test @ http://localhost:8080/run
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    49.91ms    2.33ms  60.23ms   79.28%
    Req/Sec    19.87      2.58    30.00     93.59%
  1202 requests in 1.00m, 148.01KB read
Requests/sec:     20.03
Transfer/sec:      2.47KB

*** Testing ActionLoop Python ***
Running 1m test @ http://localhost:8080/run
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.77ms  673.30us  37.85ms   93.85%
    Req/Sec    85.14      5.56    90.00     84.25%
  5101 requests in 1.00m, 632.64KB read
Requests/sec:     84.95
Transfer/sec:     10.54KB

What is this?

For those who are new to the list, I recap a bit.  I am the author of the runtime for Go.

Because Go is a compiled language, I implemented a different approach than the other languages.
Other runtimes are build in the target language, they implement the runtime an and load the
code in a way "language dependent"
In the  Go runtime, your action is a full featured standalone executable, and it communicates
with the proxy via pipes and I/O.

The runtime evolved in a compete infrastructure to implement actions in ANY programming language
that can read input and write output line by line and parse JSON. It was designed for compiled
programming language (Go, but also C/C++, Rust, Haskell, Nim) but there is nothing preventing
to use it with scripted languages: Python for example.

Building a runtime using the current infrastructure, is extremely easy: you just need a Dockerfile,
a "compiler" and a launcher. I already built the support for Go, Swift, an experiment using
Scala and now I created one for Python. It took me 2 hours today to build the runtime. Working
a bit on it. it could even became easier. There is now a "compiler" script, it could be just
a "json" descriptor...

Then I decided to benchmark the result. I created a very simple "main.py" (just the classic
"hello") and I used the "wrk" tool to benchmark the "raw" http performance, executing one
single thread with one connection. The result is what you can see before. The current runtime
can perform, using Docker on my Mac, 1202 requests in one minute, while the runtime built
with ActionLoop can perform 5101 requests in one minute.

I am not entirely surprised because the current runtime uses a Python based HTTP support,
while the ActionLoop is entirely native code and it communicate the action over (internally
optimized) I/O. 

Code is here: https://github.com/sciabarracom/incubator-openwhisk-runtime-actionloop

So, is it worth to use this as an "official" way to write runtimes? In such a case I can document
all the procedure... There was some discussion of using it as the "dockerskeleton v2". Not
sure if the name is suitable, also the concept is a bit different although it is very generic.
I would like more something like "runtime-sdk" or something like this. Let me know your thoughts.

-- 
  Michele Sciabarra
  michele@sciabarra.com

Mime
View raw message