chore: assorted fixes for PR

main
Sean McBride 5 years ago
parent 1e02248d6e
commit 096c5da458

@ -1,12 +1,11 @@
# aWsm (awesome) # aWsm (awesome)
**aWsm** is an efficient WASM runtime built with the `silverfish` compiler. This is an active research effort with regular breaking changes and no guarantees of stability. **aWsm** is an efficient serverless runtime built with the `silverfish` compiler. It combines WebAssembly sandboxing with asynchronous I/O to provide a lightweight serverless solution suitable for edge computing.
## Host Dependencies ## Host Dependencies
- Docker - Docker - [Installation Instructions](https://docs.docker.com/install/)
- libuv
Additionally, if you want to execute the Awsm runtime on your host environment, you need libuv. A reason you might want to do this is to debug your serverless function, as GDB does not seem to run properly within a Docker container.
If on Debian, you can install libuv with the following: If on Debian, you can install libuv with the following:
@ -18,7 +17,7 @@ If on Debian, you can install libuv with the following:
**Note: These steps require Docker. Make sure you've got it installed!** **Note: These steps require Docker. Make sure you've got it installed!**
We provide a Docker build environment configured with the dependencies and toolchain needed to build the Awsm runtime and serverless functions. We provide a Docker build environment configured with the dependencies and toolchain needed to build the aWsm runtime and serverless functions.
To setup this environment, run: To setup this environment, run:
@ -66,9 +65,9 @@ You should be in the root project directory (not in the Docker container)
cd runtime/bin/ cd runtime/bin/
``` ```
We can now run Awsm with one of the serverless functions we built. Let's run Fibonacci! We can now run aWsm with one of the serverless functions we built. Let's run Fibonacci!
Because serverless functions are loaded by Aswsm as shared libraries, we want to add the `runtime/tests/` directory to LD_LIBRARY_PATH. Because serverless functions are loaded by aWsm as shared libraries, we want to add the `runtime/tests/` directory to LD_LIBRARY_PATH.
```bash ```bash
LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./awsmrt ../tests/test_fibonacci.json LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./awsmrt ../tests/test_fibonacci.json
@ -96,75 +95,27 @@ Notice that it is configured to run on port 10000. The `name` field is also used
Our fibonacci function expects an HTTP POST body of type "text/plain" which it can parse as an integer to figure out which Fibonacci number we want. Our fibonacci function expects an HTTP POST body of type "text/plain" which it can parse as an integer to figure out which Fibonacci number we want.
Let's get the 10th. Note that I'm using ApacheBench to make this request. Let's get the 10th. Note that I'm using [HTTPie](https://httpie.org/) to send a POST request with a body containing the parameter I want to pass to my serverless function.
Note: You possibly run the awsmrt command in the foreground. If so, you should open a new terminal session. Note: You possibly run the awsmrt command in the foreground. If so, you should open a new terminal session.
```bash ```bash
echo 10 >fib.txt echo "10" | http :10000
ab -c 1 -n 1 -p fib.txt -v 2 http://localhost:10000/fibonacci
``` ```
In my case, I received the following in response. The response is 55, which seems to be correct! In my case, I received the following in response. The response is 55, which seems to be correct!
```bash ```bash
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)...INFO: POST header ==
---
POST /fibonacci HTTP/1.0
Content-length: 3
Content-type: text/plain
Host: localhost:10000
User-Agent: ApacheBench/2.3
Accept: */*
---
LOG: header received:
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-type: text/plain
Content-length: 3 Content-length: 3
Content-type: text/plain
55 55
..done
Server Software:
Server Hostname: localhost
Server Port: 10000
Document Path: /fibonacci
Document Length: 3 bytes
Concurrency Level: 1
Time taken for tests: 0.001 seconds
Complete requests: 1
Failed requests: 0
Total transferred: 100 bytes
Total body sent: 141
HTML transferred: 3 bytes
Requests per second: 952.38 [#/sec] (mean)
Time per request: 1.050 [ms] (mean)
Time per request: 1.050 [ms] (mean, across all concurrent requests)
Transfer rate: 93.01 [Kbytes/sec] received
131.14 kb/s sent
224.14 kb/s total
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 1 0.0 1 1
Processing: 0 0 0.0 0 0
Waiting: 0 0 0.0 0 0
Total: 1 1 0.0 1 1
``` ```
## Stopping the Runtime ## Stopping the Runtime
When you are finished, stop Awsm with When you are finished, stop aWsm with
```bash ```bash
./devenv.sh stop ./devenv.sh stop

@ -31,23 +31,12 @@ SYS_BUILD_TIMEOUT=0
# Provides help to user on how to use this script # Provides help to user on how to use this script
usage() { usage() {
echo "usage $0 <setup/run/stop/rm/rma/install_libuv/>" echo "usage $0 <setup||run||stop||rm||rma/>"
} echo " setup Build aWsm and a Docker container with toolchain needed to compile your own functions"
echo " run Start the aWsm Docker image as an interactive container with this repository mounted"
# It's easier to debug on host, so probably you want to execut awsm outside of the container echo " stop Stop and remove the aWsm Docker container after use"
# That means we need the LibUV dependency installed on our host echo " rm Remove the aWsm runtime container and image, but leaves the awsm-dev container in place"
install_libuv() { echo " rma Removes all the awsm and awsm-dev containers and images"
# If using Debian, install LibUV Dependency
if [ -f "/etc/debian_version" ]; then
if [ "$(dpkg-query -W -f='${Status}' libuv1-dev 2>/dev/null | grep -c "ok installed")" -eq 0 ]; then
echo "LibUV seems to be missing. Install?"
sudo apt-get install libuv1-dev
else
echo "libuv detected!"
fi
else
echo "You don't seem to be on a Debian-based system, and this script only knows about aptitude. Sorry!"
fi
} }
# Given a number of seconds, initiates a countdown sequence # Given a number of seconds, initiates a countdown sequence
@ -199,9 +188,6 @@ case $1 in
rma) rma)
envrma envrma
;; ;;
install_libuv)
install_libuv
;;
*) *)
echo "invalid option: $1" echo "invalid option: $1"
usage "$0" usage "$0"

Loading…
Cancel
Save