This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
include Mongoid::Document | |
field :name, :type => String | |
embeds_one :location | |
end | |
class Location | |
include Mongoid::Document | |
field :country, :type => String, :default => "US" | |
field :address, :type => String |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'protobuf' | |
require 'varint/varint' | |
ITERATIONS = 1_000_000 | |
class Test | |
extend ::Varint | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ec2: | |
default: | |
- | |
group: monitor | |
region: us-west-1 | |
port: 4949 | |
protocol: tcp | |
note: M/Monit | |
- | |
group: monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'beefcake' # 1.1.0 | |
require 'protocol_buffers' # 1.6.1 | |
require 'protobuf' # 3.5.5 | |
require 'protobuf/message' | |
require 'google/protobuf' # 3.0.0.alpha.4.0 | |
require 'varint/varint' # 0.1.1 | |
module Test | |
# beefcake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Decoding a large proto 1,000 times. | |
Ruby 2.2.3 | |
user system total real | |
protobuf encoding 13.060000 0.180000 13.240000 ( 13.262584) | |
google-protobuf encoding 1.780000 0.050000 1.830000 ( 1.823272) | |
protobuf decoding 8.890000 0.030000 8.920000 ( 8.927971) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DependencyDetection.defer do | |
@name = :mongodb | |
depends_on do | |
defined?(::Mongo) and not NewRelic::Control.instance['disable_mongodb'] | |
end | |
executes do | |
NewRelic::Agent.logger.debug 'Installing MongoDB instrumentation' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Measure Mode: wall_time | |
Thread ID: 70319499115040 | |
Fiber ID: 70319529395800 | |
Total Time: 1.1018621921539307 | |
Sort by: total_time | |
%total %self total self wait child calls Name | |
-------------------------------------------------------------------------------- | |
100.00% 0.00% 1.102 0.000 0.000 1.102 1 Global#[No method] | |
1.102 0.001 0.000 1.100 1/1 Integer#times |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Measure Mode: wall_time | |
Thread ID: 70262938909220 | |
Fiber ID: 70262945578140 | |
Total Time: 12.474074363708496 | |
Sort by: total_time | |
%total %self total self wait child calls Name | |
-------------------------------------------------------------------------------- | |
100.00% 0.00% 12.474 0.000 0.000 12.474 1 Global#[No method] | |
12.474 0.002 0.000 12.472 1/1 Integer#times |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if io = sock.accept_nonblock | |
client = Client.new io, @binder.env(sock) | |
if remote_addr_value | |
client.peerip = remote_addr_value | |
elsif remote_addr_header | |
client.remote_addr_header = remote_addr_header | |
end | |
pool << client | |
pool.wait_until_not_full unless queue_requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def <<(work) | |
@mutex.synchronize do | |
if @shutdown | |
raise "Unable to add work while shutting down" | |
end | |
@todo << work | |
if @waiting < @todo.size and @spawned < @max | |
spawn_thread |
OlderNewer