Skip to content

Instantly share code, notes, and snippets.

@eprothro
Last active December 1, 2017 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eprothro/16d2e361f1a33c9cfabf2c61946d3df9 to your computer and use it in GitHub Desktop.
Save eprothro/16d2e361f1a33c9cfabf2c61946d3df9 to your computer and use it in GitHub Desktop.
rails c
while true do
  r = nil
  duration = Benchmark.ms do
    r = Cassie.session.execute("select count(*) from system.hints")
  end
  print "\r[#{Time.now.strftime("%H:%M:%S.%3N")}] #{r.execution_info.hosts.map{|h| h.ip.to_s}.join("->")} (#{duration.round(3).to_s.ljust(5,"0").rjust(8,"0")}ms)"
  puts " (#{r.execution_info.retries} retries)" if r.execution_info.retries > 0
  sleep(0.001)
endd
ccm node3 start && ccm node2 start

Within 5 seconds after completion, there will likely be some retries.

[16:05:59.898] 127.0.0.2->127.0.0.1 (0002.102ms) (1 retries)
[16:05:59.903] 127.0.0.2->127.0.0.1 (0001.480ms) (1 retries)
[16:05:59.910] 127.0.0.2->127.0.0.1 (0002.078ms) (1 retries)
[16:05:59.938] 127.0.0.2->127.0.0.1 (0003.342ms) (1 retries)
[16:05:59.943] 127.0.0.2->127.0.0.1 (0001.553ms) (1 retries)
[16:05:59.950] 127.0.0.2->127.0.0.1 (0001.721ms) (1 retries)
[16:05:59.960] 127.0.0.2->127.0.0.1 (0001.985ms) (1 retries)
[16:05:59.967] 127.0.0.2->127.0.0.1 (0001.605ms) (1 retries)
[16:05:59.973] 127.0.0.2->127.0.0.1 (0001.726ms) (1 retries)
[16:05:59.979] 127.0.0.2->127.0.0.1 (0001.690ms) (1 retries)
[16:05:59.986] 127.0.0.2->127.0.0.1 (0002.266ms) (1 retries)
[16:05:59.992] 127.0.0.2->127.0.0.1 (0001.539ms) (1 retries)
[16:05:59.998] 127.0.0.2->127.0.0.1 (0001.629ms) (1 retries)
[16:06:00.003] 127.0.0.2->127.0.0.1 (0001.609ms) (1 retries)
[16:06:00.010] 127.0.0.2->127.0.0.1 (0001.814ms) (1 retries)
[16:06:00.016] 127.0.0.2->127.0.0.1 (0001.692ms) (1 retries)
[16:06:00.031] 127.0.0.2->127.0.0.1 (0011.224ms) (1 retries)
[16:06:00.039] 127.0.0.2->127.0.0.1 (0001.637ms) (1 retries)
[16:06:01.669] 127.0.0.3->127.0.0.1 (0001.965ms) (1 retries)
[16:06:01.718] 127.0.0.3->127.0.0.1 (0015.347ms) (1 retries)
[16:06:01.737] 127.0.0.3->127.0.0.1 (0004.878ms) (1 retries)
[16:06:01.755] 127.0.0.3->127.0.0.1 (0002.675ms) (1 retries)
[16:06:01.773] 127.0.0.3->127.0.0.1 (0004.871ms) (1 retries)
[16:06:01.796] 127.0.0.3->127.0.0.1 (0002.078ms) (1 retries)
ccm node3 stop & ccm node2 stop

Depending on the timing there may or may not be a retry or two.

[16:06:13.254] 127.0.0.2->127.0.0.1 (0007.273ms) (1 retries)
@eprothro
Copy link
Author

eprothro commented Dec 1, 2017

while true do
  r = nil
  duration = Benchmark.ms do
    r = Cassie.session.execute("select * from foo.bars where id = 1")
  end
  print "\r[#{Time.now.strftime("%H:%M:%S.%3N")}] #{r.execution_info.hosts.map{|h| h.ip.to_s}.join("->")} (#{duration.round(3).to_s.ljust(5,"0").rjust(8,"0")}ms)"
  puts " (#{r.execution_info.retries} retries)" if r.execution_info.retries > 0
  sleep(0.001)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment