SlideShare a Scribd company logo
1 of 20
Download to read offline
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 MoreSadayuki 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 WorldSATOSHI TAGOMORI
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsSATOSHI TAGOMORI
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellN Masahiro
 
Fluentd v0.14 Overview
Fluentd v0.14 OverviewFluentd v0.14 Overview
Fluentd v0.14 OverviewN Masahiro
 
Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12Dive into Fluentd plugin v0.12
Dive into Fluentd plugin v0.12N Masahiro
 
Fluentd v1 and future at techtalk
Fluentd v1 and future at techtalkFluentd v1 and future at techtalk
Fluentd v1 and future at techtalkN Masahiro
 
Fluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At FossasiaFluentd Unified Logging Layer At Fossasia
Fluentd Unified Logging Layer At FossasiaN Masahiro
 
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 supportRitta Narita
 
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 P4Kentaro 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
 

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 trendsHyunmyung Kim
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJinho 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.2charlyalize
 
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 TourRod 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 2000Mal 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 PersonPhilip 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 XEIntel Software Brasil
 
NTTs Journey with Openstack-final
NTTs Journey with Openstack-finalNTTs Journey with Openstack-final
NTTs Journey with Openstack-finalshintaro 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.5Kazuho Oku
 
Automated Deployment using Open Source
Automated Deployment using Open SourceAutomated Deployment using Open Source
Automated Deployment using Open Sourceduskglow
 
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 EcosystemInfluxData
 
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 OpensourceAntonio Romeo
 
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 PersonPhilip Tellis
 
H2O - the optimized HTTP server
H2O - the optimized HTTP serverH2O - the optimized HTTP server
H2O - the optimized HTTP serverKazuho Oku
 

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

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 

Recently uploaded (20)

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 

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