|
| 1 | +Microservices microbenchmarks |
| 2 | +============================= |
| 3 | +This repository contains the code for the benchmarks presented in our ATC '18 short paper, "Putting the 'Micro' Back in Microservice." |
| 4 | + |
| 5 | +License |
| 6 | +------- |
| 7 | +The entire contents and history of this repository are distributed under the following license: |
| 8 | + |
| 9 | + Copyright 2018 Carnegie Mellon University |
| 10 | + |
| 11 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 12 | + you may not use this file except in compliance with the License. |
| 13 | + You may obtain a copy of the License at |
| 14 | + |
| 15 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 16 | + |
| 17 | + Unless required by applicable law or agreed to in writing, software |
| 18 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 19 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 20 | + See the License for the specific language governing permissions and |
| 21 | + limitations under the License. |
| 22 | + |
| 23 | +Dependencies |
| 24 | +------------ |
| 25 | +To obtain the results in the paper, we used the following versions: |
| 26 | +* Linux 4.13.0 built from upstream |
| 27 | +* GCC 7.3.0 from Debian |
| 28 | +* Rust 1.23.0 installed using rustup |
| 29 | + |
| 30 | +System components |
| 31 | +----------------- |
| 32 | +In addition to the experiment driver, this suite consists of the following programs: |
| 33 | +* `host`: referred to in the paper as the "dispatcher process" |
| 34 | +* `launcher`: referred to in the paper as the "worker process" |
| 35 | +* Microservices: |
| 36 | + * `test.rs`: timestamp recorder used for section 2.1 of the paper |
| 37 | + * `sleep.rs`: used for signal predictability study in section 2.2 of the paper |
| 38 | + * `hasher/`: hashing workload used for section 4 of the paper |
| 39 | + |
| 40 | +Modes of operation |
| 41 | +------------------ |
| 42 | +The `host` and `launcher` each have two different modes of operation, selected at compile time. |
| 43 | + |
| 44 | +When doing a `make host`, provide the environment variable `INVOCATION="..."` to specify how microservices should be invoked: |
| 45 | +* `launcher` uses worker processes to demonstrate what the paper refers to as "language-based isolation" |
| 46 | +* Otherwise, the process launches microservices directly ("process-based isolation") according to the other two possible values: |
| 47 | + * `forkjoin` launches a new microservice process every time a request must be handled ("cold-start invocation" in the paper) |
| 48 | + * `sendmsg` launches a blocking process for each microservice at the start and forwards requests using loopback UDP ("cold-start invocation") |
| 49 | + |
| 50 | +If the dispatcher is configured to use worker processes, do a `make launcher` with `UNLOADING="..."`: |
| 51 | +* `cleanup` to `dlopen()`, `dlsym()`, `dlclose()` each time any microservice must be invoked ("cold-start invocation" in the paper) |
| 52 | +* `memoize` to keep microservice libraries loaded into the workers after the initial `dlopen()` ("warm-start invocation" in the paper) |
| 53 | + |
| 54 | +Microservices need to be built as shared libraries if using `launcher`, and as executables otherwise. |
| 55 | + |
| 56 | +Data files with reported numbers |
| 57 | +-------------------------------- |
| 58 | +The data files containing the full results from the experimental runs presented in the paper may be downloaded from: |
| 59 | +https://github.com/efficient/microservices_microbenchmarks/releases |
| 60 | + |
| 61 | +Each archive contains a script that can be used to easily rerun that experiment. |
| 62 | + |
| 63 | +Invocation latency experiment (section 2.1) |
| 64 | +------------------------------------------- |
| 65 | +First build the core components: |
| 66 | +1. Do a `make distclean` if you already have build artifacts in the checkout. |
| 67 | +2. Start by building the `host` and `launcher` (if applicable) as described above. |
| 68 | + |
| 69 | +Now it's time to build the microservice. |
| 70 | +To simulate running a large number of diverse microservices, we make 5000 copies of a compiled microservice; |
| 71 | +this prevents the kernel from sharing memory pages between them. |
| 72 | +To build and copy the necessary microservice, do a |
| 73 | + |
| 74 | + ./mkuls test 5000 bins |
| 75 | + |
| 76 | +for a "process-based isolation" run, or a |
| 77 | + |
| 78 | + ./mkuls libtest.so 5000 libs |
| 79 | + |
| 80 | +for a "language-based isolation" one. |
| 81 | + |
| 82 | +Download and extract the `invocation.tar` archive from the above link. |
| 83 | +Notice that there's a folder for each mode of the experiment presented in the paper. |
| 84 | +Choose one such folder (we'll call it "src") and the name of a new output folder to be created (we'll call it "dest"), then do: |
| 85 | + |
| 86 | + src/repeat dest |
| 87 | + |
| 88 | +Once the experiment finishes, the results can be found in a text file within the new folder. |
| 89 | + |
| 90 | +Preemption throughput degradation experiment (section 3) |
| 91 | +-------------------------------------------------------- |
| 92 | +First build the core components using this specific configuration: |
| 93 | +1. Do a `make distclean` if you already have build artifacts in the checkout. |
| 94 | +2. Run: `make host INVOCATION="launcher"` |
| 95 | +3. Run: `make launcher UNLOADING="cleanup"` |
| 96 | + |
| 97 | +Now build the SHA-512 hasher microservice as a shared object: `make hasher/so` |
| 98 | + |
| 99 | +Download and extract the `preemption.tar` archive from the above link. |
| 100 | +Decide on the name of some new output folder (here, "out") and do: |
| 101 | + |
| 102 | + preemption/repeat out |
| 103 | + |
| 104 | +Once the experiment finishes, the results can be found in a series of text files within the new folder. |
| 105 | + |
| 106 | +Signal predictability experiment (section 2.2) |
| 107 | +---------------------------------------------- |
| 108 | +No data files are provided for this experiment. |
| 109 | + |
| 110 | +Start by building the core components using the same steps as in the previous section. |
| 111 | +Next, build the microservice using: `make libsleep.so` |
| 112 | + |
| 113 | +Decide on the desired SIGALRM period (which we'll refer to as "quantum"), in microseconds. |
| 114 | +Now do: |
| 115 | + |
| 116 | + ./stats 1 taskset 0x1 ./signaling 3 |
| 117 | + |
| 118 | +This will run the experiment, then print the absolute values of recorded deviations followed by a statistical summary. |
| 119 | +We recommend treating the very first invocation as a warmup round. |
0 commit comments