github.com/m3db/m3@v1.5.0/scripts/benchmarks/benchmark-loadgen/benchmark-loadgen.sh (about)

     1  #!/bin/bash
     2  
     3  set -e
     4  
     5  PARAM_NUM_INSTANCES=${NUM_INSTANCES:-100}
     6  
     7  PARAM_COORDINATOR=${COORDINATOR:-127.0.0.1}
     8  PARAM_COORDINATOR_API_PORT=${COORDINATOR_API_PORT:-7201}
     9  PARAM_COORDINATOR_DEBUG_PORT=${COORDINATOR_DEBUG_PORT:-7203}
    10  
    11  PARAM_DBNODES=${DBNODES:-127.0.0.1}
    12  PARAM_DBNODE_DEBUG_PORT=${DBNODE_DEBUG_PORT:-9004}
    13  
    14  CFG_COORDINATOR="${PARAM_COORDINATOR}:${PARAM_COORDINATOR_API_PORT}"
    15  
    16  CFG_SCRAPE_FAKEWEBSERVERS=""
    17  for N in $(seq 1 $PARAM_NUM_INSTANCES); do
    18    PORT=$(expr 8080 + $N - 1)
    19    if [ "$CFG_SCRAPE_FAKEWEBSERVERS" != "" ]; then
    20      CFG_SCRAPE_FAKEWEBSERVERS="${CFG_SCRAPE_FAKEWEBSERVERS},"
    21    fi
    22    CFG_SCRAPE_FAKEWEBSERVERS="${CFG_SCRAPE_FAKEWEBSERVERS}\"fakewebserver01:${PORT}\""
    23  done
    24  
    25  CFG_SCRAPE_DBNODES=""
    26  for DBNODE in $(echo $PARAM_DBNODES | tr "," "\n"); do
    27    if [ "$CFG_SCRAPE_DBNODES" != "" ]; then
    28      CFG_SCRAPE_DBNODES="${CFG_SCRAPE_DBNODES},"
    29    fi
    30    CFG_SCRAPE_DBNODES="${CFG_SCRAPE_DBNODES}\"${DBNODE}:${PARAM_DBNODE_DEBUG_PORT}\""
    31  done
    32  
    33  CFG_SCRAPE_COORDINATOR="\"${PARAM_COORDINATOR}:${PARAM_COORDINATOR_DEBUG_PORT}\""
    34  
    35  sed -e "s/\${coordinator}/${CFG_COORDINATOR}/" \
    36    -e "s/\${fakewebserver_scrape_targets}/${CFG_SCRAPE_FAKEWEBSERVERS}/" \
    37    -e "s/\${dbnode_scrape_targets}/${CFG_SCRAPE_DBNODES}/" \
    38    -e "s/\${coordinator_scrape_target}/${CFG_SCRAPE_COORDINATOR}/" \
    39    prometheus-template.yml > /tmp/prometheus.yml
    40  
    41  echo "Start loadgen containers"
    42  docker-compose -f docker-compose.yml up