<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,7 @@
+== 0.6.1 Cheesecake release
+ * Remove socket file when server stops.
+ * Set back cluster to use 'thin' command to launch servers.
+
 == 0.6.0 Big Pony release
  * Add support for connection through UNIX domain socket.
    Use the --socket (-S) option w/ the thin script to configure the socket filename.</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -9,5 +9,6 @@ require File.dirname(__FILE__) + '/../lib/thin'
 require File.dirname(__FILE__) + '/utils'
 
 request = (ARGV[0] || 1000).to_i # Number of request to send (ab -n option)
+output_type = (ARGV[1] || 'print')
 
-benchmark %w(WEBrick Mongrel EMongrel Thin), request
+benchmark output_type, %w(WEBrick Mongrel EMongrel Thin), request, [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]</diff>
      <filename>benchmark/simple.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 require 'rack/lobster'
 
 def run(handler_name, n=1000, c=1)
+  port = 7000
+  
   server = fork do
     [STDOUT, STDERR].each { |o| o.reopen &quot;/dev/null&quot; }
       
@@ -22,27 +24,49 @@ def run(handler_name, n=1000, c=1)
     app = Rack::Lobster.new
     
     handler = Rack::Handler.const_get(handler_name)
-    handler.run app, :Host =&gt; '0.0.0.0', :Port =&gt; 7000
+    handler.run app, :Host =&gt; '0.0.0.0', :Port =&gt; port
   end
 
   sleep 2
 
-  out = `nice -n20 ab -c #{c} -n #{n} http://127.0.0.1:7000/ 2&gt; /dev/null`
+  out = `nice -n20 ab -c #{c} -n #{n} http://127.0.0.1:port/ 2&gt; /dev/null`
 
   Process.kill('SIGKILL', server)
   Process.wait
   
   if requests = out.match(/^Requests.+?(\d+\.\d+)/)
-    failed = out.match(/^Failed requests.+?(\d+)$/)[1]
-    &quot;#{requests[1].to_s.ljust(9)} #{failed}&quot;
+    requests[1].to_i
   else
-    'ERROR'
+    0
   end
 end
 
-def benchmark(servers, request, concurrency_levels=[1, 10, 100])
-  puts 'server     request   concurrency   req/s     failures'
-  puts '=' * 53
+def benchmark(type, servers, request, concurrency_levels)
+  send &quot;#{type}_benchmark&quot;, servers, request, concurrency_levels
+end
+
+def graph_benchmark(servers, request, concurrency_levels)
+  require '/usr/local/lib/ruby/gems/1.8/gems/gruff-0.2.9/lib/gruff'
+  g = Gruff::Area.new
+  g.title = &quot;Server benchmark&quot;
+  
+  servers.each do |server|
+    g.data(server, concurrency_levels.collect { |c| print '.'; run(server, request, c) })
+  end
+  puts
+  
+  g.x_axis_label = 'Concurrency'
+  g.y_axis_label = 'Requests / sec'
+  g.labels = {}
+  concurrency_levels.each_with_index { |c, i| g.labels[i] = c.to_s }
+  
+  g.write('bench.png')
+  `open bench.png`
+end
+
+def print_benchmark(servers, request, concurrency_levels)
+  puts 'server     request   concurrency   req/s'
+  puts '=' * 42
   concurrency_levels.each do |c|
     servers.each do |server|
       puts &quot;#{server.ljust(8)}   #{request}      #{c.to_s.ljust(4)}          #{run(server, request, c)}&quot;</diff>
      <filename>benchmark/utils.rb</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,7 @@ module Thin
     def initialize(options)
       @options = options.merge(:daemonize =&gt; true)
       @size    = @options.delete(:servers)
-      @script  = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'thin')
+      @script  = 'thin'
       
       if socket
         @options.delete(:address)</diff>
      <filename>lib/thin/cluster.rb</filename>
    </modified>
    <modified>
      <diff>@@ -43,12 +43,12 @@ module Thin
     def initialize(host_or_socket, port=3000, app=nil, &amp;block)
       if host_or_socket.include?('/')
         @socket = host_or_socket
-      else
-        @host     = host_or_socket
-        @port     = port.to_i
-      end
-      @app        = app
-      @timeout    = 60 # sec
+      else      
+        @host   = host_or_socket
+        @port   = port.to_i
+      end       
+      @app      = app
+      @timeout  = 60 # sec
       
       @app = Rack::Builder.new(&amp;block).to_app if block
     end
@@ -59,10 +59,12 @@ module Thin
     
     # Start the server and listen for connections
     def start
-      raise ArgumentError, &quot;app required&quot; unless @app
+      raise ArgumentError, 'app required' unless @app
       
       trap('INT')  { stop }
       trap('TERM') { stop! }
+      
+      at_exit { remove_socket_file } if @socket
             
       # See http://rubyeventmachine.com/pub/rdoc/files/EPOLL.html
       EventMachine.epoll
@@ -83,6 +85,7 @@ module Thin
     # Stops the server by stopping the listening loop.
     def stop
       EventMachine.stop_event_loop
+      remove_socket_file
     rescue
       warn &quot;Error stopping : #{$!}&quot;
     end
@@ -117,5 +120,9 @@ module Thin
         connection.silent                  = @silent
         connection.unix_socket             = !@socket.nil?
       end
+      
+      def remove_socket_file
+        File.delete(@socket) if @socket &amp;&amp; File.exist?(@socket)
+      end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/thin/server.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,10 @@ module Thin
   module VERSION #:nodoc:
     MAJOR    = 0
     MINOR    = 6
-    TINY     = 0
+    TINY     = 1
     
     STRING   = [MAJOR, MINOR, TINY].join('.')
     
-    CODENAME = 'Big Pony'
+    CODENAME = 'Cheesecake'
   end
 end</diff>
      <filename>lib/thin/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -122,11 +122,11 @@ describe Server, &quot;on UNIX domain socket&quot; do
     app = proc do |env|
       [200, { 'Content-Type' =&gt; 'text/html' }, [env.inspect]]
     end
-    server = Thin::Server.new('/tmp/thin_test.sock', nil, app)
-    server.timeout = 3
-    server.silent = true
+    @server = Thin::Server.new('/tmp/thin_test.sock', nil, app)
+    @server.timeout = 3
+    @server.silent = true
     
-    @thread = Thread.new { server.start }
+    @thread = Thread.new { @server.start }
     sleep 0.1 until @thread.status == 'sleep'
   end
   
@@ -140,7 +140,12 @@ describe Server, &quot;on UNIX domain socket&quot; do
   
   it &quot;should handle GET in less then #{get_request_time = 0.002} RubySecond&quot; do
     proc { get('/') }.should be_faster_then(get_request_time)
-  end  
+  end
+  
+  it &quot;should remove socket file after server stops&quot; do
+    @server.stop
+    File.exist?('/tmp/thin_test.sock').should be_false
+  end
   
   after do
     @thread.kill</diff>
      <filename>spec/server_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>38b7c0d42699fc8f40a48a08507021bab625adcb</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/488564f0f113991d021c9166c85c5fe747a54eb2</url>
  <id>488564f0f113991d021c9166c85c5fe747a54eb2</id>
  <committed-date>2008-01-25T20:40:10-08:00</committed-date>
  <authored-date>2008-01-25T20:40:10-08:00</authored-date>
  <message>Remove socket file when server stops.
Set back cluster to use 'thin' command to launch servers.
Add outputing benchmark results to graph using Gruff.
Bump to v0.6.1</message>
  <tree>3d369fcb5f590e51da7b9af15171da4fa4185427</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
