Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
e2e95d7
replace http by eRPC
Feb 13, 2023
e2e0842
make it work: Sledge receives a rpc request and parse the header and …
lyuxiaosu Feb 13, 2023
5718ada
first working version to integrate eRPC, but some part are hardcode
lyuxiaosu Feb 15, 2023
34813fd
forgot to submit erpc_handler.h and debug.sh
lyuxiaosu Feb 15, 2023
6eefa09
add sending response packets to the client for any errors
lyuxiaosu Feb 16, 2023
344fab0
add SIGINT handler to print out throughput latency data when press CT…
lyuxiaosu Feb 17, 2023
e041305
enable macro SANDBOX_STATE_TOTALS
lyuxiaosu Feb 17, 2023
012bc5d
remove log
lyuxiaosu Feb 17, 2023
576e408
upload test scripts
lyuxiaosu Feb 17, 2023
1bc0a6d
upload id_rsa
lyuxiaosu Feb 17, 2023
060efce
make the first worker core id be configurable
lyuxiaosu Feb 17, 2023
c590d70
create multiple listener threads with eRPC
lyuxiaosu Feb 21, 2023
308ae8c
upload parse_single.py
lyuxiaosu Feb 21, 2023
1c37be2
remove unreachable code
lyuxiaosu Feb 22, 2023
601ab73
make listener threads put requests to worker queue direclty with RR
lyuxiaosu Feb 24, 2023
2718650
update start.sh
lyuxiaosu Feb 24, 2023
40623fe
make runtime log write to memory and dump to a file when receive a SI…
lyuxiaosu Mar 16, 2023
5f80df6
change memory buffer size for logging
lyuxiaosu Mar 16, 2023
56a7a3f
comment sandbox_state_totals_decrement(last_state) in sandbox_set_as_…
lyuxiaosu Mar 20, 2023
2b4c43b
change fib.json to support multiple functions
lyuxiaosu Mar 24, 2023
07981bb
uncomment SLEDGE_SANDBOX_PERF_LOG in start.sh
lyuxiaosu Mar 24, 2023
735de18
add LOG_RUNTIME_MEM_LOG definition in runtime/Makefile
lyuxiaosu Mar 24, 2023
cfcf621
1. solve incomplete log printing when receive SIGINT 2. print out tot…
lyuxiaosu Mar 24, 2023
e7c5053
gracefully stop sledge when receive SIGINT
lyuxiaosu Mar 24, 2023
9084334
increase init length to 2560000 for local runqueue.
lyuxiaosu Mar 25, 2023
a845fa5
upload meet_deadline_percentage.py to tests
lyuxiaosu Mar 27, 2023
717d64b
update meet_deadline_percentage.py
lyuxiaosu Mar 27, 2023
e975744
update meet_deadline_percentage.py
lyuxiaosu Mar 27, 2023
7e8f9e3
1. add more fine-grained time cost for a request, such as clean up co…
lyuxiaosu Mar 31, 2023
da91c3c
1. move logging from sandbox_free to scheduler_cooperative_sched. 2. …
lyuxiaosu Mar 31, 2023
c5153b6
fix bug: not longging in sandbox_perf_log.h
lyuxiaosu Apr 1, 2023
7bf0033
wronly comment unmask alarm signal in previous, just uncomment
lyuxiaosu Apr 5, 2023
e21afb5
remove one whitespace in printing log to memory
lyuxiaosu Apr 5, 2023
1c5591b
replace local rr_index with a global automic request_index to distrib…
lyuxiaosu Apr 6, 2023
3ddbfa5
update meet_deadline_percentage.py and tests/start.sh
lyuxiaosu Apr 6, 2023
a899831
1.Remove perf_window lock by let each worker thread maintain its own …
lyuxiaosu Apr 12, 2023
950f89c
implement new scheduling policy with binary search tree, but it has s…
Apr 28, 2023
dc121be
fix previous submit bug: calculating the total waiting serving time i…
lyuxiaosu Apr 28, 2023
8e4d09a
remove debug log
lyuxiaosu Apr 28, 2023
71e3eb0
fix bug: worker thread cannot receive sigalarm signal
lyuxiaosu May 13, 2023
c90fbe9
implemented the main framework for DARC scheduling
May 19, 2023
a13e5d2
update runtime/tests/start.sh
lyuxiaosu May 19, 2023
b23c473
implemented DARC algo but have a bug that the finished work doesn't c…
lyuxiaosu May 20, 2023
72a3322
fix the previous bug for DARC algo
lyuxiaosu May 21, 2023
6888992
update fib.json
lyuxiaosu May 21, 2023
a4e1c4a
add comment
Sep 13, 2023
5179ed3
1. rename variables to make it more easy to understand.
Sep 14, 2023
0c4f886
shinjuku implementation with bugs
lyuxiaosu Sep 23, 2023
d5f55f7
fix bug: worker and listener thread both call push_to_rqueue() to enq…
lyuxiaosu Sep 26, 2023
817e572
1. forgot committing request_typed_queue.c 2. update scripts
lyuxiaosu Sep 26, 2023
f3ff5ba
add shinjuku_dispatch_different_core() but doesn't work due to differ…
lyuxiaosu Sep 26, 2023
3bf7456
fix bug: load imbalancing among worker threads
lyuxiaosu Sep 27, 2023
1d56d5e
fix bug: check each worker's current task to see if it runs longer th…
lyuxiaosu Sep 27, 2023
ce1b58e
1. remove some http setting code, would cause crash.
lyuxiaosu Sep 29, 2023
298efe9
update debug.sh
lyuxiaosu Sep 29, 2023
c4fa60e
commit test_dequeue.cpp to tests folder
lyuxiaosu Oct 1, 2023
64e4336
1. fix bug: sandbox_set_as_running_sys() failed with assert sandbox s…
Oct 4, 2023
18289df
fix bug: for shinjuku algo, when context switch to another sandbox, t…
lyuxiaosu Oct 5, 2023
2e40c66
fix bug: for shinjuku algo, when it receives a sigalarm signal, the s…
lyuxiaosu Oct 5, 2023
421bb5c
1. recover wrong change for assert failure at sandbox->state == SANDB…
lyuxiaosu Oct 5, 2023
f34da5a
Merge branch 'shinjuku_imp' of https://github.com/gwcloudlab/sledge-s…
lyuxiaosu Oct 5, 2023
98f9236
recover global typed queue to one dimensional array because now only …
lyuxiaosu Oct 5, 2023
7c36a5c
replace global typed queue with global typed deque which allows to in…
lyuxiaosu Oct 5, 2023
473da70
fix bug: set sandbox->start_ts_running_user after sandbox_return whic…
lyuxiaosu Oct 6, 2023
7434fd9
replace binary-search-tree local runqueue with circular-queue for shi…
lyuxiaosu Oct 6, 2023
5a182bb
replace binary-search-tree local runqueue with circular-queue for DAR…
lyuxiaosu Oct 6, 2023
f1cb62a
optimize edf-selected-interrupt algo: Before context switch to other …
lyuxiaosu Oct 7, 2023
13c2a94
forgot submit local_runqueue_circular_queue.h and local_runqueue_circ…
lyuxiaosu Oct 7, 2023
1226a52
update meet_deadline_percentage.py
lyuxiaosu Oct 7, 2023
592a844
format code
lyuxiaosu Oct 9, 2023
d9ccc50
solved variant TSC issue across CPU cores for shinjuku
lyuxiaosu Oct 13, 2023
fff7d9b
update and upload scripts
lyuxiaosu Oct 13, 2023
d14f89c
add sledge extend abi for webassembly to get cpu cycles
lyuxiaosu Oct 20, 2023
08b6d41
Add more debug log, but comment them for later use
lyuxiaosu Oct 23, 2023
2eb381c
add test_tsc.c
lyuxiaosu Oct 23, 2023
2303536
precalculate the interrupt interval to cycles for shinjuku
Oct 27, 2023
31de83c
add simulated exponential service time on sledge: when sledge get a p…
lyuxiaosu Oct 30, 2023
f034eb8
1. change type 2's execution time and deadline for fib.json.
lyuxiaosu Oct 30, 2023
64864d4
1. Add code to print out the maximum local queue length of each worke…
lyuxiaosu Nov 1, 2023
b55279d
fix bug for shinjuku: The first worker of each listener thread has a …
lyuxiaosu Nov 3, 2023
f6aa386
1. choose the worker with the minimum total amount of work if more th…
lyuxiaosu Nov 7, 2023
cd430ef
modify debug.sh
lyuxiaosu Nov 8, 2023
a3a3fe5
implement partial code for autoscaling: each worker will keep idle if…
lyuxiaosu Dec 20, 2023
ac2bfa0
add local_runqueue_circular_queue_is_empty_index for DARC and Shinjuk…
Dec 28, 2023
94e485e
add SLEDGE_DISABLE_AUTOSCALING to enable or disable autoscaling
lyuxiaosu Jan 2, 2024
60bf4b6
1. fix bug: condition variable lost signal
lyuxiaosu Jan 9, 2024
cc5c33e
forgot submit runtime/include/runtime.h
lyuxiaosu Jan 9, 2024
6c84872
add scaling up implementation and cpu monitoring script
lyuxiaosu Jan 15, 2024
f2cb834
add start_single_request.sh empty.json and parse_power_consumption.py
Jan 29, 2024
55b28d3
comment autoscaling logic code in listener_thread.c due to no benefit
lyuxiaosu Jan 29, 2024
add0aea
update Makefile to let it checkout specified awsm code
lyuxiaosu Mar 20, 2024
cc11815
update start.sh
lyuxiaosu Mar 20, 2024
1dc9e47
update sledge main.c
lyuxiaosu Mar 20, 2024
696ebda
upload ori_sledge_tests
lyuxiaosu Apr 11, 2024
027b680
update measure_old_sledge_cost.sh
lyuxiaosu Apr 11, 2024
b7fe439
update curl.sh
lyuxiaosu Apr 12, 2024
225d342
remove meet_deadline_percentage.py parse_single.py from ori_sledge_tests
lyuxiaosu Apr 16, 2024
c5f4827
rename parase_cost.py to parse_cost.py
lyuxiaosu Apr 16, 2024
b1a37ce
update curl.sh and parse_cost.py in ori_sledge_tests
lyuxiaosu Apr 16, 2024
e68a6e3
update start.sh:
lyuxiaosu Apr 16, 2024
6247388
1. use request type id to locate object route and module.
lyuxiaosu Apr 25, 2024
80eed1c
set sandbox stack pointer to sandbox->wasm_stack to let it only free …
lyuxiaosu Apr 26, 2024
08f6f0a
upload increase_req_type.patch
lyuxiaosu Apr 26, 2024
372ab41
update increase_req_type.patch
lyuxiaosu Apr 26, 2024
ab5df83
upload delete_patch.sh and apply_patch.sh
lyuxiaosu Apr 26, 2024
472425a
upload http_router.c,copy_func_so.sh,and generate_json.py
lyuxiaosu Apr 26, 2024
eeea5a9
upload start_func_density_test.sh
lyuxiaosu Apr 27, 2024
628fc0a
Merge branch 'autoscaling_imp' of https://github.com/gwcloudlab/sledg…
lyuxiaosu Apr 27, 2024
2b6bfcf
update start_test.sh
lyuxiaosu Apr 27, 2024
c6d65aa
update Makefile
lyuxiaosu Apr 30, 2024
b6878ab
1.commend explicit_bzero stack memory when sandbox exit
lyuxiaosu May 1, 2024
9218209
fix DARC bug: the long requests and short requests share cpu cores an…
lyuxiaosu May 6, 2024
7f54a2c
update fib.json
lyuxiaosu May 6, 2024
b91e4a7
upload dummy_func_DARC.json dummy_func_EDF_SHINJUKU.json
lyuxiaosu May 8, 2024
2d0c985
upload tests/config.json
lyuxiaosu May 9, 2024
d40bce8
fix implementation bug: not use binary search tree property to search…
May 12, 2024
9b247cd
rename dummy_func_DARC.json to dummy_tpcc_DARC.json, dummy_func_EDF_S…
lyuxiaosu May 12, 2024
023e7ca
add some debug code
lyuxiaosu May 12, 2024
ba18177
update debug.sh
May 16, 2024
084bc74
update increase_req_type.patch
lyuxiaosu May 16, 2024
422c8f4
replace the memory pool in each module with a global shared reused me…
lyuxiaosu May 17, 2024
9124541
update tests/start_func_density_test.sh
lyuxiaosu May 19, 2024
9b5625d
update start_func_density_test.sh and upload generate_json_with_repli…
lyuxiaosu May 20, 2024
71cb67f
update increase_req_type.patch
lyuxiaosu May 20, 2024
1ebc7d8
upload binary_search_tree.h_redblacktree local_runqueue_binary_tree.c…
lyuxiaosu May 22, 2024
440058c
for binary search tree to get_next: when tree length is 1, then retur…
lyuxiaosu May 26, 2024
092c9f8
update sandbox_perf_log.h
lyuxiaosu May 26, 2024
7f373fb
update ori_sledge_tests/start.sh
lyuxiaosu May 30, 2024
fc69b22
update ori_sledge_tests/start.sh
lyuxiaosu May 30, 2024
daab9d4
update ori_sledge_tests/start.sh, upload measure_throughput.sh
lyuxiaosu May 30, 2024
3724e18
update ori_sledge_tests/start.sh
lyuxiaosu May 30, 2024
aa3ad1c
upload sed_json.sh
lyuxiaosu May 31, 2024
6bf486f
Merge branch 'replace_with_a_global_shared_memory_pool' of https://gi…
lyuxiaosu May 31, 2024
0bb2052
update hash.json
lyuxiaosu May 31, 2024
f4d7995
upload tests/hash_high_bimodal.json and update binary_search_tree.h_r…
lyuxiaosu Jun 2, 2024
8c0e87b
use remaining execution time instead of estimated execution time to c…
lyuxiaosu Jun 5, 2024
e70adf0
update runtime/src/software_interrupt.c to wakeup_worker and sem_post…
lyuxiaosu Jun 10, 2024
21595ab
update curl.sh and measure_old_sledge_cost.sh of folder ori_sledge_tests
lyuxiaosu Jun 17, 2024
07f681f
Merge branch 'replace_with_a_global_shared_memory_pool' of https://gi…
lyuxiaosu Jun 17, 2024
cd88451
update curl.sh measure_old_sledge_cost.sh and parse_cost.py
lyuxiaosu Jun 28, 2024
6123731
upload high_bimodal_realapps.json
lyuxiaosu Jul 3, 2024
b29cba5
Merge branch 'replace_with_a_global_shared_memory_pool' of https://gi…
lyuxiaosu Jul 3, 2024
c7fc8b2
update tests/high_bimodal_realapps.json
lyuxiaosu Jul 17, 2024
ea6f451
update scripts
lyuxiaosu Jul 17, 2024
3d0f435
Merge branch 'replace_with_a_global_shared_memory_pool' of https://gi…
lyuxiaosu Jul 17, 2024
a82a971
upload monitor_mem.sh kill_perf.sh run_perf.sh
lyuxiaosu Oct 4, 2024
367cc15
upload parse_batch_profile.py
Oct 11, 2024
b4a22ed
upload vision_apps.json
lyuxiaosu Nov 10, 2024
19a372e
change DARC core reservation way by group id not request id
lyuxiaosu Nov 13, 2024
f1983f1
1. check valiadation of group-id and n-resas if using DARC.
lyuxiaosu Nov 13, 2024
5e81cbc
update increase_req_type.patch
lyuxiaosu Nov 13, 2024
c2d13ae
update vision_apps.json
lyuxiaosu Nov 13, 2024
fd55a29
update vision_apps.json
lyuxiaosu Nov 13, 2024
cd2c95b
update dummy_tpcc.json
lyuxiaosu Nov 14, 2024
a078296
update log info for each sandbox
lyuxiaosu Nov 15, 2024
4353632
update meet_deadline_percentage.py and parse_batch.py
lyuxiaosu Nov 16, 2024
3f5a2b2
fix bug: forget to assign admission_info.uid, assign it with request …
lyuxiaosu Nov 21, 2024
cfad89b
update increase_req_type.patch
lyuxiaosu Nov 21, 2024
c67ab8a
add comment code for shinjuku, won't changge performance
lyuxiaosu Nov 24, 2024
f16ce51
add total received requests count log
lyuxiaosu Nov 26, 2024
5379e5c
update parse script, upload scp.sh
lyuxiaosu Nov 26, 2024
98315a9
upload vision_apps_same_6apps.json and apps_Makefile
lyuxiaosu Dec 2, 2024
c5a3a4f
upload change_vision_apps_json.sh, update parse_batch.py
Dec 14, 2024
516bc6f
1. fix bug: replace calloc with aligned_alloc to allocate struct memo…
May 8, 2025
7ec4f52
update start_test.sh and debug.sh
lyuxiaosu May 9, 2025
63acc72
update debug.sh, run_perf.sh, start_func_density_test.sh and Makefile
lyuxiaosu May 12, 2025
9e4e2ba
update increase_req_type.patch
lyuxiaosu May 12, 2025
7036b13
update run_perf.sh
lyuxiaosu May 13, 2025
6e8fccf
add thread name for dispatcher and worker
lyuxiaosu May 15, 2025
b35cb3a
support round robin distributing and EDF scheduling
lyuxiaosu May 16, 2025
90314e1
add JSQ and LLD distribution with EDF scheduling
lyuxiaosu May 16, 2025
ea421fa
implement the second version of JSQ, RR, LLD: Dispatcher assigns requ…
lyuxiaosu May 20, 2025
08c6423
update parse_batch.py
lyuxiaosu May 20, 2025
b4b7dab
upload compare_dispatchers.sh
lyuxiaosu May 20, 2025
abb5a6f
upload vision_apps_dispatcher.json
lyuxiaosu May 20, 2025
a485c7b
add new support for LLD + FIFO: Dispatcher assign requests to workers…
lyuxiaosu May 22, 2025
37d1547
1. replace Semaphore with condition variable to avoid signal missing …
lyuxiaosu May 23, 2025
492fbb6
update start_test.sh
lyuxiaosu May 23, 2025
d873ca0
Recover to use Semaphore since it has a better performance than condi…
May 23, 2025
e68c20d
upload get_ctx.sh
lyuxiaosu May 23, 2025
1a0f19b
update start_func_density_test.sh and compare_dispatchers.sh
lyuxiaosu May 23, 2025
9bac4a6
update increase_req_type.patch
lyuxiaosu May 23, 2025
5822ac1
make getting batch size from FIFO queue as a configurable variable
lyuxiaosu May 25, 2025
f94383f
update test scripts and vision_apps_dispatcher.json
lyuxiaosu May 26, 2025
3db9e08
update compare_dispatchers.sh
lyuxiaosu May 27, 2025
c20c526
upload applications_Makefile_patch
lyuxiaosu May 27, 2025
2a6f98e
update debug.sh
lyuxiaosu May 27, 2025
883055e
change dispatcher - RR, JSQ, and LLD to use original algorithms worki…
lyuxiaosu May 27, 2025
51332cf
update applications_Makefile_patch
lyuxiaosu May 27, 2025
6ef6866
add max local queue count for minheap runqueue
lyuxiaosu Jun 7, 2025
942f26a
upload parse_avg_throughput.sh and measure_throughput.sh
lyuxiaosu Jun 10, 2025
7ba4896
1. add eRPC as a sub-module in .gitmodules.
Oct 21, 2025
4a5d5b6
update .gitmodules
Oct 21, 2025
16129f1
Add new submodule eRPC
Oct 21, 2025
013c810
update Makefile
Oct 21, 2025
55177dd
Update README.md
lyuxiaosu Oct 21, 2025
08326bd
Update README.md
lyuxiaosu Oct 21, 2025
a4df9ac
Update README.md
lyuxiaosu Oct 22, 2025
7f954d4
Update README.md
lyuxiaosu Oct 22, 2025
257bc50
Update README.md
lyuxiaosu Oct 23, 2025
86f564a
Update README.md
lyuxiaosu Oct 23, 2025
f75c175
Update README.md
lyuxiaosu Oct 24, 2025
4684c47
Update README.md
lyuxiaosu Oct 29, 2025
9b80e63
Update README.md
lyuxiaosu Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
[submodule "jsmn"]
path = runtime/thirdparty/jsmn
url = https://github.com/gwsystems/jsmn.git
[submodule "eRPC"]
path = eRPC
url = https://github.com/lyuxiaosu/eRPC
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
SHELL:=/bin/bash

.PHONY: all
all: awsm libsledge runtime applications
all: awsm erpc libsledge runtime applications

.PHONY: clean
clean: awsm.clean libsledge.clean runtime.clean applications.clean
clean: awsm.clean erpc.clean libsledge.clean runtime.clean applications.clean

.PHONY: submodules
submodules:
Expand All @@ -16,7 +16,7 @@ install: submodules wasm_apps all
# aWsm: the WebAssembly to LLVM bitcode compiler
.PHONY: awsm
awsm:
cd awsm && cargo build --release
cd awsm && git checkout f0b35e756395f79b06be8dd2660eecac94506e94 && cargo build --release

.PHONY: awsm.clean
awsm.clean:
Expand All @@ -31,6 +31,16 @@ libsledge:
libsledge.clean:
make -C libsledge clean

.PHONY: erpc
erpc:
@echo "Building eRPC interface..."
cd eRPC/c_interface && ./build.sh
@echo "eRPC build complete."

.PHONY: erpc.clean
erpc.clean:
cd eRPC/c_interface && make clean

# sledgert: the runtime that executes *.so modules
.PHONY: runtime
runtime:
Expand All @@ -52,7 +62,7 @@ applications.clean:

# Instead of having two copies of wasm_apps, just link to the awsm repo's copy
wasm_apps:
ln -sr awsm/applications/wasm_apps/ applications/
cd awsm/applications/wasm_apps && git checkout master && cd ../../../ && ln -sr awsm/applications/wasm_apps/ applications/

# Tests
.PHONY: test
Expand Down
296 changes: 178 additions & 118 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,160 +1,220 @@
# SLEdge

**SLEdge** is a lightweight serverless solution suitable for edge computing. It builds on WebAssembly sandboxing provided by the [aWsm compiler](https://github.com/gwsystems/aWsm).

## Setting up a development environment

### Native on Debian Host

```sh
git clone https://github.com/gwsystems/sledge-serverless-framework.git
cd sledge-serverless-framework
./install_deb.sh
source ~/.bashrc
make install
make test
```

### Docker

**Note: These steps require Docker. Make sure you've got it installed!**

[Docker Installation Instructions](https://docs.docker.com/install/)

We provide a Docker build environment configured with the dependencies and toolchain needed to build the SLEdge runtime and serverless functions.

To setup this environment, run:

```bash
./devenv.sh setup
```

### Using the Docker container to compile your serverless functions

To enter the docker environment, run:

```bash
./devenv.sh run
```

The first time you enter this environment, run the following to copy the sledgert binary to /sledge/runtime/bin.

```bash
cd /sledge/runtime
make clean all
```

# SLEdgeScale

**SLEdgeScale** is an ultra-low-latency, high-density, and task-deadline-aware serverless computing solution suitable for edge environments, extending **SLEdge**. It leverages WebAssembly sandboxing provided by the [aWsm compiler](https://github.com/gwsystems/aWsm) and kernel-bypass RPC offered by [eRPC](https://github.com/erpc-io/eRPC).

## Setting up a development environment (Native on Debian Host)
SLEdgeScale was developed and tested on [Cloudlab](https://www.cloudlab.us) nodes (d6515) equipped with Mellanox NICs. A public [profile](https://www.cloudlab.us/p/GWCloudLab/sledge-rpc2) is available on CloudLab for easily creating a development environment for eRPC with node d6515. If you plan to set up the environment on machines with Intel NICs or other machines, please refer to the [eRPC](https://github.com/erpc-io/eRPC) repository for details about environment configuration, including driver and DPDK installation. For Mellanox NICs, please follow [this](https://docs.nvidia.com/networking/display/mlnxofedv590560125/installing+mlnx_ofed) guide to install *MLNX_OFED*.

For using CloudLab profile to create the development environment:
Choose the [profile](https://www.cloudlab.us/p/GWCloudLab/sledge-rpc2) and use the following configuration:
Number of Nodes: 2
Select OS image: SLEDGE
Optional physical node type : d6515

Now the environment is prepared for eRPC. The following steps are to build and install SLEdgeScale:
1. Git clone this repo and checkout branch *compare_dispatchers*
2. Extend the root filesystem:
```sh
cd sledge-serverless-framework/runtime/tests
./add_partition.sh
```
4. Move `sledge-serverless-framework` to `/my_mount/`
5. Disable multiple threads:
```sh
cd sledge-serverless-framework/runtime/tests
sudo ./no_hyperthreads.sh
```
7. Build:
```sh
cd sledge-serverless-framework
./install_deb.sh
source $HOME/.cargo/env
source ~/.bashrc
make install
```
There are a set of benchmarking applications in the `/sledge/applications` directory. Run the following to compile all benchmarks runtime tests using the aWsm compiler and then copy all resulting `<application>.wasm.so` files to /sledge/runtime/bin.

```bash
cd /sledge/applications/
make clean all
```

You now have everything that you need to execute your first serverless function on SLEdge
All binary files are generated in `sledge-serverless-framework/runtime/bin`. You now have everything that you need to execute your first serverless function on SLEdgeScale

To exit the container:
## Running your first serverless function

```bash
exit
```
An SLEdgeScale serverless function consists of a shared library (\*.so) and a JSON configuration file that determines how the runtime should execute the serverless function. We first need to prepare this configuration file. As an example, here is the configuration file for our sample fibonacci function:

To stop the Docker container:
```json
[
{
"name": "gwu",
"port": 31850,
"replenishment-period-us": 0,
"max-budget-us": 0,
"routes": [
{
"route": "/fib",
"request-type": 1,
"n-resas": 1,
"group-id": 1,
"path": "fibonacci.wasm.so",
"admissions-percentile": 70,
"expected-execution-us": 5,
"relative-deadline-us": 50,
"http-resp-content-type": "text/plain"
}
]

}

```bash
./devenv.sh stop
]
```

### Deleting Docker Build Containers

If you are finished working with the SLEdge runtime and wish to remove it, run the following command to delete our Docker build and runtime images.
`port`:Refers to the UDP port.
`request-type` and `path`: Used to determine which serverless function will be served; `request-type` must be unique per function.
`route`: An inherited field from SLEdge. It is not used currently but is kept to avoid parse errors.
`n-resas`: Specifies the number of CPU cores reserved for this serverless function. It is used by the DARC algorithm.
`group-id`: Specifies the group identifier used in the DARC algorithm.
`expected-execution-us`: Currently not used. SLEdgeScale will estimate execution time online.
`relative-deadline-us`: Specifies the request deadline in microseconds.
`http-resp-content-type`: Not used currently but is kept to avoid parse errors.

```bash
./devenv.sh rma
```
### Start the SLEdgeScale Server
First, set the public IPs and ports for eRPC. Open `sledge-serverless-framework/eRPC/scripts/autorun_process_file` — the first line specifies the server IP and port, and the second line specifies the client IP and port. Make sure to apply the same change on the client machine as well.

And then simply delete this repository.
Then we need to export some environment variables before start the server. The commonly used environment variables are:

## Running your first serverless function
`SLEDGE_DISABLE_PREEMPTION`: Disables the timer that sends a SIGALRM signal every 5 ms for preemption. Must disable in SLEdgeScale.

An SLEdge serverless function consists of a shared library (\*.so) and a JSON configuration file that determines how the runtime should execute the serverless function. As an example, here is the configuration file for our sample fibonacci function:
`SLEDGE_DISPATCHER`: Specifies the dispatcher policy. There are seven types of dispatchers:
- SHINJUKU: Requests are enqueued to each dispatcher's typed queue.
- EDF_INTERRUPT: The dispatcher policy used by SLEdgeScale.
- DARC: Requests are enqueued to each dispatcher's typed queue.
- LLD: The dispatcher selects the worker with the least loaded queue to enqueue a request..
- TO_GLOBAL_QUEUE: The dispatcher policy used by SLEdge. All dispatchers enqueue requests to a global queue.
- RR: The dispatcher selects a worker in a round-robin fashion.
- JSQ: The dispatcher selects the worker with the shortest queue to enqueue a request.

`SLEDGE_DISABLE_GET_REQUESTS_FROM_GQ`: Disable workers fetching requests from the global queue. Must be disabled if the dispatcher policy is not set to TO_GLOBAL_QUEUE.

```json
[
{
"name": "GWU",
"port": 10010,
"routes": [
{
"route": "/fib",
"path": "fibonacci.wasm.so",
"expected-execution-us": 6000,
"relative-deadline-us": 20000,
"http-resp-content-type": "text/plain"
}
]
}
]
`SLEDGE_SCHEDULER`: Specifies the scheduler policy. There are two types of schedulers:
- FIFO: First-In-First-Out. Must use the TO_GLOBAL_QUEUE dispatch policy when using FIFO.
- EDF: Earliest-deadline-first.

`SLEDGE_FIFO_QUEUE_BATCH_SIZE`: When using the FIFO scheduler, specifies how many requests are fetched from the global queue to the local queue each time the local queue becomes empty.

```
`SLEDGE_DISABLE_BUSY_LOOP`: Disables the worker’s busy loop for fetching requests from the local or global queue. The busy loop must be enabled if the dispatcher policy is set to `TO_GLOBAL_QUEUE`.

The `port` and `route` fields are used to determine the path where our serverless function will be served served.
`SLEDGE_DISABLE_AUTOSCALING`: Currently not used;always set to `true`.

In our case, we are running the SLEdge runtime on localhost, so our function is available at `localhost:10010/fib`.
`SLEDGE_DISABLE_EXPONENTIAL_SERVICE_TIME_SIMULATION`: For the `hash` function, enabling this option allows SLEdgeScale to estimate the function’s execution time based on the input number. For other types of functions, this should be disabled.

Our fibonacci function will parse a single argument from the HTTP POST body that we send. The expected Content-Type is "text/plain".
`SLEDGE_FIRST_WORKER_COREID`: Specifies the ID of the first core for the worker thread. Cores 0–2 are reserved, so numbering should start from 3.

Now that we understand roughly how the SLEdge runtime interacts with serverless function, let's run Fibonacci!
`SLEDGE_NWORKERS`: The total number of workers in the system.

The fastest way to check it out is just to click on the following URL on your Web browser: [http://localhost:10010/fib?10](http://localhost:10010/fib?10)
`SLEDGE_NLISTENERS`: The total number of dispachers in the system.

From the root project directory of the host environment (not the Docker container!), navigate to the binary directory
`SLEDGE_WORKER_GROUP_SIZE`: The number of workers in each worker group. Its value is equal to SLEDGE_NWORKERS / SLEDGE_NLISTENERS

```bash
cd runtime/bin/
```
`SLEDGE_SANDBOX_PERF_LOG`: Server log file path

Now run the sledgert binary, passing the JSON file of the serverless function we want to serve. Because serverless functions are loaded by SLEdge as shared libraries, we want to add the `applications/` directory to LD_LIBRARY_PATH.
Now run the sledgert binary with the following script using sudo, passing the JSON file (e.g., the above Fibonacci function configuration) of the serverless function we want to serve. Because serverless functions are loaded by SLEdgeScale as shared libraries, we want to add the `applications/` directory to LD_LIBRARY_PATH:

```bash
LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../../tests/fibonacci/bimodal/spec.json
```sh
#!/bin/bash

declare project_path="$(
cd "$(dirname "$0")/../.."
pwd
)"
echo $project_path
path=`pwd`
export SLEDGE_DISABLE_PREEMPTION=true
export SLEDGE_DISABLE_GET_REQUESTS_FROM_GQ=true
export SLEDGE_FIFO_QUEUE_BATCH_SIZE=5
export SLEDGE_DISABLE_BUSY_LOOP=true
export SLEDGE_DISABLE_AUTOSCALING=true
export SLEDGE_DISABLE_EXPONENTIAL_SERVICE_TIME_SIMULATION=true
export SLEDGE_FIRST_WORKER_COREID=3
export SLEDGE_NWORKERS=1
export SLEDGE_NLISTENERS=1
export SLEDGE_WORKER_GROUP_SIZE=1
export SLEDGE_SCHEDULER=EDF
export SLEDGE_DISPATCHER=EDF_INTERRUPT
export SLEDGE_SANDBOX_PERF_LOG=$path/server.log

cd $project_path/runtime/bin
LD_LIBRARY_PATH="$(pwd):$LD_LIBRARY_PATH" ./sledgert ../tests/fib.json
```
### Start the client to send requests
First git clone the client code:
```sh
git clone https://github.com/lyuxiaosu/eRPC.git
```
There are several client implementations under eRPC/apps, and you can also create your own customized client. In our setup, we use `openloop_client`, which is an open-loop client that sends requests following a Poisson distribution.
Edit `autorun_app_file`, `autorun_process_file`, and build:
```sh
cd eRPC
echo "openloop_client" > ./scripts/autorun_app_file
./build.sh
```
Our fibonacci function will parse a single argument from the rpc request that we send. Create the configuration file `eRPC/apps/openloop_client/conf` for `openloop_client`:
```
--test_ms 10000
--sm_verbose 0
--num_server_threads 1
--window_size 10
--req_size 5
--resp_size 32
--num_processes 2
--numa_0_ports 0
--numa_1_ports 1,3
--req_type 1
--rps 1000
--req_parameter 20
--warmup_rps 200
```
`test_ms`: Define the test duration time in milliseconds.

While you don't see any output to the console, the runtime is running in the foreground.

Let's now invoke our serverless function to compute the 10th fibonacci number. We'll use `cURL` and [HTTPie](https://httpie.org/) to send a HTTP GET and POST requests with the parameter we want to pass to my serverless function. Feel free to use whatever other network client you prefer!

Open a **new** terminal session and execute the following
`num_server_threads`: Specifies how many dispatcher threads to run on the server.

```bash
# HTTP GET method:
http localhost:10010/fib?10
curl localhost:10010/fib?10
`req_size`: The size of the request package in bytes

# HTTP POST method:
echo "10" | http POST localhost:10010/fib
curl -i -d 10 localhost:10010/fib
```
`resp_size`: The size of the response package in bytes

You should receive the following in response. The serverless function says that the 10th fibonacci number is 55, which seems to be correct!
`req_type`: The request type

```bash
HTTP/1.1 200 OK
Server: SLEdge
Connection: close
Content-Type: text/plain
Content-Length: 3
`req_parameter`: The parameter carried by the request. Here is the fibonacci number.

55
```

When done, terminal the SLEdge runtime with `Ctrl+c`
Now we have everything, let's run Fibonacci!

## Running Test Workloads
```sh
cd eRPC
./scripts/do.sh 1 0

Various synthetic and real-world tests can be found in `runtime/tests`. Generally, each experiment can be run by Make rules in the top level `test.mk`.
```
The results is saved at `client.log`:
```
thread id, type id, latency, cpu time
0 1 64.492000 23
0 1 46.649000 23
0 1 45.806000 23
0 1 45.877000 22
0 1 45.416000 22
...
```
The first column is the thread ID, the second column is the request type, the third column is the end-to-end latency in microseconds, and the fourth column is the execution time in microseconds.

`make -f test.mk all`
### High Density Test
Since the High Density experiment involves a large number of RPC types, we need to modify the maximum number of RPC types supported by eRPC, as well as some parts of the SLEdgeScale code. These changes are temporary and not part of the permanent code base.
Please run:
```
./apply_patch.sh
```
in the `eRPC` directory (on both the client and server sides) and in the `runtime` directory, and then recompile `eRPC` and the `runtime`.

## Problems or Feedback?

Expand Down
Loading
Loading