RoadRunner 3.3.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. data/Rakefile +8 -13
  2. data/bin/controller.rb +74 -0
  3. data/bin/host_mgr.rb +69 -0
  4. data/bin/nbd_prepare.sh +87 -0
  5. data/conf/servers.yaml +29 -0
  6. data/controller/dd.sh +91 -0
  7. data/controller/mysql.rb +73 -0
  8. data/controller/mysql.sh +9 -0
  9. data/controller/svn.sh +48 -0
  10. data/controller/wrap.rb +49 -0
  11. data/lib/roadrunner.rb +11 -9
  12. data/lib/rrmonitor.rb +174 -0
  13. data/lib/run.rb +66 -27
  14. data/log/dd.log +129 -0
  15. data/log/log.rb +17 -0
  16. data/log/monitor/Pi-Monitor-Performance/10.250.3.26/Pi-Monitor-Performance/ifstat.log +239 -0
  17. data/log/monitor/Pi-Monitor-Performance/10.250.3.26/Pi-Monitor-Performance/iostat_3.log +668 -0
  18. data/log/monitor/Pi-Monitor-Performance/10.250.3.26/Pi-Monitor-Performance/vmstat_3.log +81 -0
  19. data/log/monitor/Pi-Monitor-Performance/10.250.3.26/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +2248 -0
  20. data/log/monitor/Pi-Monitor-Performance/10.250.3.26/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +719 -0
  21. data/log/monitor/Pi-Monitor-Performance/10.250.3.27/Pi-Monitor-Performance/ifstat.log +245 -0
  22. data/log/monitor/Pi-Monitor-Performance/10.250.3.27/Pi-Monitor-Performance/iostat_3.log +677 -0
  23. data/log/monitor/Pi-Monitor-Performance/10.250.3.27/Pi-Monitor-Performance/vmstat_3.log +83 -0
  24. data/log/monitor/Pi-Monitor-Performance/10.250.3.27/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +2276 -0
  25. data/log/monitor/Pi-Monitor-Performance/10.250.3.27/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +737 -0
  26. data/log/monitor/Pi-Monitor-Performance/10.250.3.28/Pi-Monitor-Performance/ifstat.log +246 -0
  27. data/log/monitor/Pi-Monitor-Performance/10.250.3.28/Pi-Monitor-Performance/iostat_3.log +677 -0
  28. data/log/monitor/Pi-Monitor-Performance/10.250.3.28/Pi-Monitor-Performance/vmstat_3.log +83 -0
  29. data/log/monitor/Pi-Monitor-Performance/10.250.3.28/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +2195 -0
  30. data/log/monitor/Pi-Monitor-Performance/10.250.3.28/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +737 -0
  31. data/log/monitor/Pi-Monitor-Performance/10.250.3.29/Pi-Monitor-Performance/ifstat.log +247 -0
  32. data/log/monitor/Pi-Monitor-Performance/10.250.3.29/Pi-Monitor-Performance/iostat_3.log +686 -0
  33. data/log/monitor/Pi-Monitor-Performance/10.250.3.29/Pi-Monitor-Performance/vmstat_3.log +84 -0
  34. data/log/monitor/Pi-Monitor-Performance/10.250.3.29/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +2386 -0
  35. data/log/monitor/Pi-Monitor-Performance/10.250.3.29/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +828 -0
  36. data/log/monitor/Pi-Monitor-Performance/10.250.3.30/Pi-Monitor-Performance/ifstat.log +249 -0
  37. data/log/monitor/Pi-Monitor-Performance/10.250.3.30/Pi-Monitor-Performance/iostat_3.log +686 -0
  38. data/log/monitor/Pi-Monitor-Performance/10.250.3.30/Pi-Monitor-Performance/vmstat_3.log +84 -0
  39. data/log/monitor/Pi-Monitor-Performance/10.250.3.30/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +2304 -0
  40. data/log/monitor/Pi-Monitor-Performance/10.250.3.30/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +664 -0
  41. data/log/monitor/Pi-Monitor-Performance/10.250.6.30/Pi-Monitor-Performance/ifstat.log +240 -0
  42. data/log/monitor/Pi-Monitor-Performance/10.250.6.30/Pi-Monitor-Performance/iostat_3.log +1334 -0
  43. data/log/monitor/Pi-Monitor-Performance/10.250.6.30/Pi-Monitor-Performance/vmstat_3.log +82 -0
  44. data/log/monitor/Pi-Monitor-Performance/10.250.6.30/Pi-Monitor-Performance/while__1_0___do_sar_-u_-d_3_10__done.log +9048 -0
  45. data/log/monitor/Pi-Monitor-Performance/10.250.6.30/Pi-Monitor-Performance/while__1_0___do_sar_-u_-n_DEV_3_10__done.log +968 -0
  46. data/log/stdout.log +0 -0
  47. data/log/stdout.log.20100307 +349 -0
  48. data/log/svn.log +502 -0
  49. data/test/download_processes.rb +38 -0
  50. data/test/pi_monitor.rb +45 -0
  51. metadata +54 -17
  52. data/lib/roadrunner_stdout.log +0 -168
  53. data/lib/roadrunner_stdout.log.20090519 +0 -262
  54. data/lib/roadrunner_stdout.log.20090521 +0 -47
  55. data/lib/roadrunner_stdout.log.20090524 +0 -290
  56. data/test/roadrunner_stdout.log +0 -170
  57. data/test/roadrunner_stdout.log.20090429 +0 -394
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # To change this template, choose Tools | Templates
3
3
  # and open the template in the editor.
4
-
4
+
5
5
 
6
6
  require 'rubygems'
7
7
  require 'rake'
@@ -12,15 +12,15 @@ require 'rake/testtask'
12
12
 
13
13
  spec = Gem::Specification.new do |s|
14
14
  s.name = 'RoadRunner'
15
- s.version = '3.3.1'
16
- s.has_rdoc = false
15
+ s.version = '4.0.0'
16
+ s.has_rdoc = true
17
17
  s.extra_rdoc_files = ['README', 'LICENSE']
18
- s.summary = 'RoadRunner是LoadRunner的Ruby简易实现'
18
+ s.summary = 'RoadRunner'
19
19
  s.description = s.summary
20
- s.author = 'CharlesCui'
20
+ s.author = 'Charles Cui'
21
21
  s.email = 'zheng.cuizh@gmail.com'
22
- # s.executables = ['your_executable_here']
23
- s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec,test}/**/*")
22
+ s.executables = ['controller.rb']
23
+ s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,conf,controller,log,test}/**/*")
24
24
  s.require_path = "lib"
25
25
  s.bindir = "bin"
26
26
  end
@@ -35,12 +35,7 @@ Rake::RDocTask.new do |rdoc|
35
35
  files =['README', 'LICENSE', 'lib/**/*.rb']
36
36
  rdoc.rdoc_files.add(files)
37
37
  rdoc.main = "README" # page to start on
38
- rdoc.title = "RoadRunner Docs"
38
+ rdoc.title = "dsmp Docs"
39
39
  rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
40
40
  rdoc.options << '--line-numbers'
41
41
  end
42
-
43
- Rake::TestTask.new do |t|
44
- t.test_files = FileList['test/**/*.rb']
45
- end
46
-
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "logger"
5
+ require "yaml"
6
+ require File.join(File.dirname(__FILE__),'..','lib',"monitor")
7
+
8
+ USEAGE="Use age: controller.rb -t dd|mysql|svn|test [-f ./servers.yaml]"
9
+ (p USEAGE;return 1) if ARGV.size < 2
10
+
11
+ #-----------------------------Argv prepare.--------------------------------#
12
+
13
+ def args(key)
14
+ ARGV.each_with_index do |arg, i|
15
+ return ARGV[i+1] if "-#{key}" == arg
16
+ end
17
+ nil
18
+ end
19
+
20
+ unless args('t')
21
+ p USEAGE
22
+ p "parameter -t must be specified."
23
+ exit 1
24
+ end
25
+
26
+ #-----------------------------Log file initialize.--------------------------------#
27
+
28
+ log_file=File.join(File.dirname(__FILE__),'..','log','stdout.log')
29
+ FileUtils.rm log_file,:force=>true
30
+
31
+ File.open(log_file,"w"){|f|
32
+ f.puts "*"*60+$/
33
+ f.puts "DSMP (Distribute Store Manage Performance)".center(60,"*")+$/
34
+ f.puts "*"*60+$/+$/+$/
35
+ }
36
+
37
+ $log = Logger.new(log_file)
38
+ $log.level=Logger::INFO
39
+
40
+ $log.info "Controller Log Start".center(60,'*')+$/
41
+ $log.debug "ARGV:#{ARGV.inspect}"
42
+
43
+ #-----------------------------Servers Config initialize.--------------------------------#
44
+
45
+ conf_file=args('f')||File.join(File.dirname(__FILE__),'..','conf','server.yaml')
46
+
47
+ File.open( conf_file ) { |yf|
48
+ begin
49
+ $czservers=YAML::load( yf )
50
+ rescue Exception => e
51
+ $log.error("YAML Load Error!Plz check your yaml file => #{conf_file}.#{$/}#{e.to_s}")
52
+ exit 1
53
+ end
54
+ }
55
+
56
+ #-----------------------------exec your job and monitor work--------------------------------#
57
+
58
+ require File.join(File.dirname(__FILE__),'..','controller',"wrap")
59
+ include RoadRunnerModule
60
+
61
+ case args('t')
62
+ when /dd/ then
63
+ RRMonitor.monit($czservers,$log,"DD-Performance"){Work.work(3,$log,File.join(File.dirname(__FILE__),'..','controller','dd.sh'))}
64
+ when /mysql/ then
65
+ RRMonitor.monit($czservers,$log,"MySQL-Performance"){Work.work(3,$log,File.join(File.dirname(__FILE__),'..','controller','mysql.sh'))}
66
+ when /svn/ then
67
+ RRMonitor.monit($czservers,$log,"SVN-Performance"){Work.work(1,$log,File.join(File.dirname(__FILE__),'..','controller','svn.sh'))}
68
+ when /test/ then
69
+ RRMonitor.monit([],$log,"Test-Performance"){$log.info "Test Performance Start.....";sleep 60*2;$log.info "Test END."}
70
+ else
71
+ p USEAGE
72
+ exit 1
73
+ end
74
+
@@ -0,0 +1,69 @@
1
+ #!/bin/env ruby
2
+
3
+ (p "Use age : host_mgr.rb -c restart|shutdown|test [-f ./servers.yaml|-h]";exit 1) if ARGV.include("-h")
4
+
5
+ require "rubygems"
6
+ require "net/ssh"
7
+
8
+ class HostMgr
9
+ def initialize(opt={:server=>"0.0.0.0", :username=>"admin", :password=>"123456"})
10
+ begin
11
+ @sess=Net::SSH.start(opt[:server], opt[:username], :password => opt[:password],:timeout => 120)
12
+ rescue Exception => e
13
+ p e
14
+ p opt.inspect
15
+ raise e
16
+ end
17
+ end
18
+
19
+ def exec!(cmd)
20
+ p @sess.exec!(cmd)
21
+ p "#{cmd} --exec over."
22
+ end
23
+
24
+ def exit
25
+ @sess.exit
26
+ end
27
+ end
28
+
29
+ #-----------------------------Argv prepare.--------------------------------#
30
+
31
+ def args(key)
32
+ ARGV.each_with_index do |arg, i|
33
+ return ARGV[i+1] if "-#{key}" == arg
34
+ end
35
+ nil
36
+ end
37
+
38
+
39
+ #-----------------------------Servers Config initialize.--------------------------------#
40
+
41
+ conf_file=args('f')||File.join(File.dirname(__FILE__),'..','conf','server.yaml')
42
+
43
+ File.open( conf_file ) { |yf|
44
+ begin
45
+ $czservers=YAML::load( yf )
46
+ rescue Exception => e
47
+ $log.error("YAML Load Error!Plz check your yaml file => #{conf_file}.#{$/}#{e.to_s}")
48
+ exit 1
49
+ end
50
+ }
51
+
52
+ HOSTS=[]
53
+ $czservers.each do |h,obj|
54
+ #HOSTS<<HostMgr.new({:server=>h,:username=>"admin",:password=>"123456"})
55
+ HOSTS<<HostMgr.new({:server=>h,:username=>obj[:username],:password=>obj[:password]})
56
+ end
57
+
58
+ #p HOSTS.inspect
59
+
60
+ case args('c')
61
+ when /restart/,/reboot/,/re/
62
+ HOSTS.each{|h|h.exec!("init 6")}
63
+ when /shutdown/,/halt/,/sd/
64
+ HOSTS.each{|h|h.exec!("init 0")}
65
+ when /test/,/t/
66
+ HOSTS.each{|h|h.exec!("env")}
67
+ else
68
+ p "useage: host_mgr.rb cmd"
69
+ end
@@ -0,0 +1,87 @@
1
+ #!/bin/sh
2
+ #KV.....10.250.3.25-30..6......25.master.....kv-server.
3
+
4
+ #.......10.250.6.30
5
+ #root/goodluck@2010
6
+
7
+ #nbd....
8
+ #/home/admin/nbd
9
+
10
+ #...........
11
+ #/home/cuizheng
12
+ #/home/cuizheng/mysql
13
+ #/home/cuizheng/file1
14
+ #/home/cuizheng/file2
15
+
16
+
17
+ #......
18
+ cd /home/cuizheng
19
+ LOG=/home/cuizheng/log/nbd-server.log
20
+ if [ -e $LOG ]; then
21
+ rm -f $LOG
22
+ fi
23
+
24
+ touch $LOG
25
+
26
+ #........nbd
27
+ umount ./file1
28
+ umount ./file2
29
+ umonut ./mysql
30
+
31
+ #..nbd-server..
32
+ ps axf|grep nbd-server|grep -v grep|awk '{printf "%s\n",$1}'|xargs kill -9
33
+
34
+ cd /home/admin/nbd/client/
35
+ #..nbd-client..
36
+ ./nbd-client -d /dev/nbd0
37
+ ./nbd-client -d /dev/nbd1
38
+ ./nbd-client -d /dev/nbd2
39
+
40
+ ps axf|grep nbd-client|grep -v grep|awk '{printf "%s\n",$1}'|xargs kill -9
41
+
42
+ cd /home/admin/nbd/server/
43
+ #.....
44
+ modprobe nbd
45
+ nohup ./nbd-server nuwa://10.250.3.25:10240/sys/kvengine/KVMaster >>$LOG 2>&1 &
46
+
47
+ cd /home/admin/nbd/client/
48
+ #.....
49
+ #sector_size=1024
50
+ #disk_size=50G
51
+ #device_id=second since 1970
52
+ #device=/dev/nbd0-nbd2
53
+
54
+ D=`date +"%Y-%m-%d %H:%M:%S"`
55
+
56
+ Device_id=`date +"%s"`
57
+ echo nbd0 device_id => $Device_id
58
+ ./nbd-client 1024 2G $Device_id /dev/nbd0
59
+ echo MySQL deveice id: >> $LOG
60
+ echo $Device_id >> $LOG
61
+
62
+ sleep 5
63
+
64
+ Device_id=`date +"%s"`
65
+ echo nbd1 device_id => $Device_id
66
+ ./nbd-client 1024 2G `date +"%s"` /dev/nbd1
67
+ echo File1 deveice id: >> $LOG
68
+ echo $Device_id >> $LOG
69
+
70
+ sleep 5
71
+
72
+ Device_id=`date +"%s"`
73
+ echo nbd2 device_id => $Device_id
74
+ ./nbd-client 1024 2G `date +"%s"` /dev/nbd2
75
+ echo File2 deveice id: >> $LOG
76
+ echo $Device_id >> $LOG
77
+
78
+ #...
79
+ mkfs /dev/nbd0
80
+ mkfs /dev/nbd1
81
+ mkfs /dev/nbd2
82
+
83
+ #....NBD......:
84
+ mount /dev/nbd0 /home/cuizheng/mysql
85
+ mount /dev/nbd1 /home/cuizheng/file1
86
+ mount /dev/nbd2 /home/cuizheng/file2
87
+
@@ -0,0 +1,29 @@
1
+ ---
2
+ 10.250.3.25:
3
+ :username: admin
4
+ :ts: Test-Performance
5
+ :password: "123456"
6
+ 10.250.3.26:
7
+ :username: admin
8
+ :ts: Test-Performance
9
+ :password: "123456"
10
+ 10.250.6.30:
11
+ :username: admin
12
+ :ts: Test-Performance
13
+ :password: "123456"
14
+ 10.250.3.27:
15
+ :username: admin
16
+ :ts: Test-Performance
17
+ :password: "123456"
18
+ 10.250.3.28:
19
+ :username: admin
20
+ :ts: Test-Performance
21
+ :password: "123456"
22
+ 10.250.3.29:
23
+ :username: admin
24
+ :ts: Test-Performance
25
+ :password: "123456"
26
+ 10.250.3.30:
27
+ :username: admin
28
+ :ts: Test-Performance
29
+ :password: "123456"
@@ -0,0 +1,91 @@
1
+ #!/bin/sh
2
+ #file-name=nbd_perf_dd.sh
3
+
4
+ cd /home/cuizheng
5
+ #LOG=/home/cuizheng/log/nbd_perf_dd_`date +"%Y-%m-%d=%H:%M:%S"`.log
6
+ LOG=/home/cuizheng/log/dd.log
7
+
8
+ echo "***********DD-Performance***********" >> $LOG
9
+
10
+ if [ -e $log ];then
11
+ rm -f $LOG
12
+ fi
13
+ touch $LOG
14
+ _START=`date +"%s"`
15
+
16
+ i=1
17
+
18
+ while [ $i -le 3 ];
19
+ do
20
+ SUB=`uuidgen`
21
+
22
+ cd /home/cuizheng/file1
23
+ mkdir dd_tmp_$SUB
24
+ cd dd_tmp_$SUB
25
+
26
+ #echo "dd 5mb start" >> $LOG
27
+ #UUID=`uuidgen`
28
+ #START=`date +"%s"`
29
+ #dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=10
30
+ #sync
31
+ #END=`date +"%s"`
32
+ #echo "
33
+ #dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=10
34
+ #sync
35
+ #START:$START,END:$END,SPEND:$((END-START))
36
+ #
37
+ #" >> $LOG
38
+
39
+
40
+ echo "dd 50mb start" >> $LOG
41
+ UUID=`uuidgen`
42
+ START=`date +"%s"`
43
+ dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=102
44
+ sync
45
+ END=`date +"%s"`
46
+ echo "
47
+ dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=102
48
+ sync
49
+ START:$START,END:$END,SPEND:$((END-START))
50
+
51
+ " >> $LOG
52
+
53
+ #echo "dd 500mb start" >> $LOG
54
+ #UUID=`uuidgen`
55
+ #START=`date +"%s"`
56
+ #dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=1024
57
+ #sync
58
+ #END=`date +"%s"`
59
+ #echo "
60
+ #dd if=/dev/zero of=./nbd_perf_test_file_$UUID.dat bs=512k count=102
61
+ #sync
62
+ #START:$START,END:$END,SPEND:$((END-START))
63
+ #
64
+ #" >> $LOG
65
+
66
+
67
+ echo "rm dd document start" >> $LOG
68
+ cd ..
69
+ START=`date +"%s"`
70
+ rm -rf dd_tmp_$SUB
71
+ sync
72
+ END=`date +"%s"`
73
+ echo "
74
+ rm -rf dd_tmp_$SUB
75
+ sync
76
+ START:$START,END:$END,SPEND:$((END-START))
77
+
78
+ " >> $LOG
79
+
80
+ i=$(($i + 1))
81
+ done
82
+
83
+ _END=`date +"%s"`
84
+
85
+ echo DD-Performance Total START:$_START,END:$_END,SPEND:$((_END-_START)) >> $LOG
86
+
87
+ exit 1
88
+
89
+ #...10..........
90
+ #nohup sh nbd_perf_dd.sh 1>/home/cuizheng/nbd_perf_dd.log 2>&1
91
+
@@ -0,0 +1,73 @@
1
+ #!/ur/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'activerecord'
5
+ require 'benchmark'
6
+ require 'logger'
7
+ require 'pp'
8
+
9
+ log_file=File.join(File.dirname(__FILE__),'log','mysql.log')
10
+ FileUtils.rm log_file,:force=>true
11
+
12
+ File.open(log_file,"w"){|f|
13
+ f.puts "*"*60+$/
14
+ f.puts "MySQL Store Performance Test".center(60,"*")+$/
15
+ f.puts "*"*60+$/+$/+$/
16
+ }
17
+
18
+ #$log = Logger.new(File.join(File.dirname(__FILE__),'log','stdout.log'))
19
+ $log = Logger.new(log_file)
20
+ $log.level=Logger::ERROR
21
+
22
+ begin
23
+ ActiveRecord::Base.establish_connection(
24
+ :adapter =>"mysql",
25
+ :username => "houyi",
26
+ :password =>"111111",
27
+ :database => "SNS",
28
+ :host =>"10.250.6.30"
29
+ )
30
+ $log.info "MySQL Connect Success."
31
+ rescue => e
32
+ $log.error "MySQL Connect Failed!"
33
+ $log.error e.to_s
34
+ end
35
+
36
+ # N => count of iterations.
37
+ N=10000
38
+
39
+ class QaPost < ActiveRecord::Base
40
+ set_table_name "qa_posts"
41
+ set_primary_key "ID"
42
+ end
43
+
44
+ def insert_records(x=N)
45
+ qp=QaPost.new
46
+ QaPost.columns.each do |c|
47
+ qp.send(c.to_s+"=",rand(x)) unless c=="ID"||c=='id'
48
+ end
49
+ ts=Benchmark.measure{qp.save!}
50
+ `sync`
51
+ $log.debug qp.inspect
52
+ $log.info "One Record insert. ts=>#{ts.inspect}"
53
+ end
54
+
55
+ def select_record(id=1)
56
+ qp=nil
57
+ ts=Benchmark.measure{qp=QaPost.find_by_id(1)}
58
+ $log.debug qp.inspect
59
+ $log.info "One Record Select. ts=>#{ts.inspect}"
60
+ end
61
+
62
+
63
+ $log.info "#{N} iterations start.".center(60,'*')
64
+
65
+ ts = Benchmark.measure{
66
+ N.times do |x|
67
+ insert_records(x)
68
+ select_record
69
+ end
70
+ }
71
+
72
+ $log.info "#{N} iterations end.".center(60,'*')
73
+ $log.info "#{N} iterations cost ts=>#{ts.inspect}".center(60,'*')