Browse files

Paulo/TomD: saturation test

  • Loading branch information...
1 parent 91eef7e commit afbebe172236cb0bfadd5757eb36897353d8ec11 @phss phss committed May 18, 2012
View
3 saturation-test/blondin.properties
@@ -0,0 +1,3 @@
+port=8082
+targetPort=8081
+targetHost=localhost
View
BIN saturation-test/jruby-complete-1.6.7.2.jar
Binary file not shown.
View
15 saturation-test/server.rb
@@ -0,0 +1,15 @@
+require "webrick"
+
+class Server < WEBrick::HTTPServlet::AbstractServlet
+
+ def do_GET(request, response)
+ response.body = 'It works'
+ sleep 1
+ end
+
+end
+
+webrickServer = WEBrick::HTTPServer.new(:Port => 8081)
+webrickServer.mount '/', Server
+trap 'INT' do webrickServer.shutdown end
+webrickServer.start
View
12 saturation-test/start.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+java -jar jruby-complete*.jar server.rb &
+server_pid=$!
+
+java -jar ../build/Blondin-main*.jar blondin.properties &
+blondin_pid=$!
+
+java -jar jruby-complete*.jar test.rb
+
+kill $server_pid
+kill $blondin_pid
View
16 saturation-test/test.rb
@@ -0,0 +1,16 @@
+require "net/http"
+
+threads = []
+
+uri = URI('http://localhost:8082')
+
+100.times do |thread_id|
+ threads << Thread.new do
+ 10.times do |request_id|
+ response = Net::HTTP.get(uri)
+ puts "Thread #{thread_id} (#{request_id}): response"
+ end
+ end
+end
+
+threads.each { |thread| thread.join }

0 comments on commit afbebe1

Please sign in to comment.