Skip to content

Instantly share code, notes, and snippets.

View kzk's full-sized avatar
🍶

Kazuki Ohta kzk

🍶
View GitHub Profile
@kzk
kzk / gist:4499673
Last active December 10, 2015 22:08
日本Hadoopユーザー会は、第4回目のカンファレンス「Hadoop Conference
Japan 2013 Winter」を1月21日に東京ビッグサイトにて開催します。
> http://hcj2013w.eventbrite.com/
オリジナル開発者 Doug Cuttingからのメッセージ、LINE, Treasure Data,
Amazon Elastic MapReduce等のキーノートを始め、Apache Hadoopに関す
る技術や事例を一同に集め、多くの方が出会える場として企画を進めています。
早くも席が埋まり始めているので、なるべくお早めにご登録下さい。
@kzk
kzk / gist:3875967
Created October 11, 2012 22:32
/usr/sbin/td-agent
#!/usr/lib/fluent/ruby/bin/ruby
ENV["FLUENT_CONF"]="/etc/td-agent/td-agent.conf"
ENV["FLUENT_PLUGIN"]="/etc/td-agent/plugin"
ENV["FLUENT_SOCKET"]="/var/run/td-agent/td-agent.sock"
# Please add these lines
ENV["GEM_HOME"]="/usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/"
ENV["GEM_PATH"]="/usr/lib/fluent/ruby/lib/ruby/gems/1.9.1/"
load "/usr/lib/fluent/ruby/bin/fluentd"
$ gem install fluent-plugin-mongo
Fetching: bson-1.7.0.gem (100%)
Fetching: mongo-1.7.0.gem (100%)
Fetching: fluent-plugin-mongo-0.6.7.gem (100%)
Successfully installed bson-1.7.0
Successfully installed mongo-1.7.0
Successfully installed fluent-plugin-mongo-0.6.7
3 gems installed
Installing ri documentation for bson-1.7.0...
Installing ri documentation for mongo-1.7.0...
module UnicornWorkerKiller
def self.kill_self(logger, start_time)
alive_sec = (Time.now - start_time).to_i
i = 0
while true
i += 1
sig = :TERM
if i > 10 # TODO configurable TERM MAX
sig = :QUIT
$ bundle exec je ./script/rails s
gem 'jemalloc'
@kzk
kzk / gist:3119711
Created July 16, 2012 01:36
example.py
from fluent import sender
from fluent import event
sender.setup('td.test_db', host='localhost', port=24224)
event.Event('follow', {
'from': 'userA',
'to': 'userB'
})
# from https://gist.github.com/1258681
# # your config.ru
# require 'unicorn_killer'
# use UnicornKiller::MaxRequests, 1000
# use UnicornKiller::Oom, 400 * 1024
module UnicornKiller
module Kill
def quit
sec = (Time.now - @process_start).to_i
# Unicorn self-process killer
require ::File.expand_path('../lib/unicorn/unicorn_killer', __FILE__)
use UnicornKiller::MaxRequests, 10240 + Random.rand(10240)
use UnicornKiller::Oom, 96 * 1024 + Random.rand(32) * 1024
# Out-Of-Band GC
require 'unicorn/oob_gc'
use Unicorn::OobGC
# What the timeout for killing busy workers is, in seconds
timeout 60
# Whether the app should be pre-loaded
preload_app true
# How many worker processes
worker_processes 4
# before/after forks