Created
March 29, 2012 05:10
-
-
Save kzk/2233547 to your computer and use it in GitHub Desktop.
a.rb
This file contains hidden or 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
# Scribe input | |
<source> | |
type scribe | |
port 1463 | |
</source> | |
# match tag=debug.** and dump to console | |
<match debug.**> | |
type null | |
</match> |
This file contains hidden or 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 'thrift' | |
$:.unshift File.join(File.dirname(__FILE__), './lib/fluent/plugin/thrift') | |
require 'fb303_types' | |
require 'fb303_constants' | |
require 'facebook_service' | |
require 'scribe_types' | |
require 'scribe_constants' | |
require 'scribe' | |
host = 'localhost' | |
port = 1463 | |
timeout = 10 | |
100000.times { |i| | |
socket = Thrift::Socket.new host, port, timeout | |
transport = Thrift::FramedTransport.new socket | |
protocol = Thrift::BinaryProtocol.new transport, false, false | |
client = Scribe::Client.new protocol | |
transport.open | |
begin | |
entries = [] | |
10.times { | |
entry = LogEntry.new | |
entry.category = 'debug.tag' | |
entry.message = 'message'.force_encoding('ASCII-8BIT') | |
entries << entry | |
} | |
client.Log(entries) | |
ensure | |
transport.close | |
end | |
if i % 1000 == 0 | |
p GC.stat | |
h={}; ObjectSpace.each_object {|o| h[o.class] = (h[o.class] || 0) + 1 }; p h | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment