SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Downloaden Sie, um offline zu lesen
Fluency
Yet another fluent logger
Mitsunori Komatsu
About me
• Mitsunori Komatsu, 

Software engineer
• github:komamitsu

msgpack-java

(jackson-dataformat-msgpack),

fluent-logger-java,

digdag,

:
Today’s talk
• What's Fluency?
• Internal design
• Performance and profiling
• Future improvements
Fluentd
What’s Fluency?
• Yet another fluent-logger-java

(https://github.com/komamitsu/fluency)
• 3x 4x faster than fluent-logger using
PackedForward format
• Easy to extend
• Many features

(Async flush, HB, Failover, Ack response)
• Used in LINE, Treasure Data, kafka-fluentd-consumer
Internal design
• Asynchronous flushing
• Buffering PackedForward format
data
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Async flushing
Application Fluency Buffer FluentdFlusher
emit(event:A) append(event:A)
emit(event:B) append(event:B)
store events as
MessagePack
flush
send(event:[A, B])
emit(event:C) append(event:C)
flush
invoked
repeatedly
PackedForward
format
close close
force flush
emit(event:D) append(event:D)
send(event:[C,D])
event:C isn’t
ready for flush
event:A,B are
ready for flush
terminate
thread
Buffering events
tag: aaa,
time: 100,
{name: a_0}
Buffer
pool
retention buffers
flushable buffers
Fluentd
emit event
acquire buffer
Buffering events
tag: bbb,
time: 101,
{name: b_0}
Buffer
pool
time: 100, {name: a_0}
retention buffers
flushable buffers
tag: aaa
Fluentd
emit event
acquire buffer
Buffering events
tag: ccc,
time: 102,
{name: c_0}
Buffer
pool
time: 100, {name: a_0} time: 101, {name: b_0}
retention buffers
flushable buffers
tag: aaa tag: bbb
Fluentd
emit event
acquire buffer
Buffering events
tag: aaa,
time: 110,
{name: a_1}
Buffer
pool
time: 100, {name: a_0} time: 101, {name: b_0} time: 102, {name: c_0}
retention buffers
flushable buffers
tag: aaa tag: bbb tag: ccc
Fluentd
emit event
Buffering events
tag: aaa,
time: 120,
{name: a_2}
Buffer
pool
time: 100, {name: a_0}
time: 110, {name: a_1}
time: 101, {name: b_0} time: 102, {name: c_0}
retention buffers
flushable buffers
tag: aaa tag: bbb tag: ccc
Fluentd
emit event
expand buffer
Buffering events
tag: bbb,
time: 111,
{name: b_1}
:
:
Buffer
pool
time: 100, {name: a_0}
time: 110, {name: a_1}
time: 120, {name: a_2}
time: 101, {name: b_0} time: 102, {name: c_0}
retention buffers
flushable buffers
tag: aaa tag: bbb tag: ccc
Fluentd
emit event
Buffering events
tag: aaa,
time: 200,
{name: a_0}
Buffer
pool
time: 100, {name: a_0}
time: 110, {name: a_1}
time: 120, {name: a_2}
time: 130, {name: a_3}
time: 101, {name: b_0}
time: 111, {name: b_1}
time: 121, {name: b_2}
time: 131, {name: b_3}
time: 102, {name: c_0}
time: 112, {name: c_1}
retention buffers
flushable buffers
tag: aaa tag: bbb tag: ccc
Fluentd
emit event
move buffers
(zero copy)
tag: aaa
Buffering events
tag: ccc,
time: 122,
{name: c_2}
Buffer
pool
time: 200, {name: a_0} time: 102, {name: c_0}
time: 112, {name: c_1}
retention buffers
flushable buffers
tag: aaa tag: ccc
time: 100, {name: a_0}
time: 110, {name: a_1}
time: 120, {name: a_2}
time: 130, {name: a_3}
Fluentd
tag: bbb
time: 101, {name: b_0}
time: 111, {name: b_1}
time: 121, {name: b_2}
time: 131, {name: b_3}
emit event
expand buffer
send buffer
return buffer
(after sending)
PackedForword
format
Buffering events
tag: bbb,
time: 201,
{name: b_0}
Buffer
pool
time: 200, {name: a_0} time: 102, {name: c_0}
time: 112, {name: c_1}
retention buffers
flushable buffers
tag: aaa tag: ccc
Fluentd
tag: bbb
time: 101, {name: b_0}
time: 111, {name: b_1}
time: 121, {name: b_2}
time: 131, {name: b_3}
time: 122, {name: c_2}
emit event
send buffer
return buffer
(after sending)
acquire buffer
PackedForword
format
Buffering events
tag: aaa,
time: 210,
{name: a_1}
Buffer
pool
time: 200, {name: a_0} time: 102, {name: c_0}
time: 112, {name: c_1}
retention buffers
flushable buffers
tag: aaa tag: ccc
Fluentd
time: 122, {name: c_2}
time: 201, {name: b_0}
tag: bbb
emit event
4x faster than

fluent-logger-java
fluency / fluent-logger-java: m3.large
fluentd: m3.large
See details: https://gist.github.com/komamitsu/c1e4045fe2ddb108cfbf12d5f014b683
But the actual
bottleneck
of this benchmark
might be Fluentd…
Java profiling (1/2)
fluency fluent-logger-java
fluency uses off heap
for buffer pool
Due to synchronization
Java profiling (2/2)
fluency fluent-logger-java
GC Pause: 33ms/s GC Pause: 7ms/s
Finding a bottleneck
fluency
emit (MessagePack
serialization & appending to
buffer) accounts for most of
the duration
String.getBytes in
MessagePack serialization
takes total 18%
ObjectMapper.writeValue
itself takes 40%
Finding a bottleneck
fluency
MessagePackGenerator.
writeStartArray takes 10%
java.nio.channels.SocketCh
annel.write and
java.nio.ByteBuffer.allocate
Direct are both 0-1%
Finding a bottleneck
fluent-logger-java
Sending events via socket
accounts for most of the
duration
Future improvements:
removing ObjectMapper
ObjectMapper
can be removed
to improve
performance?
Hmm. But Fluency
accepts Jackson
Modules…
Future improvements:
reducing use of ObjectMapper
ObjectMapper is needed only for
serialisation of data not array
Thanks!

Weitere ähnliche Inhalte

Was ist angesagt?

Device-specific Clang Tooling for Embedded Systems
Device-specific Clang Tooling for Embedded SystemsDevice-specific Clang Tooling for Embedded Systems
Device-specific Clang Tooling for Embedded Systems
emBO_Conference
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
unodelostrece
 

Was ist angesagt? (20)

Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
Video Transcoding at the ABC with Microservices at GOTO Chicago
Video Transcoding at the ABC with Microservices at GOTO ChicagoVideo Transcoding at the ABC with Microservices at GOTO Chicago
Video Transcoding at the ABC with Microservices at GOTO Chicago
 
This is not your father's monitoring.
This is not your father's monitoring.This is not your father's monitoring.
This is not your father's monitoring.
 
Device-specific Clang Tooling for Embedded Systems
Device-specific Clang Tooling for Embedded SystemsDevice-specific Clang Tooling for Embedded Systems
Device-specific Clang Tooling for Embedded Systems
 
Artimon - Apache Flume (incubating) NYC Meetup 20111108
Artimon - Apache Flume (incubating) NYC Meetup 20111108Artimon - Apache Flume (incubating) NYC Meetup 20111108
Artimon - Apache Flume (incubating) NYC Meetup 20111108
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 
InfluxData Platform Future and Vision
InfluxData Platform Future and VisionInfluxData Platform Future and Vision
InfluxData Platform Future and Vision
 
Video Transcoding at Scale for ABC iview (NDC Sydney)
Video Transcoding at Scale for ABC iview (NDC Sydney)Video Transcoding at Scale for ABC iview (NDC Sydney)
Video Transcoding at Scale for ABC iview (NDC Sydney)
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
 
CPAN 模組二三事
CPAN 模組二三事CPAN 模組二三事
CPAN 模組二三事
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )
 
Inside the ABC's new Media Transcoding system, Metro
Inside the ABC's new Media Transcoding system, MetroInside the ABC's new Media Transcoding system, Metro
Inside the ABC's new Media Transcoding system, Metro
 
Stream or not to Stream?

Stream or not to Stream?
Stream or not to Stream?

Stream or not to Stream?

 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係
 
Perl Memory Use 201209
Perl Memory Use 201209Perl Memory Use 201209
Perl Memory Use 201209
 
Redis as a message queue
Redis as a message queueRedis as a message queue
Redis as a message queue
 
Zendcon 2007 Api Design
Zendcon 2007 Api DesignZendcon 2007 Api Design
Zendcon 2007 Api Design
 
Perl Memory Use - LPW2013
Perl Memory Use - LPW2013Perl Memory Use - LPW2013
Perl Memory Use - LPW2013
 
Deferred Gratification
Deferred GratificationDeferred Gratification
Deferred Gratification
 

Ähnlich wie Fluency - Yet another fluent logger

Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Emery Berger
 
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
StreamNative
 
Developing with Cassandra
Developing with CassandraDeveloping with Cassandra
Developing with Cassandra
Sperasoft
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
崇之 清水
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 

Ähnlich wie Fluency - Yet another fluent logger (20)

Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
 
Node.js - Advanced Basics
Node.js - Advanced BasicsNode.js - Advanced Basics
Node.js - Advanced Basics
 
Apache Kafka Demo
Apache Kafka DemoApache Kafka Demo
Apache Kafka Demo
 
Timelapse: interactive record/replay for the web
Timelapse: interactive record/replay for the webTimelapse: interactive record/replay for the web
Timelapse: interactive record/replay for the web
 
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
Exactly-Once Made Easy: Transactional Messaging in Apache Pulsar - Pulsar Sum...
 
Data Pipeline at Tapad
Data Pipeline at TapadData Pipeline at Tapad
Data Pipeline at Tapad
 
Message reliability in kafka
Message reliability in kafkaMessage reliability in kafka
Message reliability in kafka
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
 
Developing with Cassandra
Developing with CassandraDeveloping with Cassandra
Developing with Cassandra
 
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜 AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
AWS SDK for PHP のインストールから 始めるクラウドマスターへの道 〜 Promise による非同期オペレーション 〜
 
Concurrency at the Database Layer
Concurrency at the Database Layer Concurrency at the Database Layer
Concurrency at the Database Layer
 
The Future of Apache Storm
The Future of Apache StormThe Future of Apache Storm
The Future of Apache Storm
 
Parse, scale to millions
Parse, scale to millionsParse, scale to millions
Parse, scale to millions
 
The Nuts and Bolts of Kafka Streams---An Architectural Deep Dive
The Nuts and Bolts of Kafka Streams---An Architectural Deep DiveThe Nuts and Bolts of Kafka Streams---An Architectural Deep Dive
The Nuts and Bolts of Kafka Streams---An Architectural Deep Dive
 
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
 
Scaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approachScaling python webapps from 0 to 50 million users - A top-down approach
Scaling python webapps from 0 to 50 million users - A top-down approach
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
Logging for Production Systems in The Container Era
Logging for Production Systems in The Container EraLogging for Production Systems in The Container Era
Logging for Production Systems in The Container Era
 
Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]Embedding Generic Monadic Transformer into Scala. [Tfp2022]
Embedding Generic Monadic Transformer into Scala. [Tfp2022]
 
Building a Versatile Analytics Pipeline on Top of Apache Spark with Mikhail C...
Building a Versatile Analytics Pipeline on Top of Apache Spark with Mikhail C...Building a Versatile Analytics Pipeline on Top of Apache Spark with Mikhail C...
Building a Versatile Analytics Pipeline on Top of Apache Spark with Mikhail C...
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Kürzlich hochgeladen (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Fluency - Yet another fluent logger

  • 1. Fluency Yet another fluent logger Mitsunori Komatsu
  • 2. About me • Mitsunori Komatsu, 
 Software engineer • github:komamitsu
 msgpack-java
 (jackson-dataformat-msgpack),
 fluent-logger-java,
 digdag,
 :
  • 3. Today’s talk • What's Fluency? • Internal design • Performance and profiling • Future improvements
  • 5. What’s Fluency? • Yet another fluent-logger-java
 (https://github.com/komamitsu/fluency) • 3x 4x faster than fluent-logger using PackedForward format • Easy to extend • Many features
 (Async flush, HB, Failover, Ack response) • Used in LINE, Treasure Data, kafka-fluentd-consumer
  • 6. Internal design • Asynchronous flushing • Buffering PackedForward format data
  • 7. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 8. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 9. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 10. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 11. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 12. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 13. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 14. Async flushing Application Fluency Buffer FluentdFlusher emit(event:A) append(event:A) emit(event:B) append(event:B) store events as MessagePack flush send(event:[A, B]) emit(event:C) append(event:C) flush invoked repeatedly PackedForward format close close force flush emit(event:D) append(event:D) send(event:[C,D]) event:C isn’t ready for flush event:A,B are ready for flush terminate thread
  • 15. Buffering events tag: aaa, time: 100, {name: a_0} Buffer pool retention buffers flushable buffers Fluentd emit event acquire buffer
  • 16. Buffering events tag: bbb, time: 101, {name: b_0} Buffer pool time: 100, {name: a_0} retention buffers flushable buffers tag: aaa Fluentd emit event acquire buffer
  • 17. Buffering events tag: ccc, time: 102, {name: c_0} Buffer pool time: 100, {name: a_0} time: 101, {name: b_0} retention buffers flushable buffers tag: aaa tag: bbb Fluentd emit event acquire buffer
  • 18. Buffering events tag: aaa, time: 110, {name: a_1} Buffer pool time: 100, {name: a_0} time: 101, {name: b_0} time: 102, {name: c_0} retention buffers flushable buffers tag: aaa tag: bbb tag: ccc Fluentd emit event
  • 19. Buffering events tag: aaa, time: 120, {name: a_2} Buffer pool time: 100, {name: a_0} time: 110, {name: a_1} time: 101, {name: b_0} time: 102, {name: c_0} retention buffers flushable buffers tag: aaa tag: bbb tag: ccc Fluentd emit event expand buffer
  • 20. Buffering events tag: bbb, time: 111, {name: b_1} : : Buffer pool time: 100, {name: a_0} time: 110, {name: a_1} time: 120, {name: a_2} time: 101, {name: b_0} time: 102, {name: c_0} retention buffers flushable buffers tag: aaa tag: bbb tag: ccc Fluentd emit event
  • 21. Buffering events tag: aaa, time: 200, {name: a_0} Buffer pool time: 100, {name: a_0} time: 110, {name: a_1} time: 120, {name: a_2} time: 130, {name: a_3} time: 101, {name: b_0} time: 111, {name: b_1} time: 121, {name: b_2} time: 131, {name: b_3} time: 102, {name: c_0} time: 112, {name: c_1} retention buffers flushable buffers tag: aaa tag: bbb tag: ccc Fluentd emit event move buffers (zero copy)
  • 22. tag: aaa Buffering events tag: ccc, time: 122, {name: c_2} Buffer pool time: 200, {name: a_0} time: 102, {name: c_0} time: 112, {name: c_1} retention buffers flushable buffers tag: aaa tag: ccc time: 100, {name: a_0} time: 110, {name: a_1} time: 120, {name: a_2} time: 130, {name: a_3} Fluentd tag: bbb time: 101, {name: b_0} time: 111, {name: b_1} time: 121, {name: b_2} time: 131, {name: b_3} emit event expand buffer send buffer return buffer (after sending) PackedForword format
  • 23. Buffering events tag: bbb, time: 201, {name: b_0} Buffer pool time: 200, {name: a_0} time: 102, {name: c_0} time: 112, {name: c_1} retention buffers flushable buffers tag: aaa tag: ccc Fluentd tag: bbb time: 101, {name: b_0} time: 111, {name: b_1} time: 121, {name: b_2} time: 131, {name: b_3} time: 122, {name: c_2} emit event send buffer return buffer (after sending) acquire buffer PackedForword format
  • 24. Buffering events tag: aaa, time: 210, {name: a_1} Buffer pool time: 200, {name: a_0} time: 102, {name: c_0} time: 112, {name: c_1} retention buffers flushable buffers tag: aaa tag: ccc Fluentd time: 122, {name: c_2} time: 201, {name: b_0} tag: bbb emit event
  • 25. 4x faster than
 fluent-logger-java fluency / fluent-logger-java: m3.large fluentd: m3.large See details: https://gist.github.com/komamitsu/c1e4045fe2ddb108cfbf12d5f014b683 But the actual bottleneck of this benchmark might be Fluentd…
  • 26. Java profiling (1/2) fluency fluent-logger-java fluency uses off heap for buffer pool Due to synchronization
  • 27. Java profiling (2/2) fluency fluent-logger-java GC Pause: 33ms/s GC Pause: 7ms/s
  • 28. Finding a bottleneck fluency emit (MessagePack serialization & appending to buffer) accounts for most of the duration String.getBytes in MessagePack serialization takes total 18% ObjectMapper.writeValue itself takes 40%
  • 29. Finding a bottleneck fluency MessagePackGenerator. writeStartArray takes 10% java.nio.channels.SocketCh annel.write and java.nio.ByteBuffer.allocate Direct are both 0-1%
  • 30. Finding a bottleneck fluent-logger-java Sending events via socket accounts for most of the duration
  • 31. Future improvements: removing ObjectMapper ObjectMapper can be removed to improve performance? Hmm. But Fluency accepts Jackson Modules…
  • 32. Future improvements: reducing use of ObjectMapper ObjectMapper is needed only for serialisation of data not array