SlideShare a Scribd company logo
Fluentd Hacking Guide 
(Fluentd ソースコード完全解説) 
September 20th, 2014 
! 
Naotoshi Seo @sonots 
DeNA Co., Ltd. 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
2 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Who am I? 
・Naotoshi Seo @sonots 
・DeNA Co, Ltd. 
・Infrastructure Engineer 
・Fluentd Commiter
⁃ An application (or a framework) to process log streaming 
⁃ Powerful plugin architecture (+250 plugins) 
⁃ written in Ruby 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Disclaimer 
4 
1. I do not explain what is Fluentd, how to use Fluentd 
2. I assume audiences have ever used Fluentd, have ever 
created Fluentd plugins, have interests inside Fluentd 
! 
3. Source Codes are from v0.10 branch as of September 2014
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Topics 
5 
1. The bootstrap sequence of Fluentd, and how Fluentd loads 
plugins 
2. How an input plugin passes data to output plugins 
3. How BufferedOutput plugin works 
4. How Fluentd parses the config file 
5. The event-driven programming using cool.io, and effects of 
GVL
6 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Let's Dive into 
Source Codes
7 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
vim
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Topics 
8 
1. The bootstrap sequence of Fluentd, and how Fluentd loads 
plugins 
2. How an input plugin passes data to output plugins 
3. How BufferedOutput plugin works
The Bootstrap Sequence 
9 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Fluent::Supervisor#run_configure 
1. require 
2. new 
3. configure(conf ) 
Fluent::Supervisor#run_engine 
4. start 
5. shutdown (if signal received) 
Input plugin creates threads on #start 
Output plugin does nothing on #start (typically)
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Topics 
10 
1. The bootstrap sequence of Fluentd, and how Fluentd loads 
plugins 
2. How an input plugin passes data to output plugins 
3. How BufferedOutput plugin works
Dataflow from Input to Output 
11 
Input Engine Output 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
emit(tag, es) 
emit(tag, es) 
If an input thread receives data, call Engine.emit
CAUTION: Output Plugin 
12 
Input Engine Output 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
emit(tag, es) 
emit(tag, es) 
BLOCK!!! 
Can not receive new input during blocking 
ex) HTTP POST
13 
Use BufferedOutput 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
to avoid blocking
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Topics 
14 
1. The bootstrap sequence of Fluentd, and how Fluentd loads 
plugins 
2. How an input plugin passes data to output plugins 
3. How BufferedOutput plugin works
BufferedOutput Plugin 
Input Engine BufferedOutput BasicBuffer 
15 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
emit(tag,es) 
emit(tag,es) 
emit(tag,data) 
enqueue 
immediately 
return!! 
Can receive new input. No blocking.
BufferedOutput Plugin 
16 
BufferedOutput BasicBuffer 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
try_flush 
(push) 
OutputThread 
pop 
write(chunk) 
do some EXPENSIVE things 
Run heavy processing in OTHER threads
CAUTION: BufferedOutput 
17 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Stuck if enqueued over its capability 
! 
HOW TO IMPROVE 
1. Increase num_threads 
2. Enlarge buffer_chunk_limit 
3. Set smaller queued_chunk_flush_interval, try_flush_interval 
(Secret parameters)
18 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
But,
19 
Improving actual 
processing throughputs 
is most important 
fluent-plugin-elasticsearch gets stuck? Then, tune Elasticsearch! 
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. 
Conclusion 
20 
1. Output plugin blocks 
2. BufferedOutput does not block, but stuck if enqueued 
over its capability 
• Tune with option parameters such as num_threads 
3. In either case, improving actual processing capability 
itself is most important!! 
4. I am happy if this talk helps your operation, your 
plugin development, and contributions

More Related Content

What's hot

Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
SATOSHI TAGOMORI
 
Fluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect MoreFluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect More
Sadayuki Furuhashi
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
SATOSHI TAGOMORI
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
SATOSHI TAGOMORI
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshell
N Masahiro
 
Fluentd v0.14 Overview
Fluentd v0.14 OverviewFluentd v0.14 Overview
Fluentd v0.14 Overview
N Masahiro
 
LuaJIT
LuaJITLuaJIT
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12
N Masahiro
 
Fluentd v1 and future at techtalk
Fluentd v1 and future at techtalkFluentd v1 and future at techtalk
Fluentd v1 and future at techtalk
N Masahiro
 
Fluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At FossasiaFluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At Fossasia
N Masahiro
 
Fluent-bit
Fluent-bitFluent-bit
Fluent-bit
eventdotsjp
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Evel xf
 
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows supportFluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
Ritta Narita
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
Zygmunt Krynicki
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
Angelo Failla
 
Keynote - Fluentd meetup v14
Keynote - Fluentd meetup v14Keynote - Fluentd meetup v14
Keynote - Fluentd meetup v14
Treasure Data, Inc.
 
Linux multiplexing
Linux multiplexingLinux multiplexing
Linux multiplexingMark Veltzer
 
p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4
Kentaro Ebisawa
 
Is ruby logger thread(process)-safe? at RubyConf 2013
Is ruby logger thread(process)-safe? at RubyConf 2013Is ruby logger thread(process)-safe? at RubyConf 2013
Is ruby logger thread(process)-safe? at RubyConf 2013Naotoshi Seo
 
Lua and its Ecosystem
Lua and its EcosystemLua and its Ecosystem
Lua and its Ecosystem
François Perrad
 

What's hot (20)

Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
 
Fluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect MoreFluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect More
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshell
 
Fluentd v0.14 Overview
Fluentd v0.14 OverviewFluentd v0.14 Overview
Fluentd v0.14 Overview
 
LuaJIT
LuaJITLuaJIT
LuaJIT
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12
 
Fluentd v1 and future at techtalk
Fluentd v1 and future at techtalkFluentd v1 and future at techtalk
Fluentd v1 and future at techtalk
 
Fluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At FossasiaFluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At Fossasia
 
Fluent-bit
Fluent-bitFluent-bit
Fluent-bit
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows supportFluentd Meetup 2016 - ServerEngine Integration & Windows support
Fluentd Meetup 2016 - ServerEngine Integration & Windows support
 
Snaps on open suse
Snaps on open suseSnaps on open suse
Snaps on open suse
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
 
Keynote - Fluentd meetup v14
Keynote - Fluentd meetup v14Keynote - Fluentd meetup v14
Keynote - Fluentd meetup v14
 
Linux multiplexing
Linux multiplexingLinux multiplexing
Linux multiplexing
 
p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4p4alu: Arithmetic Logic Unit in P4
p4alu: Arithmetic Logic Unit in P4
 
Is ruby logger thread(process)-safe? at RubyConf 2013
Is ruby logger thread(process)-safe? at RubyConf 2013Is ruby logger thread(process)-safe? at RubyConf 2013
Is ruby logger thread(process)-safe? at RubyConf 2013
 
Lua and its Ecosystem
Lua and its EcosystemLua and its Ecosystem
Lua and its Ecosystem
 

Viewers also liked

Webアプリ開発者のためのHTML5セキュリティ入門
Webアプリ開発者のためのHTML5セキュリティ入門Webアプリ開発者のためのHTML5セキュリティ入門
Webアプリ開発者のためのHTML5セキュリティ入門
Muneaki Nishimura
 
Life of an Fluentd event
Life of an Fluentd eventLife of an Fluentd event
Life of an Fluentd eventKiyoto Tamura
 
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
윤성 이
 
글로벌 ITSM시장 트렌드, Global ITSM Market trends
글로벌 ITSM시장 트렌드, Global ITSM Market trends글로벌 ITSM시장 트렌드, Global ITSM Market trends
글로벌 ITSM시장 트렌드, Global ITSM Market trends
Hyunmyung Kim
 
Test driven development
Test driven developmentTest driven development
Test driven development
Jinho Song
 
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
Kay Kim
 
Itsm팀 내부세미나 익스트림프로그래밍_정희찬
Itsm팀 내부세미나 익스트림프로그래밍_정희찬Itsm팀 내부세미나 익스트림프로그래밍_정희찬
Itsm팀 내부세미나 익스트림프로그래밍_정희찬
정 희찬
 
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
Kay Kim
 
익스트림 프로그래밍(Xp)
익스트림 프로그래밍(Xp)익스트림 프로그래밍(Xp)
익스트림 프로그래밍(Xp)
영기 김
 

Viewers also liked (9)

Webアプリ開発者のためのHTML5セキュリティ入門
Webアプリ開発者のためのHTML5セキュリティ入門Webアプリ開発者のためのHTML5セキュリティ入門
Webアプリ開発者のためのHTML5セキュリティ入門
 
Life of an Fluentd event
Life of an Fluentd eventLife of an Fluentd event
Life of an Fluentd event
 
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
애자일, 소프트웨어와 인간을 말하다(eXtreme Programming, XP)
 
글로벌 ITSM시장 트렌드, Global ITSM Market trends
글로벌 ITSM시장 트렌드, Global ITSM Market trends글로벌 ITSM시장 트렌드, Global ITSM Market trends
글로벌 ITSM시장 트렌드, Global ITSM Market trends
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
실전 애자일 게임 개발 (Agile Game Agile Game Development From The Trenches)
 
Itsm팀 내부세미나 익스트림프로그래밍_정희찬
Itsm팀 내부세미나 익스트림프로그래밍_정희찬Itsm팀 내부세미나 익스트림프로그래밍_정희찬
Itsm팀 내부세미나 익스트림프로그래밍_정희찬
 
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
애자일 게임 개발: 최전선의 이야기(Gamefest 2006)
 
익스트림 프로그래밍(Xp)
익스트림 프로그래밍(Xp)익스트림 프로그래밍(Xp)
익스트림 프로그래밍(Xp)
 

Similar to Fluentd Hacking Guide at RubyKaigi 2014

Ltrt 30500 boot p technical note ver. 6.2
Ltrt 30500 boot p technical note ver. 6.2Ltrt 30500 boot p technical note ver. 6.2
Ltrt 30500 boot p technical note ver. 6.2
charlyalize
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel Tour
Rod Flohr
 
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.Kero
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.KeroOGDC 2014_Cross platform mobile game application development_Mr. Makku J.Kero
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.Keroogdc
 
OGDC 2014: Cross Platform Mobile Game Application Development
OGDC 2014: Cross Platform Mobile Game Application DevelopmentOGDC 2014: Cross Platform Mobile Game Application Development
OGDC 2014: Cross Platform Mobile Game Application DevelopmentGameLandVN
 
Engin object presentation 2000
Engin object presentation 2000Engin object presentation 2000
Engin object presentation 2000
Mal Moran
 
Guiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landGuiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landDariusz Łuksza
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEGetting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Intel Software Brasil
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
Nutan Kumar Panda
 
NTTs Journey with Openstack-final
NTTs Journey with Openstack-finalNTTs Journey with Openstack-final
NTTs Journey with Openstack-final
shintaro mizuno
 
Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5
Kazuho Oku
 
Automated Deployment using Open Source
Automated Deployment using Open SourceAutomated Deployment using Open Source
Automated Deployment using Open Source
duskglow
 
How to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin EcosystemHow to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin Ecosystem
InfluxData
 
Software Define your Current Storage with Opensource
Software Define your Current Storage with OpensourceSoftware Define your Current Storage with Opensource
Software Define your Current Storage with Opensource
Antonio Romeo
 
Tekaba Manual
Tekaba ManualTekaba Manual
Tekaba Manual
Yasin KAPLAN
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
Philip Tellis
 
H2O - the optimized HTTP server
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP server
Kazuho Oku
 
Deep inside TOMOYO Linux
Deep inside TOMOYO LinuxDeep inside TOMOYO Linux
Deep inside TOMOYO Linux
Toshiharu Harada, Ph.D
 
Debug with termi nal r 2
Debug with termi nal  r 2Debug with termi nal  r 2
Debug with termi nal r 2
Muhammad Tanveer Aslam
 
Zvika markfeld
Zvika markfeldZvika markfeld
Zvika markfeld
Rika Shoham
 

Similar to Fluentd Hacking Guide at RubyKaigi 2014 (20)

Ltrt 30500 boot p technical note ver. 6.2
Ltrt 30500 boot p technical note ver. 6.2Ltrt 30500 boot p technical note ver. 6.2
Ltrt 30500 boot p technical note ver. 6.2
 
PHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel TourPHP Installed on IBM i - the Nickel Tour
PHP Installed on IBM i - the Nickel Tour
 
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.Kero
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.KeroOGDC 2014_Cross platform mobile game application development_Mr. Makku J.Kero
OGDC 2014_Cross platform mobile game application development_Mr. Makku J.Kero
 
OGDC 2014: Cross Platform Mobile Game Application Development
OGDC 2014: Cross Platform Mobile Game Application DevelopmentOGDC 2014: Cross Platform Mobile Game Application Development
OGDC 2014: Cross Platform Mobile Game Application Development
 
Engin object presentation 2000
Engin object presentation 2000Engin object presentation 2000
Engin object presentation 2000
 
Guiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise landGuiding Diffy to the Enterprise land
Guiding Diffy to the Enterprise land
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEGetting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
 
NTTs Journey with Openstack-final
NTTs Journey with Openstack-finalNTTs Journey with Openstack-final
NTTs Journey with Openstack-final
 
Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5Cache aware-server-push in H2O version 1.5
Cache aware-server-push in H2O version 1.5
 
Automated Deployment using Open Source
Automated Deployment using Open SourceAutomated Deployment using Open Source
Automated Deployment using Open Source
 
How to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin EcosystemHow to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin Ecosystem
 
Software Define your Current Storage with Opensource
Software Define your Current Storage with OpensourceSoftware Define your Current Storage with Opensource
Software Define your Current Storage with Opensource
 
Tekaba Manual
Tekaba ManualTekaba Manual
Tekaba Manual
 
Frontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy PersonFrontend Performance: Beginner to Expert to Crazy Person
Frontend Performance: Beginner to Expert to Crazy Person
 
H2O - the optimized HTTP server
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP server
 
Deep inside TOMOYO Linux
Deep inside TOMOYO LinuxDeep inside TOMOYO Linux
Deep inside TOMOYO Linux
 
Debug with termi nal r 2
Debug with termi nal  r 2Debug with termi nal  r 2
Debug with termi nal r 2
 
Zvika markfeld
Zvika markfeldZvika markfeld
Zvika markfeld
 

More from Naotoshi Seo

ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
Naotoshi Seo
 
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
Naotoshi Seo
 
Mobage を支える Ruby の技術 ~ 複数DB編 ~
Mobage を支える Ruby の技術 ~ 複数DB編 ~Mobage を支える Ruby の技術 ~ 複数DB編 ~
Mobage を支える Ruby の技術 ~ 複数DB編 ~Naotoshi Seo
 
InfluxDB の概要 - sonots #tokyoinfluxdb
InfluxDB の概要 - sonots #tokyoinfluxdbInfluxDB の概要 - sonots #tokyoinfluxdb
InfluxDB の概要 - sonots #tokyoinfluxdbNaotoshi Seo
 
Sinatra Pattern 20130415
Sinatra Pattern 20130415Sinatra Pattern 20130415
Sinatra Pattern 20130415Naotoshi Seo
 
Serf という Orchestration ツール #immutableinfra
Serf という Orchestration ツール #immutableinfraSerf という Orchestration ツール #immutableinfra
Serf という Orchestration ツール #immutableinfraNaotoshi Seo
 
Shadow Server on Fluentd at Fluentd Casual Talks #3
Shadow Server on Fluentd at Fluentd Casual Talks #3Shadow Server on Fluentd at Fluentd Casual Talks #3
Shadow Server on Fluentd at Fluentd Casual Talks #3Naotoshi Seo
 
Haikanko rubykaigi 20130531
Haikanko rubykaigi 20130531Haikanko rubykaigi 20130531
Haikanko rubykaigi 20130531Naotoshi Seo
 
Fluentdcasual 02-haikanko
Fluentdcasual 02-haikankoFluentdcasual 02-haikanko
Fluentdcasual 02-haikankoNaotoshi Seo
 
capistrano-colorized-stream
capistrano-colorized-streamcapistrano-colorized-stream
capistrano-colorized-streamNaotoshi Seo
 

More from Naotoshi Seo (13)

ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
ぼくのかんがえた Itamae/Serverspec 構成フレームワーク 〜 Kondate 〜
 
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
HTTP/2 でリバプロするだけでグラフツールを 高速化できた話
 
Mobage を支える Ruby の技術 ~ 複数DB編 ~
Mobage を支える Ruby の技術 ~ 複数DB編 ~Mobage を支える Ruby の技術 ~ 複数DB編 ~
Mobage を支える Ruby の技術 ~ 複数DB編 ~
 
InfluxDB の概要 - sonots #tokyoinfluxdb
InfluxDB の概要 - sonots #tokyoinfluxdbInfluxDB の概要 - sonots #tokyoinfluxdb
InfluxDB の概要 - sonots #tokyoinfluxdb
 
Sinatra Pattern 20130415
Sinatra Pattern 20130415Sinatra Pattern 20130415
Sinatra Pattern 20130415
 
Serf という Orchestration ツール #immutableinfra
Serf という Orchestration ツール #immutableinfraSerf という Orchestration ツール #immutableinfra
Serf という Orchestration ツール #immutableinfra
 
Shadow Server on Fluentd at Fluentd Casual Talks #3
Shadow Server on Fluentd at Fluentd Casual Talks #3Shadow Server on Fluentd at Fluentd Casual Talks #3
Shadow Server on Fluentd at Fluentd Casual Talks #3
 
Yohoushi
YohoushiYohoushi
Yohoushi
 
Haikanko rubykaigi 20130531
Haikanko rubykaigi 20130531Haikanko rubykaigi 20130531
Haikanko rubykaigi 20130531
 
Mina 20130417
Mina 20130417Mina 20130417
Mina 20130417
 
Fluentdcasual 02-haikanko
Fluentdcasual 02-haikankoFluentdcasual 02-haikanko
Fluentdcasual 02-haikanko
 
capistrano-colorized-stream
capistrano-colorized-streamcapistrano-colorized-stream
capistrano-colorized-stream
 
Ruby test double
Ruby test doubleRuby test double
Ruby test double
 

Recently uploaded

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 

Recently uploaded (20)

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 

Fluentd Hacking Guide at RubyKaigi 2014

  • 1. Fluentd Hacking Guide (Fluentd ソースコード完全解説) September 20th, 2014 ! Naotoshi Seo @sonots DeNA Co., Ltd. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
  • 2. 2 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Who am I? ・Naotoshi Seo @sonots ・DeNA Co, Ltd. ・Infrastructure Engineer ・Fluentd Commiter
  • 3. ⁃ An application (or a framework) to process log streaming ⁃ Powerful plugin architecture (+250 plugins) ⁃ written in Ruby Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
  • 4. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Disclaimer 4 1. I do not explain what is Fluentd, how to use Fluentd 2. I assume audiences have ever used Fluentd, have ever created Fluentd plugins, have interests inside Fluentd ! 3. Source Codes are from v0.10 branch as of September 2014
  • 5. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Topics 5 1. The bootstrap sequence of Fluentd, and how Fluentd loads plugins 2. How an input plugin passes data to output plugins 3. How BufferedOutput plugin works 4. How Fluentd parses the config file 5. The event-driven programming using cool.io, and effects of GVL
  • 6. 6 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Let's Dive into Source Codes
  • 7. 7 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. vim
  • 8. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Topics 8 1. The bootstrap sequence of Fluentd, and how Fluentd loads plugins 2. How an input plugin passes data to output plugins 3. How BufferedOutput plugin works
  • 9. The Bootstrap Sequence 9 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Fluent::Supervisor#run_configure 1. require 2. new 3. configure(conf ) Fluent::Supervisor#run_engine 4. start 5. shutdown (if signal received) Input plugin creates threads on #start Output plugin does nothing on #start (typically)
  • 10. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Topics 10 1. The bootstrap sequence of Fluentd, and how Fluentd loads plugins 2. How an input plugin passes data to output plugins 3. How BufferedOutput plugin works
  • 11. Dataflow from Input to Output 11 Input Engine Output Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. emit(tag, es) emit(tag, es) If an input thread receives data, call Engine.emit
  • 12. CAUTION: Output Plugin 12 Input Engine Output Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. emit(tag, es) emit(tag, es) BLOCK!!! Can not receive new input during blocking ex) HTTP POST
  • 13. 13 Use BufferedOutput Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. to avoid blocking
  • 14. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Topics 14 1. The bootstrap sequence of Fluentd, and how Fluentd loads plugins 2. How an input plugin passes data to output plugins 3. How BufferedOutput plugin works
  • 15. BufferedOutput Plugin Input Engine BufferedOutput BasicBuffer 15 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. emit(tag,es) emit(tag,es) emit(tag,data) enqueue immediately return!! Can receive new input. No blocking.
  • 16. BufferedOutput Plugin 16 BufferedOutput BasicBuffer Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. try_flush (push) OutputThread pop write(chunk) do some EXPENSIVE things Run heavy processing in OTHER threads
  • 17. CAUTION: BufferedOutput 17 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Stuck if enqueued over its capability ! HOW TO IMPROVE 1. Increase num_threads 2. Enlarge buffer_chunk_limit 3. Set smaller queued_chunk_flush_interval, try_flush_interval (Secret parameters)
  • 18. 18 Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. But,
  • 19. 19 Improving actual processing throughputs is most important fluent-plugin-elasticsearch gets stuck? Then, tune Elasticsearch! Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved.
  • 20. Copyright (C) 2014 DeNA Co.,Ltd. All Rights Reserved. Conclusion 20 1. Output plugin blocks 2. BufferedOutput does not block, but stuck if enqueued over its capability • Tune with option parameters such as num_threads 3. In either case, improving actual processing capability itself is most important!! 4. I am happy if this talk helps your operation, your plugin development, and contributions