# Run Applications in Graphene We prepared and tested several applications to demonstrate Graphene usability. These applications can be directly built and run from the Graphene source: * [LMBench (v2.5)](#running-lmbench-in-graphene) * [Python](#running-python-in-graphene) * [R](#running-r-in-graphene) * [GCC](#running-gcc-in-graphene) * [Lighttpd](#running-lighttpd-in-graphene) * [Apache](#running-apache-in-graphene) * [Busybox](#running-busybox-in-graphene) * [Bash](#running-bash-in-graphene) ## Running LMBench in Graphene The LMBench source and scripts are stored in the directory `LibOS/shim/test/apps/lmbench`. Many convenient commands are written in the Makefile inside the directory. The following steps compile and run LMBench in a native environment and under Graphene. cd LibOS/shim/test/apps/lmbench make # compile lmbench and set up manifests as target of Graphene tests make test-native # run the whole package in native environment make test-graphene # run the whole package in Graphene The result of native runs can be found in `lmbench-2.5/results/linux`. The result of Graphene runs can be found in `lmbench-2.5/results/graphene`. The file with the largest number as suffix will be the latest output. For debugging purposes, you may want to test each LMBench test individually. To do that, run the following commands: cd LibOS/shim/test/apps/lmbench cd lmbench-2.5/bin/linux/ ./lat_syscall null # run the specific test, for example, lat_syscall ./pal lat_syscall null # run lat_syscall in Graphene To run the tcp and udp latency tests: ./pal_loader lat_udp -s & # starts a server ./pal_loader lat_udp 127.0.0.1 # starts a client ./pal_loader lat_udp -127.0.0.1 # kills the server ## Running Python in Graphene To run Python, first prepare the manifest: cd LibOS/shim/test/apps/python make You can run `python.manifest` as an executable to load any script. The manifest file is actually a script with a shebang that can be automatically loaded in PAL. Use the following commands: ./python.manifest scripts/helloworld.py ./python.manifest scripts/fibonacci.py ## Running R in Graphene To run R, first prepare the manifest: cd LibOS/shim/test/apps/r make You can run `R.manifest` as an executable to load any script. The manifest file is actually a script with a shebang that can be automatically loaded in PAL. Use the following command: ./R.manifest -f scripts/sample.r ## Running GCC in Graphene We prepared several C/C++ source files to test the performance of file I/O. The scripts and the tested source files can be found in `LibOS/shim/test/apps/gcc/test_files`. The source files include: * `helloworld.c`: an extremely small source file * `gzip.c`: a larger real-world application * `oggenc.m.c`: even larger, linked with libm.so * `single-gcc.c`: all of the gcc source in one source file, used as a stress test To test compilation of these source files, first prepare the GCC manifest to compile the program: cd LibOS/shim/test/apps/gcc make To test GCC, run `gcc.manifest` as an executable. The manifest file is actually a script with a shebang that can be automatically loaded in PAL. Use the following commands: ./gcc.manifest -o test_files/hello test_files/helloworld.c ./gcc.manifest -o test_files/single-gcc test_files/single-gcc.c ## Running Lighttpd in Graphene Lighttpd can be used to test the TCP latency and throughput of Graphene, in either single-threaded or multi-threaded environment. The scripts and the source code for Lighttpd can be found in `LibOS/shim/test/apps/lighttpd`. To build Lighttpd, run the following command: cd LibOS/shim/test/apps/lighttpd make The commands above will compile the source code, build the manifest file for Graphene, generate the configuration file for Lighttpd, and generate the HTML sample files. We prepared the following file samples: * `html/random/*.html`: random files (non-html) created with different sizes The server should be started manually and tested by running the ApacheBench (ab) benchmark from a remote client. To start the HTTP server, run one of the following commands: make start-native-server or make start-graphene-server To start the server in a multi-threaded environment, run one of the following commands: make start-multithreaded-native-server or make start-multithreaded-graphene-server For testing, use ApacheBench (ab). There is a script `run-apachebench.sh` that takes two arguments: the IP and the port. It runs 100,000 requests (`-n 100000`) with 25 to 200 maximum outstanding requests (`-c 25` to `-c 200`). The results are saved into the same directory, and all previous output files are overwritten. make start-graphene-server ./run-apachebench.sh # which internally calls: # ab -k -n 100000 -c [25:200] -t 10 http://ip:port/random/100.1.html ## Running Apache in Graphene Apache is a commercial-class web server that can be used to test the TCP latency and throughput of Graphene. The scripts and the source code can be found in `LibOS/shim/test/apps/apache`. To build Apache, run the following command: cd LibOS/shim/test/apps/apache make The commands above will compile the source code, build the manifest file for Graphene, generate the configuration file for Apache, and generate the HTML sample files (same as described in the [lighttpd section](#running-lighttpd-in-graphene)). The server can be started manually via one of the following commands: make start-native-server or make start-graphene-server By default, the Apache web server is configured to run with 4 preforked worker processes and has PHP support enabled. To test Apache server with ab, run: make start-graphene-server ./run-apachebench.sh # which internally calls: # ab -k -n 100000 -c [25:200] -t 10 http://ip:port/random/100.1.html ## Running Busybox in Graphene Busybox is a standalone shell including general-purpose system utilities. The scripts and the source code for Busybox is stored in `LibOS/shim/apps/busybox`. To build the source code with the proper manifest, run the following commands: cd Shim/shim/test/apps/busybox make To run Busybox, you may directly run busybox.manifest built in the directory as a script. For example: ./busybox.manifest sh (to run a shell) or ./busybox.manifest ls -l (to list local directory) ## Running Bash in Graphene Bash is the most commonly used shell utility in Linux. The scripts and the source code for Bash are stored in `LibOS/shim/apps/bash`. To build the source code with the proper manifest, simply run the following commands: cd Shim/shim/test/apps/bash make To test Bash, use the benchmark suites we prepared: `bash_test.sh` and `unixbench`. Run one of the following commands to test Bash: ./bash.manifest bash_test.sh [times] ./bash.manifest unixbench.sh [times]