Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #106 from Asmod4n/patch-1
Browse files Browse the repository at this point in the history
Added a new benchmark using a Connection Pool
  • Loading branch information
tarcieri committed Oct 1, 2013
2 parents 03241b0 + 35155b6 commit 907126a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions benchmarks/reel_pool.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'bundler/setup'
require 'reel'

class MyConnectionHandler
include Celluloid

def handle_connection(connection)
connection.each_request { |req| handle_request(req) }
rescue Reel::SocketError
connection.close
end

def handle_request(request)
request.respond :ok, ''
end
end

connectionPool = MyConnectionHandler.pool

Reel::Server.run('127.0.0.1', 3000) do |connection|
# We're handing this connection off to another actor, so
# we detach it first before handing it off
connection.detach

# Let a Connection Pool handle the connections for Roflscale Applications
connectionPool.async.handle_connection(connection)
end

0 comments on commit 907126a

Please sign in to comment.