Mercurial > hg > Members > nobuyasu > jungle_benchmark
view distributed/nodes_stress_write_jungle.rb @ 11:223af50e60d5
Added some files
author | Nobuyasu |
---|---|
date | Mon, 20 Jan 2014 02:59:12 +0900 |
parents | f94fc7812cd8 |
children | c69a41ffc439 |
line wrap: on
line source
#!/usr/bin/ruby require 'net/http' require 'uri' require 'benchmark' require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_node_list.rb' include GetNodeList schedule = ARGV[0].to_i time = Time.now.to_i sleepTime = schedule - time sleep(sleepTime) nodelist = get_node_list("/home/mass/share/student/k128576/jungle_benchmark/distributed/nodes.txt") r = Benchmark.measure { count = ARGV[1].to_i nodeSize = nodelist.size count.times {|i| nodename = nodelist[i%nodeSize] uri = URI.parse('http://' << nodename << ':8080/editMessage?bname=hello%20world&uuid=0') res = Net::HTTP.post_form(uri, {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"hogehoge #{i}"}) } } puts r.real