Mercurial > hg > Members > nobuyasu > jungle_benchmark
comparison distributed/nodes_stress_write_cassandra.rb @ 8:9ed378589601
Modified benchmark program
author | Nobuyasu |
---|---|
date | Sat, 11 Jan 2014 03:44:39 +0900 |
parents | 867cd5f213d3 |
children | f94fc7812cd8 |
comparison
equal
deleted
inserted
replaced
7:867cd5f213d3 | 8:9ed378589601 |
---|---|
1 #!/usr/bin/ruby | 1 #!/usr/bin/ruby |
2 | 2 |
3 require 'net/http' | 3 require 'net/http' |
4 require 'benchmark' | 4 require 'benchmark' |
5 require './get_node_name.rb' | 5 require 'uri' |
6 require '/home/mass/share/student/k128576/jungle_benchmark/distributed/get_node_name.rb' | |
6 include GetNodeName | 7 include GetNodeName |
7 | 8 |
8 schedule = ARGV[0].to_i | 9 schedule = ARGV[0].to_i |
9 time = Time.now.to_i | 10 time = Time.now.to_i |
10 sleepTime = schedule - time | 11 sleepTime = schedule - time |
11 sleep(sleepTime) | 12 sleep(sleepTime) |
12 | 13 |
13 nodename = get_node_name("nodes.txt") | 14 nodename = get_node_name("/home/mass/share/student/k128576/jungle_benchmark/distributed/nodes.txt") |
14 | 15 r = Benchmark.measure { |
15 tms = Benchmark.measure { | |
16 count = ARGV[1].to_i | 16 count = ARGV[1].to_i |
17 uri = URI.parse('http://'+nodename+':8080/editMessage?bname=hello%20world&uuid=13814000-1dd2-11b2-93d6-02864ec060b6') | 17 uri = URI.parse('http://'+nodename.chomp+':8080/editMessage?bname=hello%20world&uuid=13814000-1dd2-11b2-93d6-02864ec060b6') |
18 count.times {|i| | 18 count.times {|i| |
19 res = Net::HTTP.post_form(uri, {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"fugafuga #{i}"}) | 19 res = Net::HTTP.post_form(uri, {:author =>'oshiro', :bname =>'hello world', :uuid =>'0', :key =>'0', :msg =>"fugafuga #{i}"}) |
20 } | 20 } |
21 } | 21 } |
22 puts tms.real | 22 puts r.real |
23 | 23 |