Mercurial > hg > Members > nobuyasu > jungle_benchmark
annotate distributed/nodes_stress_write_cassandra.rb @ 26:cfae346a232e default tip
Fix millsec to sec calc_sd.rb
author | Nobuyasu |
---|---|
date | Fri, 31 Jan 2014 04:58:34 +0900 (2014-01-30) |
parents | 704bcc773b96 |
children |
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' |
8 | 5 require 'uri' |
12 | 6 require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_node_list.rb' |
7 require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_url_list.rb' | |
8 include GetNodeList | |
9 include GetUrlList | |
7
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 schedule = ARGV[0].to_i |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 time = Time.now.to_i |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 sleepTime = schedule - time |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 sleep(sleepTime) |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 |
16 | 16 UUID="13814000-1dd2-11b2-99d5-0050568b0070" |
12 | 17 |
18 nodeList = get_node_list("/home/mass/share/student/k128576/jungle_benchmark/distributed/nodes.txt") | |
19 urlList = get_url_list(nodeList, ':8080/editMessage?bname=hello%20world&uuid='+UUID); | |
20 hostname = `hostname` | |
21 if /[0-9]+/ =~ hostname then | |
22 mynum = $&.to_i | |
23 end | |
24 urlList = urlList.rotate(mynum) | |
25 urlSize = urlList.size() | |
26 | |
27 count = ARGV[1].to_i | |
8 | 28 r = Benchmark.measure { |
7
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 count.times {|i| |
12 | 30 res = Net::HTTP.post_form(urlList[i%urlSize], {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"hogehoge #{i}"}) |
7
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 } |
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 } |
8 | 33 puts r.real |
7
867cd5f213d3
Added distributed directory
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 |