File: multi_get.sh

package info (click to toggle)
nutcracker 0.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,208 kB
  • ctags: 1,273
  • sloc: ansic: 13,846; sh: 741; makefile: 98; python: 42
file content (26 lines) | stat: -rwxr-xr-x 526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

port=22123
socatopt="-t 20 -T 20 -b 8193 -d -d "
key=""
keys=""
get_command=""

# build
for i in `seq 1 512`; do
    if [ `expr $i % 2` -eq "0" ]; then
        key="foo"
    else
        key="bar"
    fi
    key=`printf "%s%d" "${key}" "${i}"`
    keys=`printf "%s %s" "${keys}" "${key}"`
done

get_command="get ${keys}\r\n"
printf "%b" "$get_command"

# read
for i in `seq 1 16`; do
    printf "%b" "${get_command}" | socat ${socatopt} - TCP:localhost:${port},nodelay,shut-none,nonblock=1 1> /dev/null 2>&1 &
done