Skip to content

Instantly share code, notes, and snippets.

@thegreatshasha
Last active August 29, 2015 13:56
Show Gist options
  • Save thegreatshasha/9069743 to your computer and use it in GitHub Desktop.
Save thegreatshasha/9069743 to your computer and use it in GitHub Desktop.
Typhoeus high memory usage test
sourcefile sourceline class memsize count
------------------------------------------------------ ---------- ---------------------------------- ------- -----
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 144 FFI::Pointer 0 12426
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 171 FFI::Pointer 0 7500
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 10 String 0 6200
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 String 0 6200
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 11 String 0 6200
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 10 String 25 3100
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 11 String 25 3100
<GEM:ethon-0.6.1>/lib/ethon/curls/infos.rb 138 Float 0 3000
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 String 25 2400
<GEM:ethon-0.6.1>/lib/ethon/curls/infos.rb 108 FFI::Pointer 0 1000
<GEM:ethon-0.6.1>/lib/ethon/easy/http.rb 56 String 0 1000
<GEM:ethon-0.6.1>/lib/ethon/easy.rb 234 String 0 1000
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 41 1000
<GEM:typhoeus-0.6.6>/lib/typhoeus/request/callbacks.rb 95 Array 0 1000
<GEM:ffi-1.9.3>/lib/ffi/autopointer.rb 83 FFI::AutoPointer::CallableReleaser 0 701
<GEM:ffi-1.9.3>/lib/ffi/autopointer.rb 90 Array 0 701
<GEM:ethon-0.6.1>/lib/ethon/easy/debug_info.rb 22 Array 0 700
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 String 51 700
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 27 Ethon::Easy::DebugInfo 0 700
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 141 Array 0 600
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 141 Ethon::Curl::Msg 0 600
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 FFI::Function 0 600
<GEM:typhoeus-0.6.6>/lib/typhoeus/request/callbacks.rb 73 Array 0 501
<GEM:typhoeus-0.6.6>/lib/typhoeus/request/callbacks.rb 41 Array 0 501
<GEM:ethon-0.6.1>/lib/ethon/easy/header.rb 31 FFI::AutoPointer 96 500
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 26 String 831 500
<GEM:ethon-0.6.1>/lib/ethon/easy/http/actionable.rb 22 Hash 96 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/request/callbacks.rb 90 Array 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 67 Hash 96 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 89 Typhoeus::Response 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 69 Array 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 99 Hash 404 500
<GEM:ethon-0.6.1>/lib/ethon/easy/mirror.rb 21 Ethon::Easy::Mirror 0 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 54 String 15 500
<GEM:ethon-0.6.1>/lib/ethon/easy/header.rb 27 FFI::Pointer 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/request/callbacks.rb 98 Array 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/util.rb 20 String 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/mirror.rb 9 Array 60 500
<GEM:ethon-0.6.1>/lib/ethon/easy/mirror.rb 9 Array 16 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra/addable.rb 19 Typhoeus::EasyFactory 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/response_callbacks.rb 32 Array 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 88 Proc 40 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/easy_factory.rb 88 RubyVM::Env 48 500
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 25 String 415 500
<GEM:ethon-0.6.1>/lib/ethon/easy/header.rb 31 Method 24 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/request.rb 110 Hash 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/mirror.rb 8 Array 44 500
typhoeus_test.rb 14 String 61 500
typhoeus_test.rb 14 String 0 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/request.rb 193 Hash 96 500
<GEM:typhoeus-0.6.6>/lib/typhoeus/request.rb 113 Hash 96 500
<GEM:ffi-1.9.3>/lib/ffi/struct.rb 75 Array 0 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 21 500
<GEM:ethon-0.6.1>/lib/ethon/easy/mirror.rb 17 Hash 428 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 38 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 19 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 80 500
<GEM:ethon-0.6.1>/lib/ethon/easy/params.rb 24 Hash 0 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 32 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 22 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 34 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 30 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 31 500
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/http/actionable.rb 62 Ethon::Easy::Form 0 500
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 146 Proc 40 500
<GEM:ethon-0.6.1>/lib/ethon/easy/form.rb 26 Hash 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/http/actionable.rb 52 Ethon::Easy::Params 0 500
<GEM:ethon-0.6.1>/lib/ethon/easy/http.rb 59 Ethon::Easy::Http::Get 20 500
<GEM:ethon-0.6.1>/lib/ethon/easy/header.rb 56 String 103 500
<GEM:ffi-1.9.3>/lib/ffi/struct.rb 75 FFI::Pointer 0 500
<GEM:ffi-1.9.3>/lib/ffi/struct.rb 75 Ethon::Curl::MsgData 0 500
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 141 FFI::Pointer 0 500
typhoeus_test.rb 14 Typhoeus::Request 28 499
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 288 400
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 103 400
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 54 String 33 400
<GEM:ethon-0.6.1>/lib/ethon/easy/operations.rb 13 FFI::Pointer 0 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 37 RubyVM::Env 48 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 25 String 0 200
<GEM:ethon-0.6.1>/lib/ethon/easy.rb 216 Hash 0 200
<GEM:ethon-0.6.1>/lib/ethon/easy/operations.rb 13 Method 24 200
<GEM:ethon-0.6.1>/lib/ethon/easy/operations.rb 13 FFI::AutoPointer 96 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 50 RubyVM::Env 48 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 50 Proc 136 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 64 RubyVM::Env 48 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 64 Proc 136 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 26 String 0 200
<GEM:ethon-0.6.1>/lib/ethon/easy/callbacks.rb 37 Proc 136 200
<GEM:typhoeus-0.6.6>/lib/typhoeus/pool.rb 32 Ethon::Easy 56 199
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 139 FFI::MemoryPointer 0 100
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 159 FFI::MemoryPointer 0 100
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 54 String 32 90
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 287 90
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 102 90
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 146 RubyVM::Env 60 64
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 286 10
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 52 String 101 10
<GEM:ffi-1.9.3>/lib/ffi/pointer.rb 54 String 31 10
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 26 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 16 FFI::AutoPointer 96 1
typhoeus_test.rb 14 Typhoeus::Request 32 1
typhoeus_test.rb 11 Typhoeus::Hydra 20 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra.rb 89 Hash 0 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra.rb 92 Hash 0 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra.rb 92 Ethon::Multi 40 1
<GEM:ethon-0.6.1>/lib/ethon/loggable.rb 42 Logger 20 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra/runnable.rb 17 Array 0 1
<RUBYLIBDIR>/logger.rb 314 Logger::Formatter 0 1
<RUBYLIBDIR>/logger.rb 318 Hash 96 1
<RUBYLIBDIR>/logger.rb 318 Logger::LogDevice 20 1
<RUBYLIBDIR>/logger.rb 545 Logger::LogDevice::LogDeviceMutex 0 1
<RUBYLIBDIR>/logger.rb 545 Array 0 1
<RUBYLIBDIR>/monitor.rb 241 Mutex 92 1
<GEM:ethon-0.6.1>/lib/ethon/curl.rb 62 String 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 16 FFI::Pointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 16 Method 24 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 27 Ethon::Curl::Timeval 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 27 Array 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 27 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 28 Ethon::Curl::FDSet 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 28 Array 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 28 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 29 Ethon::Curl::FDSet 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 29 Array 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 29 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 30 Ethon::Curl::FDSet 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 30 Array 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 30 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/operations.rb 31 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/multi/stack.rb 14 Array 64 1
<GEM:ethon-0.6.1>/lib/ethon/curls/infos.rb 149 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/curls/infos.rb 169 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/curls/infos.rb 159 FFI::MemoryPointer 0 1
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 Hash 0 1
<GEM:ethon-0.6.1>/lib/ethon/curls/options.rb 79 Thread 525068 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/pool.rb 55 Array 1160 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/expectation.rb 61 Array 0 1
<GEM:typhoeus-0.6.6>/lib/typhoeus.rb 98 Array 0 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra/runnable.rb 17 Array 800 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra/queueable.rb 17 Array 0 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/pool.rb 32 Ethon::Easy 68 1
<GEM:typhoeus-0.6.6>/lib/typhoeus/hydra/memoizable.rb 21 Hash 0 1
require 'typhoeus'
require 'allocation_stats'
require 'pry'
Typhoeus::Config.memoize = false
num_requests = 500
stats = AllocationStats.trace do
hydra = Typhoeus::Hydra.new
num_requests.times do |i|
hydra.queue(Typhoeus::Request.new("https://www.google.com?q=foo-#{i}"))
end
hydra.run
end
puts "Generating logs \n"
text = stats.allocations(alias_paths: true).group_by(:sourcefile, :sourceline, :class, :memsize).sort_by_count.to_text
File.write("logs/typhoeus/#{Time.now}.log", text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment