From 28c53de58eff7c191b086f94ed70481eea4b4a61 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Fri, 20 Oct 2017 09:09:03 -0700 Subject: [PATCH] =?UTF-8?q?Remove=20old=20testing/CI=20junk=20which=20hasn?= =?UTF-8?q?=E2=80=99t=20been=20used=20in=20years?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 25 +---- Rakefile | 4 - myapp/Appraisals | 7 -- myapp/Capfile | 5 - myapp/Gemfile | 16 +--- myapp/Procfile | 2 - myapp/Rakefile.test | 59 ------------ myapp/bench.rb | 11 --- myapp/gemfiles/rails_4.gemfile | 13 --- myapp/gemfiles/rails_4.gemfile.lock | 137 --------------------------- myapp/gemfiles/rails_5.gemfile | 13 --- myapp/gemfiles/rails_5.gemfile.lock | 141 ---------------------------- myapp/integration_setup.rb | 8 -- myapp/readme.md | 61 ------------ 14 files changed, 4 insertions(+), 498 deletions(-) delete mode 100644 myapp/Appraisals delete mode 100644 myapp/Capfile delete mode 100644 myapp/Procfile delete mode 100644 myapp/Rakefile.test delete mode 100644 myapp/bench.rb delete mode 100644 myapp/gemfiles/rails_4.gemfile delete mode 100644 myapp/gemfiles/rails_4.gemfile.lock delete mode 100644 myapp/gemfiles/rails_5.gemfile delete mode 100644 myapp/gemfiles/rails_5.gemfile.lock delete mode 100644 myapp/integration_setup.rb delete mode 100644 myapp/readme.md diff --git a/Gemfile b/Gemfile index f7f3d557..532f00bf 100644 --- a/Gemfile +++ b/Gemfile @@ -2,31 +2,10 @@ source 'https://rubygems.org' gemspec gem 'rails', '>= 5.0.1' -gem "hiredis" +#gem "hiredis" gem 'simplecov' gem 'minitest' -#gem 'minitest-utils' -gem 'toxiproxy' +#gem 'toxiproxy' # For Redis 4.0 support. Unreleased 9cb81bf. gem 'redis-namespace', git: 'https://github.com/resque/redis-namespace' - -platforms :rbx do - gem 'rubysl', '~> 2.0' # if using anything in the ruby standard library - gem 'psych' # if using yaml - gem 'rubinius-developer_tools' # if using any of coverage, debugger, profiler -end - -platforms :ruby do - gem 'sqlite3' -end - -platforms :mri do - gem 'pry-byebug' - gem 'ruby-prof' -end - -#platforms :jruby do - #gem 'jruby-openssl' - #gem 'activerecord-jdbcsqlite3-adapter' -#end diff --git a/Rakefile b/Rakefile index 2e229062..5a30d208 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,3 @@ Rake::TestTask.new(:test) do |test| end task :default => :test - -task :appraise do - exec("cd myapp && rake appraise") -end diff --git a/myapp/Appraisals b/myapp/Appraisals deleted file mode 100644 index 13c017e4..00000000 --- a/myapp/Appraisals +++ /dev/null @@ -1,7 +0,0 @@ -appraise "rails-4" do - gem "rails", "4.2.7" -end - -appraise "rails-5" do - gem "rails", "5.0.0" -end diff --git a/myapp/Capfile b/myapp/Capfile deleted file mode 100644 index 98743d10..00000000 --- a/myapp/Capfile +++ /dev/null @@ -1,5 +0,0 @@ -load 'deploy' -# Uncomment if you are using Rails' asset pipeline - # load 'deploy/assets' -Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } -load 'config/deploy' # remove this line to skip loading any of the default tasks \ No newline at end of file diff --git a/myapp/Gemfile b/myapp/Gemfile index c44ddb94..882bd0e1 100644 --- a/myapp/Gemfile +++ b/myapp/Gemfile @@ -1,21 +1,9 @@ source 'https://rubygems.org' -gem 'appraisal' -gem 'pry' gem 'sidekiq', :path => '..' -gem 'rails', '5.0.2' +gem 'rails', '5.1.4' +gem 'puma' platforms :ruby do gem 'sqlite3' - gem 'redis-namespace' end - -#platforms :jruby do - #gem 'jruby-openssl' - #gem 'activerecord-jdbcsqlite3-adapter' -#end - -#gem 'ruby-prof' - -#de Does not work with jruby or rbx: -#de gem 'pry-byebug' diff --git a/myapp/Procfile b/myapp/Procfile deleted file mode 100644 index b2813237..00000000 --- a/myapp/Procfile +++ /dev/null @@ -1,2 +0,0 @@ -web: bundle exec rails server -p $PORT -worker: bundle exec sidekiq diff --git a/myapp/Rakefile.test b/myapp/Rakefile.test deleted file mode 100644 index 6ca7edab..00000000 --- a/myapp/Rakefile.test +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env rake - -desc "Run rails integration tests for Sidekiq" -task :appraise do - failed = false - - %w(4 5).each do |ver| - %w(production development).each do |env| - output = `bundle exec ruby integration_setup.rb` - if output.strip != '' - puts output - exit(-1) - end - - rout, wout = IO.pipe - rerr, werr = IO.pipe - - command = "bundle exec sidekiq" - pid = Process.spawn({'RAILS_ENV' => env, 'BUNDLE_GEMFILE' => "gemfiles/rails_#{ver}.gemfile"}, - command, :out => wout, :err => werr) - status = nil - begin - require 'timeout' - Timeout.timeout(10) do - Process.wait(pid) - end - rescue Timeout::Error - puts "Killing #{pid}" - Process.kill('KILL', pid) - end - status = $? - - # close write ends so we could read them - wout.close - werr.close - - stdout = rout.readlines - stderr = rerr.readlines - - # dispose the read ends of the pipes - rout.close - rerr.close - - rc = status.exitstatus - success = stdout.grep(/Success/).size == 3 - if success - puts "#{ver}/#{env} success, #{pid}/#{rc}/#{success}" - else - puts stdout.join - puts stderr.join if stderr.size > 0 - puts "#{ver}/#{env} failed, #{pid}/#{rc}/#{success}" - failed = true - end - end - end - exit(failed ? -1 : 0) -end - -task :default => :appraise diff --git a/myapp/bench.rb b/myapp/bench.rb deleted file mode 100644 index 76c542af..00000000 --- a/myapp/bench.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'sidekiq' - -Sidekiq.configure_client do |config| - config.redis = { :namespace => 'foo' } -end - -jobs = [] -20_000.times do - jobs << [] -end -Sidekiq::Client.push_bulk 'class' => 'LazyWorker', 'args' => jobs diff --git a/myapp/gemfiles/rails_4.gemfile b/myapp/gemfiles/rails_4.gemfile deleted file mode 100644 index 81475001..00000000 --- a/myapp/gemfiles/rails_4.gemfile +++ /dev/null @@ -1,13 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "pry" -gem "sidekiq", :path => "../.." -gem "rails", "4.2.7" - -platforms :ruby do - gem "sqlite3" - gem "redis-namespace" -end diff --git a/myapp/gemfiles/rails_4.gemfile.lock b/myapp/gemfiles/rails_4.gemfile.lock deleted file mode 100644 index 5d85d9d7..00000000 --- a/myapp/gemfiles/rails_4.gemfile.lock +++ /dev/null @@ -1,137 +0,0 @@ -PATH - remote: ../.. - specs: - sidekiq (4.2.8) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - rack-protection (>= 1.5.0) - redis (~> 3.2, >= 3.2.1) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.7) - actionpack (= 4.2.7) - actionview (= 4.2.7) - activejob (= 4.2.7) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.7) - actionview (= 4.2.7) - activesupport (= 4.2.7) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.7) - activesupport (= 4.2.7) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.7) - activesupport (= 4.2.7) - globalid (>= 0.3.0) - activemodel (4.2.7) - activesupport (= 4.2.7) - builder (~> 3.1) - activerecord (4.2.7) - activemodel (= 4.2.7) - activesupport (= 4.2.7) - arel (~> 6.0) - activesupport (4.2.7) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.1.0) - bundler - rake - thor (>= 0.14.0) - arel (6.0.3) - builder (3.2.2) - coderay (1.1.1) - concurrent-ruby (1.0.2) - connection_pool (2.2.1) - erubis (2.7.0) - globalid (0.3.7) - activesupport (>= 4.1.0) - i18n (0.7.0) - json (1.8.3) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) - minitest (5.9.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - rack (1.6.4) - rack-protection (1.5.3) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.7) - actionmailer (= 4.2.7) - actionpack (= 4.2.7) - actionview (= 4.2.7) - activejob (= 4.2.7) - activemodel (= 4.2.7) - activerecord (= 4.2.7) - activesupport (= 4.2.7) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.7) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (4.2.7) - actionpack (= 4.2.7) - activesupport (= 4.2.7) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (11.3.0) - redis (3.3.1) - redis-namespace (1.5.2) - redis (~> 3.0, >= 3.0.4) - slop (3.6.0) - sprockets (3.7.0) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.0) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.11) - thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal - pry - rails (= 4.2.7) - redis-namespace - sidekiq! - sqlite3 - -BUNDLED WITH - 1.13.6 diff --git a/myapp/gemfiles/rails_5.gemfile b/myapp/gemfiles/rails_5.gemfile deleted file mode 100644 index 6d0d97ff..00000000 --- a/myapp/gemfiles/rails_5.gemfile +++ /dev/null @@ -1,13 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "pry" -gem "sidekiq", :path => "../.." -gem "rails", "5.0.0" - -platforms :ruby do - gem "sqlite3" - gem "redis-namespace" -end diff --git a/myapp/gemfiles/rails_5.gemfile.lock b/myapp/gemfiles/rails_5.gemfile.lock deleted file mode 100644 index 17282464..00000000 --- a/myapp/gemfiles/rails_5.gemfile.lock +++ /dev/null @@ -1,141 +0,0 @@ -PATH - remote: ../.. - specs: - sidekiq (4.2.8) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - rack-protection (>= 1.5.0) - redis (~> 3.2, >= 3.2.1) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (5.0.0) - actionpack (= 5.0.0) - nio4r (~> 1.2) - websocket-driver (~> 0.6.1) - actionmailer (5.0.0) - actionpack (= 5.0.0) - actionview (= 5.0.0) - activejob (= 5.0.0) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.0.0) - actionview (= 5.0.0) - activesupport (= 5.0.0) - rack (~> 2.0) - rack-test (~> 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0) - activesupport (= 5.0.0) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0) - activesupport (= 5.0.0) - globalid (>= 0.3.6) - activemodel (5.0.0) - activesupport (= 5.0.0) - activerecord (5.0.0) - activemodel (= 5.0.0) - activesupport (= 5.0.0) - arel (~> 7.0) - activesupport (5.0.0) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) - minitest (~> 5.1) - tzinfo (~> 1.1) - appraisal (2.1.0) - bundler - rake - thor (>= 0.14.0) - arel (7.1.4) - builder (3.2.2) - coderay (1.1.1) - concurrent-ruby (1.0.2) - connection_pool (2.2.1) - erubis (2.7.0) - globalid (0.3.7) - activesupport (>= 4.1.0) - i18n (0.7.0) - loofah (2.0.3) - nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) - minitest (5.9.1) - nio4r (1.2.1) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - pry (0.10.4) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - rack (2.0.1) - rack-protection (1.5.3) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.0) - actioncable (= 5.0.0) - actionmailer (= 5.0.0) - actionpack (= 5.0.0) - actionview (= 5.0.0) - activejob (= 5.0.0) - activemodel (= 5.0.0) - activerecord (= 5.0.0) - activesupport (= 5.0.0) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - railties (5.0.0) - actionpack (= 5.0.0) - activesupport (= 5.0.0) - method_source - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (11.3.0) - redis (3.3.1) - redis-namespace (1.5.2) - redis (~> 3.0, >= 3.0.4) - slop (3.6.0) - sprockets (3.7.0) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.0) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.11) - thor (0.19.1) - thread_safe (0.3.5) - tzinfo (1.2.2) - thread_safe (~> 0.1) - websocket-driver (0.6.4) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal - pry - rails (= 5.0.0) - redis-namespace - sidekiq! - sqlite3 - -BUNDLED WITH - 1.13.6 diff --git a/myapp/integration_setup.rb b/myapp/integration_setup.rb deleted file mode 100644 index 8ee03ce7..00000000 --- a/myapp/integration_setup.rb +++ /dev/null @@ -1,8 +0,0 @@ -require 'redis' - -# Push three different types of jobs into Redis -r = Redis.new -r.flushdb -r.lpush "queue:default", '{"class":"ExitWorker","args":[],"retry":true,"queue":"default","jid":"4c51e497bbfea959deee0567","created_at":1479409542.279716,"enqueued_at":1479409542.279781}' -r.lpush "queue:default", '{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ExitJob","queue":"default","args":[{"job_class":"ExitJob","job_id":"f8a11fa4-753e-4567-838e-74009ee25cb2","queue_name":"default","priority":null,"arguments":[],"locale":"en"}],"retry":true,"jid":"d020316e37c17bbcd5d360b1","created_at":1479409368.005358,"enqueued_at":1479409368.0056908}' -r.lpush "queue:default", '{"class":"Sidekiq::Extensions::DelayedClass","args":["---\n- !ruby/class \'Exiter\'\n- :run\n- []\n"],"retry":true,"queue":"default","jid":"6006486330d4a27a03593d09","created_at":1479409495.87069,"enqueued_at":1479409495.870754}' diff --git a/myapp/readme.md b/myapp/readme.md deleted file mode 100644 index b66342e9..00000000 --- a/myapp/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# Ruby 2.0 slowness with big concurrency - -To reproduce: - -Install redis locally and checkout the Sidekiq repo: - -``` -git clone git://github.com/mperham/sidekiq -cd sidekiq/myapp -bundle -``` - -Load lots of jobs into Redis, you can edit Rakefile to change the job - count: - -``` -> time bundle exec rake load_jobs -2013-04-26T15:32:37Z 66670 TID-ov6pgqt3k INFO: Sidekiq client using redis://localhost:6379/0 with options {:size=>2, :namespace=>"foo"} - -real 0m49.206s -user 0m45.037s -sys 0m3.558s -``` - -Start Sidekiq with 200 worker threads to process those jobs. You will need to kill Sidekiq with Ctrl-C as soon as log messages stop flying by. - -``` -> time bundle exec sidekiq -c 200 -... -2013-04-26T15:46:25Z 67059 TID-ovwfo7krk EmptyWorker JID-cce0eed5ea7281b720841ecc INFO: done: 0.224 sec -2013-04-26T15:46:25Z 67059 TID-ovwfojqdg EmptyWorker JID-850c242ec75de77400838fa9 INFO: done: 0.231 sec -2013-04-26T15:46:25Z 67059 TID-ovwfo6u94 EmptyWorker JID-fd2422116a771dc67a848489 INFO: done: 0.223 sec -2013-04-26T15:46:25Z 67059 TID-ovwfo94ag EmptyWorker JID-45ecb59a43e62ebb574ee0da INFO: done: 0.223 sec -2013-04-26T15:46:25Z 67059 TID-ovwfonv7s EmptyWorker JID-c7beabde4c0141b0669c4baf INFO: done: 0.221 sec -^C2013-04-26T15:46:27Z 67059 TID-ovwfalyvw INFO: Shutting down -2013-04-26T15:46:27Z 67059 TID-ovwfefrzw INFO: Shutting down 200 quiet workers - -real 3m37.921s -user 3m3.110s -sys 1m4.783s -> ruby -v -ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.3.0] -``` - -Now try with various Rubies to see how your choice in VM performs. - -``` -2013-04-26T15:57:04Z 67357 TID-ow0muevo8 EmptyWorker JID-cb03f00310af3590009b19fe INFO: done: 0.189 sec -2013-04-26T15:57:04Z 67357 TID-ow0muqgxc EmptyWorker JID-89710c72bf4a343834833bc4 INFO: done: 0.19 sec -2013-04-26T15:57:04Z 67357 TID-ow0ms6rc4 EmptyWorker JID-bb358d8d8f02af9734b8a3ff INFO: done: 0.186 sec -2013-04-26T15:57:04Z 67357 TID-ow0mwn908 EmptyWorker JID-7c032c55e6ab9a63dc31f175 INFO: done: 0.188 sec -2013-04-26T15:57:04Z 67357 TID-ow0mv6m80 EmptyWorker JID-73dc04f9e431ebf433707d02 INFO: done: 0.188 sec -^C2013-04-26T15:57:11Z 67357 TID-ow0m8kxh4 INFO: Shutting down -2013-04-26T15:57:11Z 67357 TID-ow0mwqr20 INFO: Shutting down 200 quiet workers - -real 5m55.033s -user 5m6.156s -sys 1m4.886s -> ruby -v -ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] -```