Skip to content

Instantly share code, notes, and snippets.

View tejanium's full-sized avatar

Teja Sophista tejanium

  • Bristol
  • 22:16 (UTC +01:00)
View GitHub Profile
@tejanium
tejanium / concurrent_test.rb
Created September 27, 2022 16:01
Concurrency testing
class ConcurrentTest
attr_reader :sleep_time, :valid_ids
def initialize(sleep_time)
@sleep_time = sleep_time
@valid_ids = User.limit(3).pluck(:id)
end
def network_call
puts "Calling network #{Thread.current}"
~ $ rvm get head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 185 100 185 0 0 41 0 0:00:04 0:00:04 --:--:-- 50
100 10009 100 10009 0 0 1165 0 0:00:08 0:00:08 --:--:-- 3168
Downloading RVM from wayneeseguin branch master
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 125 100 125 0 0 27 0 0:00:04 0:00:04 --:--:-- 40
100 1085k 100 1085k 0 0 39408 0 0:00:28 0:00:28 --:--:-- 186k
~ $ rvm requirements
Notes for Mac OS X 10.8.2, Xcode 4.5.
For JRuby: Install the JDK. See http://developer.apple.com/java/download/ # Current Java version "1.6.0_26"
For IronRuby: Install Mono >= 2.6
For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'
To use an RVM installed Ruby as default, instead of the system ruby:
~ $ rvm get head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 185 100 185 0 0 112 0 0:00:01 0:00:01 --:--:-- 142
100 10009 100 10009 0 0 1695 0 0:00:05 0:00:05 --:--:-- 2521
Downloading RVM from wayneeseguin branch master
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 125 100 125 0 0 101 0 0:00:01 0:00:01 --:--:-- 130
100 1084k 100 1084k 0 0 77258 0 0:00:14 0:00:14 --:--:-- 222k
~ $ CC=/usr/local/bin/gcc-4.2 rvm --trace install 1.9.3-perf --patch falcon
--force-autoconf -j 3
+__rvm_parse_args:638> [[ -n 4.3.11 ]]
+__rvm_parse_args:673> [[ -z '' && -n '' ]]
+__rvm_parse_args:676> [[ error == || 0 -eq 1 || -n '' ]]
+__rvm_parse_args:16> [[ -n install ]]
+__rvm_parse_args:18> rvm_token=install
+__rvm_parse_args:20> (( 6 > 0 ))
+__rvm_parse_args:22> next_token=1.9.3-perf
+__rvm_parse_args:23> shift