Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion benchmarks/media-streaming/client/files/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/bin/bash
set -e

# $1: the IP of the server
# $2: the number of httperf clients
# $3: the total number of sessions
# $4: the rate (sessions per seconds)
# $5: plain text or encrypted communication, possible values are "PT" and "TLS"

if [ "$1" = "bash" ]; then
exec $@
else
cd /root/run && exec ./benchmark.sh $1
cd /root/run && exec ./benchmark.sh $1 $2 $3 $4 $5
fi
24 changes: 13 additions & 11 deletions benchmarks/media-streaming/client/files/run/benchmark.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
#!/bin/bash

num_clients_per_machine=4
min_num_sessions=100
max_num_sessions=2000
server_ip=$1
num_clients_per_machine=${2:-4}
num_sessions=${3:-100}
rate=${4:-10}
mode=${5:-TLS}

streaming_client_dir=..
#server_ip=$(tail -n 1 hostlist.server)
server_ip=$1

peak_hunter/launch_hunt_bin.sh \
$server_ip \
hostlist.client \
$streaming_client_dir \
$num_clients_per_machine \
$min_num_sessions \
$max_num_sessions
peak_hunter/launch_hunt_bin.sh \
$server_ip \
hostlist.client \
$streaming_client_dir \
$num_clients_per_machine \
$num_sessions \
$rate \
$mode

./process_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ videoServerIp="$1"
hostFileName="$2"
remoteOutputPath="$3"
numClientsPerHost="$4"
totalNumSessions="$5"
rate="$6"
mode="$7"

totalMinNumSessions="$5"
totalMaxNumSessions="$6"

if [ $# -ne 6 ]; then
echo "Usage: launch_hunt_bin.sh <video_server_ip> <host_list_file> <remote_output_path> <num_clients_per_host> <min_num_sessions> <max_num_sessions>"
if [ $# -ne 7 ]; then
echo "Usage: launch_hunt_bin.sh <video_server_ip> <host_list_file> <remote_output_path> <num_clients_per_host> <total_num_sessions> <rate> <encryption_mode>"
exit
fi

# Distribute the load
numHosts=$(wc -l < $hostFileName)
numTotalClients=$[$numHosts*$numClientsPerHost]
minNumSessions=$[$totalMinNumSessions/$numTotalClients]
maxNumSessions=$[$totalMaxNumSessions/$numTotalClients]
NumSessions=$[$totalNumSessions/$numTotalClients]

echo "Total clients = $numTotalClients"
echo "Minimum number of sessions = $minNumSessions"
echo "Maximum number of sessions = $maxNumSessions"
echo "Total number of sessions = $totalNumSessions"

benchmarkSuccess=1

outputDir="/output"
backUpStdoutDir="/output-stdout"
Expand All @@ -32,14 +29,12 @@ rm -rf "$outputDir/*" "$backUpStdoutDir"
mkdir -p "$outputDir" "$backUpStdoutDir"

# Launches remote with the specified number of sessions.
# Sets benchmarkSuccess to 1 or 0 depending on success/failure
function launchRemote () {
totalConns=0
totalErrors=0

numSessions="$1"
rate=$[numSessions/10]
$(dirname $0)/launch_remote.sh $videoServerIp $hostFileName $remoteOutputPath $numClientsPerHost $numSessions $rate
$(dirname $0)/launch_remote.sh $videoServerIp $hostFileName $remoteOutputPath $numClientsPerHost $numSessions $rate $mode
if [ $? -ne 0 ]; then
echo 'Failed launching remote... exiting.'
exit
Expand All @@ -59,58 +54,12 @@ function launchRemote () {
if [ "$percFailure" -gt 5 ]; then
cp $backUpStdoutDir/* $outputDir
sleep 10
benchmarkSuccess=0
else
cp $outputDir/* $backUpStdoutDir
benchmarkSuccess=1
fi
}

# Test for minNumSessions
launchRemote $minNumSessions

if [ $benchmarkSuccess -eq 0 ]
then
echo "Benchmark failed for $minNumSessions sessions"
echo "Minimum Limit for number of sessions too high."
exit 0
else
echo "Benchmark succeeded for $minNumSessions sessions"
fi


# Test for maxNumSessions
launchRemote $maxNumSessions
# Test for NumSessions
launchRemote $NumSessions

if [ $benchmarkSuccess -eq 1 ]
then
echo "Benchmark succeeded for $maxNumSessions sessions"
echo "Maximum limit for number of sessions too low."
exit 0
else
echo "Benchmark failed for $maxNumSessions sessions"
fi

lowLimSessions=$minNumSessions
hiLimSessions=$maxNumSessions

# Launch binary search
while :
do
diff=$[maxNumSessions-minNumSessions]
if [ $diff -le 50 ]
then
maxThroughput=$[$numSessions*$numTotalClients]
# echo "Benchmark succeeded for maximum sessions: $maxThroughput"
exit 0
fi
delta=$[(maxNumSessions-minNumSessions)/2]
numSessions=$[minNumSessions+delta]
launchRemote $numSessions
if [ "$benchmarkSuccess" -eq 0 ]
then
maxNumSessions=$numSessions
else
minNumSessions=$numSessions
fi
done
exit 0
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ remoteOutputPath="$3"
numClientsPerHost="$4"
numSessions="$5"
rate="$6"
mode="$7"

if [ $# -ne 6 ]; then
echo "Usage: launch_hunt_bin.sh <video_server_ip> <host_list_file> <remote_output_path> <num_clients_per_host> <num_sessions> <rate>"
if [ $# -ne 7 ]; then
echo "Usage: launch_remote.sh <video_server_ip> <host_list_file> <remote_output_path> <num_clients_per_host> <num_sessions> <rate> <encryption_mode>"
exit
fi

if [ $mode = "PT" ];then
mode="--port 80"
elif [ $mode = "TLS" ]; then
mode="--ssl --port 443"
else
echo "invalid encryption mode flag"
exit
fi

# TODO: this needs to be fixed - need static correspondence between log, ratio, and ip
logs=$(echo /videos/logs/cl* | sed -e 's/ /,/g')
Expand All @@ -25,7 +34,7 @@ do
echo "Launching $numClientsPerHost clients on $host";
for i in $(seq 1 $numClientsPerHost)
do
cmd="httperf --hog --server $videoServerIp --videosesslog=[$logs],[0.1,0.3,0.4,0.2],[localhost,localhost,localhost,localhost] --epoll --recv-buffer=524288 --port 80 --output-log=/output/result$i.log --num-sessions=$numSessions --rate=$rate 2>>/output/bt$i.trace" # > output-stdout/stdout$i"
cmd="httperf --hog --server $videoServerIp --videosesslog=[$logs],[0.1,0.3,0.4,0.2],[localhost,localhost,localhost,localhost] --epoll --recv-buffer=524288 $mode --output-log=/output/result$i.log --num-sessions=$numSessions --rate=$rate 2>>/output/bt$i.trace" # > output-stdout/stdout$i"
echo "Running command $cmd"
eval $cmd &
done
Expand Down
15 changes: 13 additions & 2 deletions benchmarks/media-streaming/client/files/videoperf/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ port_get (void)
mask = 0;
else
mask = ~((1UL << (bit + 1)) - 1);
port_free_map[i] &= ~(1UL << bit);
// commented by aansaarii
// if the port is utilized by another program, it will be utilized by httperf
// and it will never have a chance to be freed, httperf will eventually run out of ports
//port_free_map[i] &= ~(1UL << bit);
port = bit + i*BITSPERLONG + MIN_IP_PORT;
return port;
}
Expand Down Expand Up @@ -1172,8 +1175,16 @@ core_connect (Conn *s)
SYSCALL (BIND,
result = bind (sd, (struct sockaddr *) &myaddr, sizeof (myaddr)));
saved_err = errno;
if (result == 0)
if (result == 0){
// edited by aansaarii
// set the port as allocated if it is binded to this httperf process
int port = myport - MIN_IP_PORT;
int i = port / BITSPERLONG;
int bit = port % BITSPERLONG;
port_free_map[i] &= ~(1UL << bit);
// end edit
break;
}

if (errno != EADDRINUSE && errno == EADDRNOTAVAIL)
{
Expand Down
17 changes: 10 additions & 7 deletions benchmarks/media-streaming/client/files/videoperf/httperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test.
#endif

#define RATE_INTERVAL 5.0
#define STATS_INTERVAL 60.0
#define STATS_INTERVAL 15.0

#define MAX_HOSTNAME_LEN (100)

Expand Down Expand Up @@ -265,6 +265,7 @@ dump_stats (Timer *t, Any_Type regarg)
{
Any_Type callarg;

getrusage (RUSAGE_SELF, &test_rusage_stop); // aansaarii: required to measure CPU utilization
event_signal (EV_DUMP_STATS, 0, callarg);

/* prepare for next sample interval: */
Expand Down Expand Up @@ -357,6 +358,7 @@ main (int argc, char **argv)
param.recv_buffer_size = 16384;
param.rate.dist = DETERMINISTIC;
param.rate_interval = RATE_INTERVAL;
param.stats_interval = STATS_INTERVAL; // aansaarii
param.spec_stats = 0;
#ifdef UW_CALL_STATS
param.call_stats = -1;
Expand Down Expand Up @@ -1211,12 +1213,13 @@ main (int argc, char **argv)
SSLeay_add_ssl_algorithms ();

/* for some strange reason, SSLv23_client_method () doesn't work here */
// ssl_ctx = SSL_CTX_new (SSLv3_client_method ());
// if (!ssl_ctx)
// {
// ERR_print_errors_fp (stderr);
// exit (-1);
// }
SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_3_VERSION);
ssl_ctx = SSL_CTX_new (TLS_client_method ());
if (!ssl_ctx)
{
ERR_print_errors_fp (stderr);
exit (-1);
}

memset (buf, 0, sizeof (buf));
RAND_seed (buf, sizeof (buf));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DEFS += -DUW_PACE_REQUESTS
# Uncomment this to enable statistics that ignore specified ramp up and ramp down periods
#DEFS += -DUW_STABLE_STATS
# Uncomment this to generate stats about the variation in throughput
#DEFS += -DUW_THROUGHPUT_STATS
DEFS += -DUW_THROUGHPUT_STATS

CPPFLAGS += -DBIG_FD_SETSIZE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DEFS += -DUW_PACE_REQUESTS
# Uncomment this to enable statistics that ignore specified ramp up and ramp down periods
#DEFS += -DUW_STABLE_STATS
# Uncomment this to generate stats about the variation in throughput
#DEFS += -DUW_THROUGHPUT_STATS
DEFS += -DUW_THROUGHPUT_STATS

CPPFLAGS += -DBIG_FD_SETSIZE

Expand Down
60 changes: 50 additions & 10 deletions benchmarks/media-streaming/client/files/videoperf/stat/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

/* Basic statistics collector. */


#include "config.h"

#include <stdio.h>
Expand Down Expand Up @@ -202,23 +203,62 @@ perf_sample (Event_Type et, Object *obj, Any_Type reg_arg, Any_Type call_arg)
rate = weight*num_replies;

if (!started_dump_stats) {
printf("Benchmark stats...\n");
if(verbose) {
printf("Benchmark stats...\n");
}
started_dump_stats = 1;
}
for (i=0; i < MAX_LOG_FILES; i++) {
printf("%d ", basic.num_active_conns[i]);
}
printf("\n");
if(verbose){
printf("\n\n\n");
for (i=0; i < MAX_LOG_FILES; i++) {
printf("%d ", basic.num_active_conns[i]);
}
printf("\n");
}
#ifdef UW_THROUGHPUT_STATS
/* convert throughput into Mbps */
double throughput = weight * bytes_received / 125000.0;
if (verbose)
printf("throughput = %-8.2lf reply-rate = %-8.1f connected-conns = %-8d\n",
throughput, rate, basic.num_connected_conns);
double throughput = weight * bytes_received * 8.0 / 1048576; // aansaarii: 1048576 = 1 M (2^20)
if (verbose){
printf("Last Period: throughput (Mbps) = %-8.2lf reply-rate = %-8.1f connected-conns = %-8d\n",
throughput, rate, basic.num_connected_conns);
// aansaarii
printf ("Errors: total %-8u client-timo %-8u socket-timo %-8u "
"connrefused %-8u connreset %-8u\n"
"Errors: fd-unavail %-8u addrunavail %-8u ftab-full %-8u "
"addrinuse %-8u other %-8u\n",
(basic.num_client_timeouts + basic.num_sock_timeouts
+ basic.num_sock_fdunavail + basic.num_sock_ftabfull
+ basic.num_sock_refused + basic.num_sock_reset
+ basic.num_sock_addrunavail + basic.num_sock_addrinuse
+ basic.num_other_errors),
basic.num_client_timeouts, basic.num_sock_timeouts,
basic.num_sock_refused, basic.num_sock_reset,
basic.num_sock_fdunavail, basic.num_sock_addrunavail,
basic.num_sock_ftabfull, basic.num_sock_addrinuse,
basic.num_other_errors);
fflush(stdout);
}
#else
if (verbose)
if (verbose){
printf("reply-rate = %-8.1f connected-conns = %-8d\n",
rate, basic.num_connected_conns);
// aansaarii
printf ("Errors: total %-8u client-timo %-8u socket-timo %-8u "
"connrefused %-8u connreset %-8u\n"
"Errors: fd-unavail %-8u addrunavail %-8u ftab-full %-8u "
"addrinuse %-8u other %-8u\n",
(basic.num_client_timeouts + basic.num_sock_timeouts
+ basic.num_sock_fdunavail + basic.num_sock_ftabfull
+ basic.num_sock_refused + basic.num_sock_reset
+ basic.num_sock_addrunavail + basic.num_sock_addrinuse
+ basic.num_other_errors),
basic.num_client_timeouts, basic.num_sock_timeouts,
basic.num_sock_refused, basic.num_sock_reset,
basic.num_sock_fdunavail, basic.num_sock_addrunavail,
basic.num_sock_ftabfull, basic.num_sock_addrinuse,
basic.num_other_errors);
fflush(stdout);
}
#endif /* UW_THROUGHPUT_STATS */

#ifdef UW_STABLE_STATS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ perf_sample (Event_Type et, Object *obj, Any_Type reg_arg, Any_Type call_arg)
rate = weight*st.num_completed_since_last_sample;
st.num_completed_since_last_sample = 0;

// aansaarii
if (verbose)
printf ("session-rate = %-8.1f\n", rate);
printf ("session-rate = %-8.1f, session-completed: %-8u, session-failed: %-8u, session-total: %-8u\n", rate, st.num_completed, st.num_failed, st.num_completed + st.num_failed);

++st.num_rate_samples;
st.rate_sum += rate;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/media-streaming/dataset/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN wget https://downloads.xiph.org/releases/ogg/libogg-1.3.4.tar.gz \
&& dpkg -i /libogg-1.3.4/build/libogg0-1.3.4-Linux.deb

RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y \
&& apt-get install -y --no-install-recommends libavcodec58 libavfilter7 libavdevice58 libavformat58 libchromaprint1 libflac8 libvorbisenc2 \
&& apt-get install -y --no-install-recommends libavcodec59 libavfilter8 libavdevice59 libavformat59 libchromaprint1 libflac8 libvorbisenc2 \
software-properties-common \
build-essential \
curl \
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/media-streaming/dataset/files/filegen/params/240p
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library_size=10
library_size=9
num_log_files=1
num_log_sessions=5
num_log_sessions=1000
video_quality=240p
Loading