Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
79fa67cd
Commit
79fa67cd
authored
Jan 30, 2015
by
antirez
Browse files
Cluster: Tcl script to check avg pfail->fail time.
parent
233729fe
Changes
1
Show whitespace changes
Inline
Side-by-side
utils/cluster_fail_time.tcl
0 → 100644
View file @
79fa67cd
# This simple script is used in order to estimate the average PFAIL->FAIL
# state switch after a failure.
set ::sleep_time 10
;
# How much to sleep to trigger PFAIL.
set ::fail_port 30016
;
# Node to put in sleep.
set ::other_port 30001
;
# Node to use to monitor the flag switch.
proc avg vector
{
set sum 0.0
foreach x $vector
{
set sum
[
expr
{
$sum
+$x
}]
}
expr
{
$sum
/
[
llength $vector
]}
}
set samples
{}
while 1
{
exec redis-cli -p $::fail_port debug sleep $::sleep_time > /dev/null &
# Wait for fail? to appear.
while 1
{
set output
[
exec redis-cli -p $::other_port cluster nodes
]
if
{[
string match
{
*fail
\?
*
}
$output
]}
break
after 100
}
puts
"FAIL?"
set start
[
clock milliseconds
]
# Wait for fail? to disappear.
while 1
{
set output
[
exec redis-cli -p $::other_port cluster nodes
]
if
{
!
[
string match
{
*fail
\?
*
}
$output
]}
break
after 100
}
puts
"FAIL"
set now
[
clock milliseconds
]
set elapsed
[
expr
{
$now-$start
}]
puts $elapsed
lappend samples $elapsed
puts
"AVG(
[
llength $samples
]
):
[
avg $samples
]
"
# Wait for the instance to be available again.
exec redis-cli -p $::fail_port ping
# Wait for the fail flag to be cleared.
after 2000
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment