Mercurial > hg > Members > nobuyasu > jungle_benchmark
view distributed/nodes_stress_write_cassandra.rb @ 15:6e7a01afaaf8
Modified prrogram
author | Nobuyasu |
---|---|
date | Thu, 23 Jan 2014 05:52:31 +0900 |
parents | 77a01d4fca04 |
children | 704bcc773b96 |
line wrap: on
line source
#!/usr/bin/ruby require 'net/http' require 'benchmark' require 'uri' require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_node_list.rb' require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_url_list.rb' include GetNodeList include GetUrlList schedule = ARGV[0].to_i time = Time.now.to_i sleepTime = schedule - time sleep(sleepTime) UUID="13814000-1dd2-11b2-af85-0050568b0070" nodeList = get_node_list("/home/mass/share/student/k128576/jungle_benchmark/distributed/nodes.txt") urlList = get_url_list(nodeList, ':8080/editMessage?bname=hello%20world&uuid='+UUID); hostname = `hostname` if /[0-9]+/ =~ hostname then mynum = $&.to_i end urlList = urlList.rotate(mynum) urlSize = urlList.size() count = ARGV[1].to_i r = Benchmark.measure { count.times {|i| res = Net::HTTP.post_form(urlList[i%urlSize], {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"hogehoge #{i}"}) } } puts r.real