Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-6217: add server groups #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion bin/benchmark-run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function define_ips()
{
# Defining IP of the local machine.
local local_ip_addresses=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
local comma_separated_ips="${SERVER_HOSTS},${DRIVER_HOSTS}"
local comma_separated_ips="${SERVER_HOSTS},${DRIVER_HOSTS},${SERVER_GROUP1_HOSTS},${SERVER_GROUP2_HOSTS},${SERVER_GROUP3_HOSTS}"
local ips=${comma_separated_ips//,/ }
local uniq_ips=`echo "${ips[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '`
for local_ip in ${local_ip_addresses[@]}
Expand Down
163 changes: 88 additions & 75 deletions bin/benchmark-servers-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,95 +111,108 @@ CUR_DIR=$(pwd)
DS=""

id=0

IFS=',' read -ra hosts0 <<< "${SERVER_HOSTS}"
for host_name in "${hosts0[@]}";
for grp in 0 1 2 3 ;
do
CONFIG_PRM="-id ${id} ${CONFIG}"

suffix=`echo "${CONFIG}" | tail -c 60 | sed 's/ *$//g'`
if [[ "$grp" == "0" ]] ; then
SRV_HOST_TMP="${SERVER_HOSTS}"
else
eval SRV_HOST_TMP='$'"SERVER_GROUP${grp}_HOSTS"
fi

echo "<"$(date +"%H:%M:%S")"><yardstick> Starting server config '..."${suffix}"' on "${host_name}" with id=${id}"
if [[ -z "$SRV_HOST_TMP" ]]; then
break
fi

now=`date +'%H%M%S'`
IFS=',' read -ra hosts0 <<< "${SRV_HOST_TMP}"

# Extract description.
IFS=' ' read -ra cfg0 <<< "${CONFIG}"
for cfg00 in "${cfg0[@]}";
for host_name in "${hosts0[@]}";
do
if [[ ${found} == 'true' ]]; then
found=""
DS=${cfg00}
fi
CONFIG_PRM="-id ${id} ${CONFIG}"

suffix=`echo "${CONFIG}" | tail -c 60 | sed 's/ *$//g'`

echo "<"$(date +"%H:%M:%S")"><yardstick> Starting server config '..."${suffix}"' on "${host_name}" with id=${id}"

now=`date +'%H%M%S'`

# Extract description.
IFS=' ' read -ra cfg0 <<< "${CONFIG}"
for cfg00 in "${cfg0[@]}";
do
if [[ ${found} == 'true' ]]; then
found=""
DS=${cfg00}
fi

if [[ ${cfg00} == '-ds' ]] || [[ ${cfg00} == '--descriptions' ]]; then
found="true"
fi
done

if [[ ${cfg00} == '-ds' ]] || [[ ${cfg00} == '--descriptions' ]]; then
found="true"
file_log=${LOGS_DIR}"/"${now}"-id"${id}"-"${host_name}"-"${DS}".log"

if [[ ${JVM_OPTS} == *"PrintGC"* ]]
then
JVM_OPTS=${JVM_OPTS}" -Xloggc:${LOGS_DIR}/gc-${now}-server-id${id}-${host_name}-${DS}.log"
fi
done

file_log=${LOGS_DIR}"/"${now}"-id"${id}"-"${host_name}"-"${DS}".log"
export JAVA_HOME=${JAVA_HOME}
export MAIN_CLASS='org.yardstickframework.BenchmarkServerStartUp'
export JVM_OPTS="${JVM_OPTS}${SERVER_JVM_OPTS} -Dyardstick.server${id}"
export CP=${CP}
export CUR_DIR=${CUR_DIR}
export PROPS_ENV0=${PROPS_ENV}

if [[ ${host_name} = "127.0.0.1" || ${host_name} = "localhost" ]]
then
mkdir -p ${LOGS_DIR}

nohup ${SCRIPT_DIR}/benchmark-bootstrap.sh ${CONFIG_PRM} "--config" ${CONFIG_INCLUDE} "--logsFolder" ${LOGS_DIR} \
"--remoteuser" ${REMOTE_USER} "--remoteHostName" ${host_name} "--serverNameNumber" ${grp} > ${file_log} 2>& 1 &
else
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} mkdir -p ${LOGS_DIR}

ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} \
"JAVA_HOME='${JAVA_HOME}'" \
"MAIN_CLASS='${MAIN_CLASS}'" "JVM_OPTS='${JVM_OPTS}'" "CP='${CP}'" \
"CUR_DIR='${CUR_DIR}'" "PROPS_ENV0='${PROPS_ENV}'" \
"nohup ${SCRIPT_DIR}/benchmark-bootstrap.sh ${CONFIG_PRM} "--config" ${CONFIG_INCLUDE} "--logsFolder" ${LOGS_DIR} \
"--remoteuser" ${REMOTE_USER} "--remoteHostName" ${host_name} "--serverNameNumber" ${grp} > ${file_log} 2>& 1 &"
fi

if [[ ${JVM_OPTS} == *"PrintGC"* ]]
then
JVM_OPTS=${JVM_OPTS}" -Xloggc:${LOGS_DIR}/gc-${now}-server-id${id}-${host_name}-${DS}.log"
fi

export JAVA_HOME=${JAVA_HOME}
export MAIN_CLASS='org.yardstickframework.BenchmarkServerStartUp'
export JVM_OPTS="${JVM_OPTS}${SERVER_JVM_OPTS} -Dyardstick.server${id}"
export CP=${CP}
export CUR_DIR=${CUR_DIR}
export PROPS_ENV0=${PROPS_ENV}

if [[ ${host_name} = "127.0.0.1" || ${host_name} = "localhost" ]]
then
mkdir -p ${LOGS_DIR}
# Start a restarter if needed.
if [[ "${RESTART_SERVERS}" != "" ]] && [[ "${RESTART_SERVERS}" != "true" ]]; then
IFS=',' read -ra hostsToRestart0 <<< "${RESTART_SERVERS}"
for host2Timeout in "${hostsToRestart0[@]}";
do
IFS=':' read -ra hostToRestart <<< "${host2Timeout}"

nohup ${SCRIPT_DIR}/benchmark-bootstrap.sh ${CONFIG_PRM} "--config" ${CONFIG_INCLUDE} "--logsFolder" ${LOGS_DIR} \
"--remoteuser" ${REMOTE_USER} "--remoteHostName" ${host_name} > ${file_log} 2>& 1 &
else
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} mkdir -p ${LOGS_DIR}

ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} \
"JAVA_HOME='${JAVA_HOME}'" \
"MAIN_CLASS='${MAIN_CLASS}'" "JVM_OPTS='${JVM_OPTS}'" "CP='${CP}'" \
"CUR_DIR='${CUR_DIR}'" "PROPS_ENV0='${PROPS_ENV}'" \
"nohup ${SCRIPT_DIR}/benchmark-bootstrap.sh ${CONFIG_PRM} "--config" ${CONFIG_INCLUDE} "--logsFolder" ${LOGS_DIR} \
"--remoteuser" ${REMOTE_USER} "--remoteHostName" ${host_name} > ${file_log} 2>& 1 &"
fi
host_to_restart=${hostToRestart[0]}
id_to_restart=${hostToRestart[1]}
delay=${hostToRestart[2]}
pause=${hostToRestart[3]}
period=${hostToRestart[4]}

if [[ "${host_to_restart}" = "${host_name}" ]] && [[ "${id_to_restart}" = "${id}" ]] ; then
if [[ "${delay}" != "" ]] && [[ "${pause}" != "" ]] && [[ "${period}" != "" ]] ; then
file_log=${RESTARTERS_LOGS_DIR}"/"${now}"_id"${id}"_"${host_name}".log"

nohup ${SCRIPT_DIR}/benchmark-server-restarter-start.sh "${host_name}" "${id}" "${CONFIG_PRM}" \
"${delay}" "${pause}" "${period}" "${CONFIG_INCLUDE}" > ${file_log} 2>& 1 &

# Start a restarter if needed.
if [[ "${RESTART_SERVERS}" != "" ]] && [[ "${RESTART_SERVERS}" != "true" ]]; then
IFS=',' read -ra hostsToRestart0 <<< "${RESTART_SERVERS}"
for host2Timeout in "${hostsToRestart0[@]}";
do
IFS=':' read -ra hostToRestart <<< "${host2Timeout}"

host_to_restart=${hostToRestart[0]}
id_to_restart=${hostToRestart[1]}
delay=${hostToRestart[2]}
pause=${hostToRestart[3]}
period=${hostToRestart[4]}

if [[ "${host_to_restart}" = "${host_name}" ]] && [[ "${id_to_restart}" = "${id}" ]] ; then
if [[ "${delay}" != "" ]] && [[ "${pause}" != "" ]] && [[ "${period}" != "" ]] ; then
file_log=${RESTARTERS_LOGS_DIR}"/"${now}"_id"${id}"_"${host_name}".log"

nohup ${SCRIPT_DIR}/benchmark-server-restarter-start.sh "${host_name}" "${id}" "${CONFIG_PRM}" \
"${delay}" "${pause}" "${period}" "${CONFIG_INCLUDE}" > ${file_log} 2>& 1 &

echo "<"$(date +"%H:%M:%S")"><yardstick> Server restarter is started for ${host_to_restart} \
with id=${id} and config '...${suffix}', warmup delay ${delay} sec., pause ${pause} sec. and period ${period} sec."
else
echo "<"$(date +"%H:%M:%S")"><yardstick> Failed to start a server restarter for host \
${host_to_restart} with id=${id}. Next params should not be empty: [warmup delay='${delay}', pause='${pause}', period='${period}']"
echo "<"$(date +"%H:%M:%S")"><yardstick> Server restarter is started for ${host_to_restart} \
with id=${id} and config '...${suffix}', warmup delay ${delay} sec., pause ${pause} sec. and period ${period} sec."
else
echo "<"$(date +"%H:%M:%S")"><yardstick> Failed to start a server restarter for host \
${host_to_restart} with id=${id}. Next params should not be empty: [warmup delay='${delay}', pause='${pause}', period='${period}']"
fi
fi
fi
done
fi
# End of restarter logic.
done
fi
# End of restarter logic.

id=$((1 + $id))
done
id=$((1 + $id))
done
done
36 changes: 25 additions & 11 deletions bin/benchmark-servers-stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,30 @@ if [[ "${RESTART_SERVERS}" != "" ]] && [[ "${RESTART_SERVERS}" != "true" ]]; the
echo "<"$(date +"%H:%M:%S")"><yardstick> All server restartets are stopped."
fi

IFS=',' read -ra hosts0 <<< "${SERVER_HOSTS}"
for host_name in "${hosts0[@]}";
for grp in 0 1 2 3 ;
do
if [[ ${host_name} = "127.0.0.1" || ${host_name} = "localhost" ]]
then
pkill -9 -f "Dyardstick.server"

else
`ssh -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} pkill -9 -f "Dyardstick.server"`
fi

echo "<"$(date +"%H:%M:%S")"><yardstick> Server is stopped on "${host_name}
if [[ "$grp" == "0" ]] ; then
SRV_HOST_TMP="${SERVER_HOSTS}"
else
eval SRV_HOST_TMP='$'"SERVER_GROUP${grp}_HOSTS"
fi

if [[ -z "$SRV_HOST_TMP" ]]; then
break
fi

IFS=',' read -ra hosts0 <<< "${SRV_HOST_TMP}"

for host_name in "${hosts0[@]}";
do
if [[ ${host_name} = "127.0.0.1" || ${host_name} = "localhost" ]]
then
pkill -9 -f "Dyardstick.server"

else
`ssh -o PasswordAuthentication=no ${REMOTE_USER}"@"${host_name} pkill -9 -f "Dyardstick.server"`
fi

echo "<"$(date +"%H:%M:%S")"><yardstick> Server is stopped on "${host_name}
done
done
12 changes: 9 additions & 3 deletions src/main/java/org/yardstickframework/BenchmarkConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ public class BenchmarkConfiguration implements Serializable {
private List<String> driverNames;

/** */
@Parameter(names = {"-sn", "--serverName"}, description = "Benchmark server name (required)")
private String serverName;
@Parameter(names = {"-sn", "--serverName"},
description = "Space-separated list of benchmark server name (required), maximum size is 4")
private List<String> serverName;

/** */
@Parameter(names = {"-nn", "--serverNameNumber"}, description = "Number of the benchmark server name (default 0, max 3)")
private int serverNameNumber;

/** */
@Parameter(names = {"-id", "--memberId"}, description = "Memebr ID")
Expand Down Expand Up @@ -150,7 +155,7 @@ public boolean help() {
* @return Benchmark server name.
*/
public String serverName() {
return serverName;
return serverName.size() > serverNameNumber ? serverName.get(serverNameNumber) : null;
}

/**
Expand Down Expand Up @@ -425,6 +430,7 @@ public String defaultDescription() {
"memberId='" + memberId + '\'' +
", driverNames='" + driverNames + '\'' +
", serverName='" + serverName + '\'' +
", serverNameNumber='" + serverNameNumber + '\'' +
", threads=" + threads +
", duration=" + duration +
", warmup=" + warmup +
Expand Down