openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Sciabarra <openwh...@sciabarra.com>
Subject 250 times faster swift actions with the Go server...
Date Thu, 22 Feb 2018 14:08:33 GMT
After spending a session of learning way more swift I ever wanted to know, I hacked an horrible
sample of Swift code implementing the Hello World as a read-stdin-write-std-out loop.

The code in all his ugliness I do not dare to post is here:

https://github.com/sciabarracom/openwhisk-runtime-go/blob/pipe-loop/HelloSwift/Sources/Hello/main.swift

However I used this example to to compare my new implementation in Go with the current one
(as described in James Thomas blog post http://jamesthom.as/blog/2017/06/28/serverless-swift-with-openwhisk/)
and this is the result:

+----------+-------+------+------+------+------+------+-----+------+
|  Label   |   #   | Avg  | Med  | 90%  | 95%  | 99%  | Min | Max  |
+----------+-------+------+------+------+------+------+-----+------+
| Current  | 10000 | 1097 | 1101 | 1169 | 1191 | 1243 |  19 | 2132 |
| Go+Swift | 10000 |    4 |    4 |    6 |    6 |   10 |   2 | 1030 |
| TOTAL    | 20000 |  551 |   66 | 1148 | 1169 | 1221 |   2 | 2132 |
+----------+-------+------+------+------+------+------+-----+------+

To be honest I am not sure why. As far as I know, Swift support  is implemented as a read-write
loop too (or at least this is what looks like to a quick look to the code), however python
is not famous to be a performing language (and I suspect the Global Interpreter Lock may play
a role in those numbers).

I did also a comparison of Go and Swift running under my new implementation. Implemented in
this way , the are basically the same speed.  

However it is worth to be noted that the image for Golang only is 10MB, but if I have to add
swift support you need a lot of libraries on it. I used a docker image based on ibmcom/ubuntu-swift
but it is huge (1.8G!), I think a trimmed down version is needed.

All the code is in my repo in the pipe-loop branch. Now I think I will have to take the time
to clean up the code and make it robust.


-- 
  Michele Sciabarra
  openwhisk@sciabarra.com

Mime
View raw message