annotate distributed/nodes_stress_write_cassandra.rb @ 7:867cd5f213d3

Added distributed directory
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Sat, 11 Jan 2014 03:24:53 +0900
parents
children 9ed378589601
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #!/usr/bin/ruby
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 require 'net/http'
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 require 'benchmark'
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 require './get_node_name.rb'
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 include GetNodeName
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 schedule = ARGV[0].to_i
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 time = Time.now.to_i
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 sleepTime = schedule - time
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 sleep(sleepTime)
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 nodename = get_node_name("nodes.txt")
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 tms = Benchmark.measure {
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 count = ARGV[1].to_i
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 uri = URI.parse('http://'+nodename+':8080/editMessage?bname=hello%20world&uuid=13814000-1dd2-11b2-93d6-02864ec060b6')
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 count.times {|i|
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 res = Net::HTTP.post_form(uri, {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"fugafuga #{i}"})
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 }
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 }
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 puts tms.real
867cd5f213d3 Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23