rainbows 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/GIT-VERSION-GEN +1 -1
- data/TODO +15 -0
- data/TUNING +14 -0
- data/lib/rainbows.rb +7 -0
- data/lib/rainbows/app_pool.rb +4 -3
- data/lib/rainbows/base.rb +17 -11
- data/lib/rainbows/const.rb +5 -1
- data/lib/rainbows/dev_fd_response.rb +69 -0
- data/lib/rainbows/http_response.rb +1 -0
- data/lib/rainbows/http_server.rb +2 -0
- data/lib/rainbows/rev.rb +136 -43
- data/lib/rainbows/revactor.rb +6 -14
- data/lib/rainbows/thread_pool.rb +11 -13
- data/lib/rainbows/thread_spawn.rb +4 -4
- data/local.mk.sample +9 -1
- data/t/GNUmakefile +4 -4
- data/t/README +1 -1
- data/t/async-response-no-autochunk.ru +24 -0
- data/t/async-response.ru +13 -0
- data/t/bin/content-md5-put +1 -1
- data/t/bin/utee +12 -0
- data/t/env.ru +3 -0
- data/t/large-file-response.ru +13 -0
- data/t/lib-async-response-no-autochunk.sh +6 -0
- data/t/lib-async-response.sh +45 -0
- data/t/lib-graceful.sh +40 -0
- data/t/lib-input-trailer.sh +63 -0
- data/t/lib-large-file-response.sh +45 -0
- data/t/lib-parser-error.sh +29 -0
- data/t/{t3100-revactor-tee-input.sh → lib-rack-input-hammer.sh} +3 -9
- data/t/lib-reopen-logs.sh +60 -0
- data/t/lib-simple-http.sh +92 -0
- data/t/sleep.ru +13 -6
- data/t/t0000-basic.sh +1 -36
- data/t/t1000-thread-pool-basic.sh +1 -41
- data/t/t1002-thread-pool-graceful.sh +1 -36
- data/t/t1003-thread-pool-reopen-logs.sh +2 -0
- data/t/t1004-thread-pool-async-response.sh +45 -0
- data/t/t1005-thread-pool-large-file-response.sh +45 -0
- data/t/t1006-thread-pool-async-response-no-autochunk.sh +6 -0
- data/t/t1100-thread-pool-rack-input.sh +2 -0
- data/t/t1101-thread-pool-input-trailer.sh +2 -0
- data/t/t2000-thread-spawn-basic.sh +1 -37
- data/t/t2002-thread-spawn-graceful.sh +1 -36
- data/t/t2003-thread-spawn-reopen-logs.sh +2 -0
- data/t/t2004-thread-spawn-async-response.sh +45 -0
- data/t/t2005-thread-spawn-large-file-response.sh +45 -0
- data/t/t2006-thread-spawn-async-response-no-autochunk.sh +6 -0
- data/t/t2100-thread-spawn-rack-input.sh +2 -0
- data/t/t2101-thread-spawn-input-trailer.sh +2 -0
- data/t/t3000-revactor-basic.sh +1 -39
- data/t/t3002-revactor-graceful.sh +1 -37
- data/t/t3003-revactor-reopen-logs.sh +1 -53
- data/t/t3004-revactor-async-response.sh +45 -0
- data/t/t3005-revactor-large-file-response.sh +2 -0
- data/t/t3006-revactor-async-response-no-autochunk.sh +6 -0
- data/t/t3100-revactor-rack-input.sh +2 -0
- data/t/t3101-revactor-rack-input-trailer.sh +2 -0
- data/t/t4000-rev-basic.sh +1 -50
- data/t/t4002-rev-graceful.sh +1 -51
- data/t/t4003-rev-parser-error.sh +1 -33
- data/t/t4003-rev-reopen-logs.sh +2 -0
- data/t/t4004-rev-async-response.sh +45 -0
- data/t/t4005-rev-large-file-response.sh +2 -0
- data/t/t4006-rev-async-response-no-autochunk.sh +6 -0
- data/t/t4100-rev-rack-input.sh +1 -43
- data/t/t4101-rev-rack-input-trailer.sh +1 -50
- data/t/t9000-rack-app-pool.sh +2 -3
- data/t/test-lib.sh +80 -18
- metadata +39 -4
- data/t/t3001-revactor-pipeline.sh +0 -46
@@ -0,0 +1,45 @@
|
|
1
|
+
. ./test-lib.sh
|
2
|
+
test -r random_blob || die "random_blob required, run with 'make $0'"
|
3
|
+
if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1
|
4
|
+
then
|
5
|
+
echo >&2 "skipping, can't read RSS from /proc/self/status"
|
6
|
+
exit 0
|
7
|
+
fi
|
8
|
+
echo "large file response slurp avoidance for model=$model"
|
9
|
+
eval $(unused_listen)
|
10
|
+
rtmpfiles unicorn_config tmp r_err r_out pid ok
|
11
|
+
|
12
|
+
cat > $unicorn_config <<EOF
|
13
|
+
listen "$listen"
|
14
|
+
stderr_path "$r_err"
|
15
|
+
stdout_path "$r_out"
|
16
|
+
pid "$pid"
|
17
|
+
Rainbows! { use :$model }
|
18
|
+
EOF
|
19
|
+
|
20
|
+
# can't load Rack::Lint here since it'll cause Rev to slurp
|
21
|
+
rainbows -E none -D large-file-response.ru -c $unicorn_config
|
22
|
+
wait_for_pid $pid
|
23
|
+
|
24
|
+
random_blob_size=$(wc -c < random_blob)
|
25
|
+
curl -v http://$listen/rss
|
26
|
+
dbgcat r_err
|
27
|
+
rss_before=$(curl -sSfv http://$listen/rss)
|
28
|
+
echo "rss_before=$rss_before"
|
29
|
+
|
30
|
+
for i in a b c
|
31
|
+
do
|
32
|
+
size=$( (curl -sSfv http://$listen/random_blob && echo ok > $ok) | wc -c)
|
33
|
+
test $size -eq $random_blob_size
|
34
|
+
test xok = x$(cat $ok)
|
35
|
+
done
|
36
|
+
|
37
|
+
dbgcat r_err
|
38
|
+
curl -v http://$listen/rss
|
39
|
+
rss_after=$(curl -sSfv http://$listen/rss)
|
40
|
+
echo "rss_after=$rss_after"
|
41
|
+
diff=$(( $rss_after - $rss_before ))
|
42
|
+
echo "test diff=$diff < orig=$random_blob_size"
|
43
|
+
kill -QUIT $(cat $pid)
|
44
|
+
test $diff -le $random_blob_size
|
45
|
+
dbgcat r_err
|
@@ -1,38 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
. ./
|
3
|
-
|
4
|
-
eval $(unused_listen)
|
5
|
-
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out
|
6
|
-
|
7
|
-
nr_client=30
|
8
|
-
nr_thread=10
|
9
|
-
|
10
|
-
cat > $unicorn_config <<EOF
|
11
|
-
stderr_path "$r_err"
|
12
|
-
stdout_path "$r_out"
|
13
|
-
listen "$listen"
|
14
|
-
pid "$pid"
|
15
|
-
Rainbows! do
|
16
|
-
use :ThreadSpawn
|
17
|
-
worker_connections $nr_thread
|
18
|
-
end
|
19
|
-
EOF
|
20
|
-
|
21
|
-
rainbows -D t2000.ru -c $unicorn_config
|
22
|
-
wait_for_pid $pid
|
23
|
-
|
24
|
-
start=$(date +%s)
|
25
|
-
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
26
|
-
do
|
27
|
-
( curl -sSf http://$listen/$i >> $curl_out 2>> $curl_err ) &
|
28
|
-
done
|
29
|
-
wait
|
30
|
-
echo elapsed=$(( $(date +%s) - $start ))
|
31
|
-
|
32
|
-
kill $(cat $pid)
|
33
|
-
|
34
|
-
! test -s $curl_err
|
35
|
-
test x"$(wc -l < $curl_out)" = x$nr_client
|
36
|
-
nr=$(sort < $curl_out | uniq | wc -l)
|
37
|
-
test "$nr" -eq $nr_client
|
38
|
-
! grep Error $r_err
|
2
|
+
. ./lib-simple-http.sh
|
@@ -1,37 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
. ./
|
3
|
-
|
4
|
-
eval $(unused_listen)
|
5
|
-
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out
|
6
|
-
nr_thread=10
|
7
|
-
nr_client=10
|
8
|
-
cat > $unicorn_config <<EOF
|
9
|
-
listen "$listen"
|
10
|
-
stderr_path "$r_err"
|
11
|
-
stdout_path "$r_out"
|
12
|
-
pid "$pid"
|
13
|
-
Rainbows! do
|
14
|
-
use :ThreadSpawn
|
15
|
-
worker_connections $nr_thread
|
16
|
-
end
|
17
|
-
EOF
|
18
|
-
|
19
|
-
rainbows -D sleep.ru -c $unicorn_config
|
20
|
-
wait_for_pid $pid
|
21
|
-
|
22
|
-
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
23
|
-
do
|
24
|
-
curl -sSf http://$listen/5 >> $curl_out 2>> $curl_err &
|
25
|
-
done
|
26
|
-
sleep 2
|
27
|
-
kill -QUIT $(cat $pid)
|
28
|
-
wait
|
29
|
-
|
30
|
-
dbgcat r_err
|
31
|
-
! test -s $curl_err
|
32
|
-
test x"$(wc -l < $curl_out)" = x$nr_client
|
33
|
-
nr=$(sort < $curl_out | uniq | wc -l)
|
34
|
-
|
35
|
-
test "$nr" -eq 1
|
36
|
-
test x$(sort < $curl_out | uniq) = xHello
|
37
|
-
! grep Error $r_err
|
2
|
+
. ./lib-graceful.sh
|
@@ -0,0 +1,45 @@
|
|
1
|
+
CONFIG_RU=${CONFIG_RU-'async-response.ru'}
|
2
|
+
. ./test-lib.sh
|
3
|
+
echo "async response for model=$model"
|
4
|
+
eval $(unused_listen)
|
5
|
+
rtmpfiles unicorn_config a b c r_err r_out pid curl_err
|
6
|
+
|
7
|
+
cat > $unicorn_config <<EOF
|
8
|
+
listen "$listen"
|
9
|
+
stderr_path "$r_err"
|
10
|
+
stdout_path "$r_out"
|
11
|
+
pid "$pid"
|
12
|
+
Rainbows! { use :$model }
|
13
|
+
EOF
|
14
|
+
|
15
|
+
# can't load Rack::Lint here since it'll cause Rev to slurp
|
16
|
+
rainbows -E none -D $CONFIG_RU -c $unicorn_config
|
17
|
+
wait_for_pid $pid
|
18
|
+
|
19
|
+
t0=$(date +%s)
|
20
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
|
21
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
|
22
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
|
23
|
+
wait
|
24
|
+
t1=$(date +%s)
|
25
|
+
|
26
|
+
rainbows_pid=$(cat $pid)
|
27
|
+
kill -QUIT $rainbows_pid
|
28
|
+
elapsed=$(( $t1 - $t0 ))
|
29
|
+
echo "elapsed=$elapsed < 30"
|
30
|
+
test $elapsed -lt 30
|
31
|
+
|
32
|
+
dbgcat a
|
33
|
+
dbgcat b
|
34
|
+
dbgcat c
|
35
|
+
dbgcat r_err
|
36
|
+
dbgcat curl_err
|
37
|
+
test ! -s $curl_err
|
38
|
+
check_stderr
|
39
|
+
|
40
|
+
while kill -0 $rainbows_pid >/dev/null 2>&1
|
41
|
+
do
|
42
|
+
sleep 1
|
43
|
+
done
|
44
|
+
|
45
|
+
dbgcat r_err
|
@@ -0,0 +1,45 @@
|
|
1
|
+
. ./test-lib.sh
|
2
|
+
test -r random_blob || die "random_blob required, run with 'make $0'"
|
3
|
+
if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1
|
4
|
+
then
|
5
|
+
echo >&2 "skipping, can't read RSS from /proc/self/status"
|
6
|
+
exit 0
|
7
|
+
fi
|
8
|
+
echo "large file response slurp avoidance for model=$model"
|
9
|
+
eval $(unused_listen)
|
10
|
+
rtmpfiles unicorn_config tmp r_err r_out pid ok
|
11
|
+
|
12
|
+
cat > $unicorn_config <<EOF
|
13
|
+
listen "$listen"
|
14
|
+
stderr_path "$r_err"
|
15
|
+
stdout_path "$r_out"
|
16
|
+
pid "$pid"
|
17
|
+
Rainbows! { use :$model }
|
18
|
+
EOF
|
19
|
+
|
20
|
+
# can't load Rack::Lint here since it'll cause Rev to slurp
|
21
|
+
rainbows -E none -D large-file-response.ru -c $unicorn_config
|
22
|
+
wait_for_pid $pid
|
23
|
+
|
24
|
+
random_blob_size=$(wc -c < random_blob)
|
25
|
+
curl -v http://$listen/rss
|
26
|
+
dbgcat r_err
|
27
|
+
rss_before=$(curl -sSfv http://$listen/rss)
|
28
|
+
echo "rss_before=$rss_before"
|
29
|
+
|
30
|
+
for i in a b c
|
31
|
+
do
|
32
|
+
size=$( (curl -sSfv http://$listen/random_blob && echo ok > $ok) | wc -c)
|
33
|
+
test $size -eq $random_blob_size
|
34
|
+
test xok = x$(cat $ok)
|
35
|
+
done
|
36
|
+
|
37
|
+
dbgcat r_err
|
38
|
+
curl -v http://$listen/rss
|
39
|
+
rss_after=$(curl -sSfv http://$listen/rss)
|
40
|
+
echo "rss_after=$rss_after"
|
41
|
+
diff=$(( $rss_after - $rss_before ))
|
42
|
+
echo "test diff=$diff < orig=$random_blob_size"
|
43
|
+
kill -QUIT $(cat $pid)
|
44
|
+
test $diff -le $random_blob_size
|
45
|
+
dbgcat r_err
|
data/t/t3000-revactor-basic.sh
CHANGED
@@ -1,40 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
. ./
|
3
|
-
require_revactor
|
4
|
-
|
5
|
-
eval $(unused_listen)
|
6
|
-
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out
|
7
|
-
|
8
|
-
nr_client=30
|
9
|
-
nr_actor=10
|
10
|
-
|
11
|
-
cat > $unicorn_config <<EOF
|
12
|
-
listen "$listen"
|
13
|
-
pid "$pid"
|
14
|
-
stderr_path "$r_err"
|
15
|
-
stdout_path "$r_out"
|
16
|
-
Rainbows! do
|
17
|
-
use :Revactor
|
18
|
-
worker_connections $nr_actor
|
19
|
-
end
|
20
|
-
EOF
|
21
|
-
|
22
|
-
rainbows -D t3000.ru -c $unicorn_config
|
23
|
-
wait_for_pid $pid
|
24
|
-
|
25
|
-
start=$(date +%s)
|
26
|
-
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
27
|
-
do
|
28
|
-
( curl -sSf http://$listen/$i >> $curl_out 2>> $curl_err ) &
|
29
|
-
done
|
30
|
-
wait
|
31
|
-
echo elapsed=$(( $(date +%s) - $start ))
|
32
|
-
|
33
|
-
kill $(cat $pid)
|
34
|
-
|
35
|
-
! test -s $curl_err
|
36
|
-
test x"$(wc -l < $curl_out)" = x$nr_client
|
37
|
-
nr=$(sort < $curl_out | uniq | wc -l)
|
38
|
-
|
39
|
-
test "$nr" -eq 1
|
40
|
-
! grep Error $r_err
|
2
|
+
. ./lib-simple-http.sh
|
@@ -1,38 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
. ./
|
3
|
-
require_revactor
|
4
|
-
|
5
|
-
eval $(unused_listen)
|
6
|
-
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out
|
7
|
-
nr_actor=10
|
8
|
-
nr_client=10
|
9
|
-
cat > $unicorn_config <<EOF
|
10
|
-
listen "$listen"
|
11
|
-
stderr_path "$r_err"
|
12
|
-
stdout_path "$r_out"
|
13
|
-
pid "$pid"
|
14
|
-
Rainbows! do
|
15
|
-
use :Revactor
|
16
|
-
worker_connections $nr_actor
|
17
|
-
end
|
18
|
-
EOF
|
19
|
-
|
20
|
-
SLEEP_CLASS=Actor rainbows -D sleep.ru -c $unicorn_config
|
21
|
-
wait_for_pid $pid
|
22
|
-
|
23
|
-
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
24
|
-
do
|
25
|
-
curl -sSf http://$listen/5 >> $curl_out 2>> $curl_err &
|
26
|
-
done
|
27
|
-
sleep 2
|
28
|
-
kill -QUIT $(cat $pid)
|
29
|
-
wait
|
30
|
-
|
31
|
-
dbgcat r_err
|
32
|
-
! test -s $curl_err
|
33
|
-
test x"$(wc -l < $curl_out)" = x$nr_client
|
34
|
-
nr=$(sort < $curl_out | uniq | wc -l)
|
35
|
-
|
36
|
-
test "$nr" -eq 1
|
37
|
-
test x$(sort < $curl_out | uniq) = xHello
|
38
|
-
! grep Error $r_err
|
2
|
+
. ./lib-graceful.sh
|
@@ -1,54 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
. ./
|
3
|
-
require_revactor
|
4
|
-
|
5
|
-
eval $(unused_listen)
|
6
|
-
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out r_rot
|
7
|
-
|
8
|
-
nr_client=30
|
9
|
-
nr_actor=10
|
10
|
-
|
11
|
-
cat > $unicorn_config <<EOF
|
12
|
-
listen "$listen"
|
13
|
-
pid "$pid"
|
14
|
-
stderr_path "$r_err"
|
15
|
-
stdout_path "$r_out"
|
16
|
-
Rainbows! do
|
17
|
-
use :Revactor
|
18
|
-
worker_connections $nr_actor
|
19
|
-
end
|
20
|
-
EOF
|
21
|
-
|
22
|
-
SLEEP_CLASS=Actor rainbows -D sleep.ru -c $unicorn_config
|
23
|
-
wait_for_pid $pid
|
24
|
-
|
25
|
-
start=$(date +%s)
|
26
|
-
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
|
27
|
-
do
|
28
|
-
( curl -sSf http://$listen/2 >> $curl_out 2>> $curl_err ) &
|
29
|
-
done
|
30
|
-
! grep Error $r_err
|
31
|
-
|
32
|
-
rm $r_rot
|
33
|
-
mv $r_err $r_rot
|
34
|
-
|
35
|
-
kill -USR1 $(cat $pid)
|
36
|
-
wait_for_pid $r_err
|
37
|
-
|
38
|
-
dbgcat r_rot
|
39
|
-
dbgcat r_err
|
40
|
-
|
41
|
-
wait
|
42
|
-
echo elapsed=$(( $(date +%s) - $start ))
|
43
|
-
! test -s $curl_err
|
44
|
-
test x"$(wc -l < $curl_out)" = x$nr_client
|
45
|
-
nr=$(sort < $curl_out | uniq | wc -l)
|
46
|
-
|
47
|
-
test "$nr" -eq 1
|
48
|
-
test x$(sort < $curl_out | uniq) = xHello
|
49
|
-
! grep Error $r_err
|
50
|
-
! grep Error $r_rot
|
51
|
-
|
52
|
-
kill $(cat $pid)
|
53
|
-
dbgcat r_err
|
54
|
-
! grep Error $r_err
|
2
|
+
. ./lib-reopen-logs.sh
|
@@ -0,0 +1,45 @@
|
|
1
|
+
CONFIG_RU=${CONFIG_RU-'async-response.ru'}
|
2
|
+
. ./test-lib.sh
|
3
|
+
echo "async response for model=$model"
|
4
|
+
eval $(unused_listen)
|
5
|
+
rtmpfiles unicorn_config a b c r_err r_out pid curl_err
|
6
|
+
|
7
|
+
cat > $unicorn_config <<EOF
|
8
|
+
listen "$listen"
|
9
|
+
stderr_path "$r_err"
|
10
|
+
stdout_path "$r_out"
|
11
|
+
pid "$pid"
|
12
|
+
Rainbows! { use :$model }
|
13
|
+
EOF
|
14
|
+
|
15
|
+
# can't load Rack::Lint here since it'll cause Rev to slurp
|
16
|
+
rainbows -E none -D $CONFIG_RU -c $unicorn_config
|
17
|
+
wait_for_pid $pid
|
18
|
+
|
19
|
+
t0=$(date +%s)
|
20
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) &
|
21
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) &
|
22
|
+
( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) &
|
23
|
+
wait
|
24
|
+
t1=$(date +%s)
|
25
|
+
|
26
|
+
rainbows_pid=$(cat $pid)
|
27
|
+
kill -QUIT $rainbows_pid
|
28
|
+
elapsed=$(( $t1 - $t0 ))
|
29
|
+
echo "elapsed=$elapsed < 30"
|
30
|
+
test $elapsed -lt 30
|
31
|
+
|
32
|
+
dbgcat a
|
33
|
+
dbgcat b
|
34
|
+
dbgcat c
|
35
|
+
dbgcat r_err
|
36
|
+
dbgcat curl_err
|
37
|
+
test ! -s $curl_err
|
38
|
+
check_stderr
|
39
|
+
|
40
|
+
while kill -0 $rainbows_pid >/dev/null 2>&1
|
41
|
+
do
|
42
|
+
sleep 1
|
43
|
+
done
|
44
|
+
|
45
|
+
dbgcat r_err
|