require "rubygems" require "bundler/setup" require "goliath" class LongRunningSystemCall < Goliath::API def response(env) fiber = Fiber.current EM.system('sleep 5') do |output,status| fiber.resume end Fiber.yield [200, {}, "Hello world"] end end # Use ruby 1.9.2! # # ruby long_running_system_call.rb -e prod # # ab -c100 -n100 http://127.0.0.1:9000/ # Concurrency Level: 100 # Time taken for tests: 5.657 seconds !!! # Complete requests: 100