Changeset 271
- Timestamp:
- 11/17/07 18:45:58 (1 year ago)
- Files:
-
- trunk/demo/app/models/stats.rb (added)
- trunk/demo/db/migrate/006_create_stats.rb (added)
- trunk/demo/test/fixtures/stats.yml (added)
- trunk/demo/test/smoke/drb_smoke_test.rb (modified) (4 diffs)
- trunk/demo/test/unit/stats_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demo/test/smoke/drb_smoke_test.rb
r270 r271 8 8 # AAF_REMOTE=true script/runner -e test test/smoke/drb_smoke_test.rb 9 9 10 RECORDS_PER_PROCESS = 100000 11 NUM_PROCESSES = 10 12 NUM_RECORDS_PER_LOGENTRY = 100 10 13 11 14 class DrbSmokeTest … … 13 16 @id = id 14 17 end 18 def self.count_connections 19 res = Content.connection.execute("show status where variable_name = 'Threads_connected'") 20 if res 21 res.fetch_row.last 22 else 23 "error getting connection count" 24 end 25 end 15 26 def run 16 500.times do |i| 17 Content.create! :title => "title #{i}", :description => "description #{i}" 18 if i % 100 == 0 19 puts "#{@id}: #{i} records indexed" 27 @t1 = Time.now 28 RECORDS_PER_PROCESS.times do |i| 29 Content.create! :title => "process #{@id}", :description => "record #{i}\n#{'Lorem ipsum. ' * 100 }" 30 if i % NUM_RECORDS_PER_LOGENTRY == 0 31 time = Time.now - @t1 32 puts "#{@id}: #{i} records indexed, last 100 in #{time}" 33 Stats.create! :process_id => @id, :records => NUM_RECORDS_PER_LOGENTRY, :processing_time => time, :open_connections => self.class.count_connections 34 @t1 = Time.now 20 35 end 21 36 end … … 23 38 end 24 39 25 def count_connections26 Content.connection.execute("show status where variable_name = 'Threads_connected'").fetch_row.last27 end28 40 29 10.times do |i| 41 #Content.delete_all 42 43 @start = Time.now 44 45 NUM_PROCESSES.times do |i| 30 46 unless fork 31 47 @id = i … … 38 54 else 39 55 while true 40 puts "open connections: #{ count_connections}"41 sleep 556 puts "open connections: #{DrbSmokeTest::count_connections}; time elapsed: #{Time.now - @start} seconds" 57 sleep 10 42 58 end 43 59 end 60
