Skip to content

Commit f3042d9

Browse files
juwinvirayfacebook-github-bot
authored andcommitted
install wrk and nginx (#248)
Summary: Basic setup for load generator + nginx server. NOTE: Working on cachelib based implementation, want to check in nginx based version first Differential Revision: D83021880
1 parent 285ac5e commit f3042d9

3 files changed

Lines changed: 71 additions & 3 deletions

File tree

packages/cdn_bench/cleanup_cdn_bench.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
# LICENSE file in the root directory of this source tree.
66
set -Eeuo pipefail
77

8-
echo "Goodbye, World!"
8+
# nginx
9+
sudo dnf remove nginx

packages/cdn_bench/install_cdn_bench.sh

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,67 @@
55
# LICENSE file in the root directory of this source tree.
66
set -Eeuo pipefail
77

8-
echo "Hello, World!"
8+
9+
CDN_PACKAGE_DIR="$(dirname "$(readlink -f "$0")")"
10+
LINUX_DIST_ID="$(awk -F "=" '/^ID=/ {print $2}' /etc/os-release | tr -d '"')"
11+
12+
# Wrk
13+
WRK_GIT_REPO='https://github.com/wg/wrk/'
14+
WRK_GIT_RELEASE_TAG='4.2.0'
15+
16+
# Cachelib
17+
# CACHELIB_GIT_REPO='https://github.com/facebook/CacheLib'
18+
# CACHELIB_GIT_RELEASE_TAG='main'
19+
20+
##########################################
21+
# Install prerequisite packages
22+
##########################################
23+
if [ "$LINUX_DIST_ID" = "ubuntu" ]; then
24+
apt install -y autoconf automake libevent-dev zlib1g zlib1g-dev perl
25+
elif [ "$LINUX_DIST_ID" = "centos" ]; then
26+
dnf install -y autoconf automake libevent-devel zlib-devel perl
27+
fi
28+
29+
###########################################
30+
# Install Nginx
31+
###########################################
32+
if [ "$LINUX_DIST_ID" = "ubuntu" ]; then
33+
apt install -y nginx
34+
elif [ "$LINUX_DIST_ID" = "centos" ]; then
35+
dnf install -y nginx
36+
fi
37+
38+
############################################
39+
# Install Wrk
40+
############################################
41+
if ! [ -x "$(command -v wrk)" ]; then
42+
# shellcheck disable=SC2046
43+
git clone "$WRK_GIT_REPO"
44+
cd wrk || exit 1
45+
# shellcheck disable=SC2046
46+
git checkout "$WRK_GIT_RELEASE_TAG"
47+
make -j8
48+
# copy to local binaries
49+
cp ./wrk /usr/local/bin/wrk
50+
cd ..
51+
fi
52+
53+
54+
# ############################################
55+
# # Install Cachebench
56+
# ############################################
57+
# if ! [ -d ./CacheLib ]; then
58+
# git clone "$CACHELIB_GIT_REPO"
59+
# fi
60+
# cd CacheLib
61+
# # git checkout "$CACHELIB_GIT_RELEASE_TAG"
62+
63+
# # install deps for server build
64+
# ./build/fbcode_builder/getdeps.py install-system-deps cachelib
65+
# ./build/fbcode_builder/getdeps.py build --allow-system-packages cachelib
66+
# ./build/fbcode_builder/getdeps.py build --allow-system-packages proxygen
67+
68+
# # build cachelib server
69+
# cd ./examples/proxygen_cache
70+
# ./build.sh
71+
# cp ./build/proxygen_cache /usr/local/bin/proxygen_cache

packages/cdn_bench/run.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
# LICENSE file in the root directory of this source tree.
66
set -Eeuo pipefail
77

8-
echo "Run, World!"
8+
# start nginx
9+
nginx
10+
11+
# run load gen
12+
wrk http://127.0.0.1

0 commit comments

Comments
 (0)