Sha256: bd5133d7aa7db45717a0192f1e62bc0216614d6a35e18ea3aeada8229f862552
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:test) task :default => :test # Load all rake tasks: import(*Dir.glob('tasks/**/*.rake')) task :server do require 'async/reactor' require 'async/http/server' app = lambda do |env| [200, {}, ["Hello World"]] end server = Async::HTTP::Server.new([ Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true) ], app) Async::Reactor.run do server.run end end task :client do require 'async/reactor' require 'async/http/client' client = Async::HTTP::Client.new([ Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true) ]) Async::Reactor.run do response = client.get("/") puts response.inspect end end task :wrk do require 'async/reactor' require 'async/http/server' app = lambda do |env| [200, {}, ["Hello World"]] end server = Async::HTTP::Server.new([ Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true) ], app) process_count = Etc.nprocessors pids = process_count.times.collect do fork do Async::Reactor.run do server.run end end end url = "http://127.0.0.1:9294/" connections = process_count system("wrk", "-c", connections.to_s, "-d", "2", "-t", connections.to_s, url) pids.each do |pid| Process.kill(:KILL, pid) Process.wait pid end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
falcon-0.35.6 | Rakefile |
falcon-0.35.5 | Rakefile |
falcon-0.35.4 | Rakefile |
falcon-0.35.3 | Rakefile |