Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Cloud(Alibaba Group)

Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Cloud(Alibaba Group)
Are Your V8 Garbage Collection Logs
Speaking to You?
Joyee Cheung, Alibaba Cloud
What Prompted us to Look into them
Node.js at Alibaba
What Prompted Us to Look Into Them
Why GC Logs?
v Java is the mainstream at Alibaba
v Chose Node.js for productivity, but it’s meaningless without availability
v Usually not the bottleneck, but with a huge traffic, every optimization counts
v Garbage collection is important in long-running, data-intensive servers
v High CPU usage: hurts responsiveness
v High memory usage: affects other processes
v Memory leaks: misled by developers, crashes the process(OOM)
v Java developers know their VM and its GC
v …
v More about Node.js at Alibaba
v https://www.linux.com/blog/can-nodejs-scale-ask-team-alibaba
What Prompted Us to Look Into Them
Why GC Logs?
v Tools from V8/Chromium are more about optimizing frontend applications
CPU profiles are
more about function calls,
less about objects
v Heap snapshots and timelines are more
about allocations, less about collections
v Lack of high-level overview of the heap, too
much details
Hard to use in staging/production environment
What Prompted Us to Look Into Them
Why GC Logs?
v V8 provides garbage collection logs
v Not documented, not available in the devtools, need to use command line args
v Higher-level than heap profiles, lower-level than the number of memory usuage
v Help verify the fixes by displaying patterns of GC
v Not silver bullet, but nice to have
v This talk is based on the versions of V8 used by Node v4 & v6 LTS
v LTS plan stablizes the V8 versions for each LTS and its GC logs
An Introduction to V8 GC
What is Garbage Collection
An Introduction to V8 GC
How Most GCs are triggered
An Introduction to V8 GC
Stop-The-World, Parallel, Concurrent GC
An Introduction to V8 GC
Generational GC
An Introduction to V8 GC
Heap Organization
An Introduction to V8 GC
Heap Limits(Default)
v deps/v8/src/heap/heap.h: Heap::Heap()
16MB
1MB
1.4GB
0.7GB
512MB
v Can be configured via command line arguments
v --max_old_space_size, --max_semi_space_size, --max_executable_space_size
An Introduction to V8 GC
New Generation – Scavenge GC
An Introduction to V8 GC
Old Generation – Mark-Sweep/Compact GC
An Introduction to V8 GC
GC Pauses in V8
How to Get The GC Logs
v Plenty of options (node --v8-options| grep gc)
v We’ll be focusing on
v --trace_gc
v Print a line briefly describing when, how, what and why for each GC
v --trace_gc_verbose
v Combined with --trace_gc, summarizes about each space and the
heap after each GC
v --trace_gc_nvp
v Print name-value pairs describing how each step of GC goes
v In case you do want to read the code
v deps/v8/src/heap, start with gc-tracer.cc
How to Read The GC Logs
v --trace_gc
WHERE: [PID:Isolate]
WHEN: Time since the process has started
WHAT: Type of GC
HOW MUCH:
Size of all objects(Size of memory allocated from OS)
HOW LONG:
GC pause/Time spent on external memory
WHY
How to Read The GC Logs
v --trace_gc_verbose && --trace_gc
Memory V8 allocated from the OS
All memory reserved for
this space (inside
dedicated pages)
Maintained by external C++ code
Adjust heap growing factor and the allocation limit
that triggers the next incremental marking
How to Read The GC Logs
v --trace_gc_nvp ms=Mark-Sweep, s=Scavenge
What We’ve Found
v Tons of Scavenge GC in New Space eating up the CPU
v Cache misses caused by inappropriate caching strategies
v Excessive deep clones/object merging
v Large Object Space keeps growing
v Serialization/deserialization of huge RPC payload
v Code Space keeps growing
v Bugs in templating engines
v Old Space keeps growing
v Closures in long connections
Tools
v Our parser
v Up on NPM
v For people who already have
applications running in production
https://github.com/aliyun-node/v8-gc-log-parser
http://alinode.aliyun.com/blog
(translation coming soon)
Visualization coming soon!
Tools
v --trace_gc_object_stats
v Feed the output to https://mlippautz.github.io/v8-heap-stats/
v Requires Node >= v7
v More about the memory usuage, less about GC
v --track_gc_object_stats
v Combined with --log_timer_events, writes a log file to disk
v Can be viewed with chrome://tracing (Incomplete???)
v Pending PR: https://github.com/nodejs/node/pull/9304
THANKS
Twitter/Github: @joyeecheung
joyeec9h3@gmail.com
https://alinode.aliyun.com
An Introduction to V8 GC
Accurate GC
1 of 24

Recommended

HTML 5 Canvas & SVG by
HTML 5 Canvas & SVGHTML 5 Canvas & SVG
HTML 5 Canvas & SVGOfir's Fridman
1.3K views22 slides
Intro to Amazon S3 by
Intro to Amazon S3Intro to Amazon S3
Intro to Amazon S3Yu Lun Teo
20.5K views16 slides
How to act on security and compliance alerts with AWS Security Hub - SEC202 -... by
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...How to act on security and compliance alerts with AWS Security Hub - SEC202 -...
How to act on security and compliance alerts with AWS Security Hub - SEC202 -...Amazon Web Services
1.2K views35 slides
Nginx dhruba mandal by
Nginx dhruba mandalNginx dhruba mandal
Nginx dhruba mandalDhrubaji Mandal ♛
2.6K views34 slides
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018 by
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018
Deep Dive on Amazon Neptune (DAT403) - AWS re:Invent 2018Amazon Web Services
3K views41 slides
Introduction to JSON & AJAX by
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAXCollaboration Technologies
881 views17 slides

More Related Content

What's hot

Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur... by
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...Jean-Philippe BEMPEL
311 views73 slides
Laravelの認証について by
Laravelの認証についてLaravelの認証について
Laravelの認証についてTakeo Noda
7.5K views28 slides
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション by
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッションEnpel
11.1K views14 slides
AWS Security by Design by
AWS Security by Design AWS Security by Design
AWS Security by Design Amazon Web Services
3.1K views61 slides
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A... by
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Amazon Web Services
2.2K views36 slides
Storage Virtualization by
Storage VirtualizationStorage Virtualization
Storage VirtualizationMehul Jariwala
2.6K views20 slides

What's hot(20)

Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur... by Jean-Philippe BEMPEL
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...
Laravelの認証について by Takeo Noda
Laravelの認証についてLaravelの認証について
Laravelの認証について
Takeo Noda7.5K views
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション by Enpel
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション
2 TomcatによるWebアプリケーションサーバ構築 第2章 Tomcat概要(2)-セッション
Enpel11.1K views
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A... by Amazon Web Services
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Amazon Web Services2.2K views
Behind the Scenes: Exploring the AWS Global Network (NET305) - AWS re:Invent ... by Amazon Web Services
Behind the Scenes: Exploring the AWS Global Network (NET305) - AWS re:Invent ...Behind the Scenes: Exploring the AWS Global Network (NET305) - AWS re:Invent ...
Behind the Scenes: Exploring the AWS Global Network (NET305) - AWS re:Invent ...
Amazon Web Services42.6K views
Landing Zones - Creating a Foundation for Your AWS Migrations by Amazon Web Services
Landing Zones - Creating a Foundation for Your AWS MigrationsLanding Zones - Creating a Foundation for Your AWS Migrations
Landing Zones - Creating a Foundation for Your AWS Migrations
Amazon Web Services1.5K views
Apache MXNet/Gluon으로 쉽고 빠르게 구현하는 딥러닝 (정승환, SK텔레콤) :: AWS DevDay 2018 by Amazon Web Services Korea
Apache MXNet/Gluon으로 쉽고 빠르게 구현하는 딥러닝 (정승환, SK텔레콤) :: AWS DevDay 2018Apache MXNet/Gluon으로 쉽고 빠르게 구현하는 딥러닝 (정승환, SK텔레콤) :: AWS DevDay 2018
Apache MXNet/Gluon으로 쉽고 빠르게 구현하는 딥러닝 (정승환, SK텔레콤) :: AWS DevDay 2018
NGINX ADC: Basics and Best Practices by NGINX, Inc.
NGINX ADC: Basics and Best PracticesNGINX ADC: Basics and Best Practices
NGINX ADC: Basics and Best Practices
NGINX, Inc.971 views
(CMP201) All You Need To Know About Auto Scaling by Amazon Web Services
(CMP201) All You Need To Know About Auto Scaling(CMP201) All You Need To Know About Auto Scaling
(CMP201) All You Need To Know About Auto Scaling
Amazon Web Services8.1K views
Exploring Contact Lens and Amazon Connect by CloudHesive
Exploring Contact Lens and Amazon ConnectExploring Contact Lens and Amazon Connect
Exploring Contact Lens and Amazon Connect
CloudHesive141 views
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy by Amit Aggarwal
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Amit Aggarwal2.9K views
Serverless Architecture and Best Practices by Amazon Web Services
Serverless Architecture and Best PracticesServerless Architecture and Best Practices
Serverless Architecture and Best Practices
Amazon Web Services160.9K views
AWSサービスで実現するEightの行動ログ活用基盤 by Tetsuya Mase
AWSサービスで実現するEightの行動ログ活用基盤AWSサービスで実現するEightの行動ログ活用基盤
AWSサービスで実現するEightの行動ログ活用基盤
Tetsuya Mase12.8K views
EC2のストレージどう使う? -Instance Storageを理解して高速IOを上手に活用!- by Yuta Imai
EC2のストレージどう使う? -Instance Storageを理解して高速IOを上手に活用!-EC2のストレージどう使う? -Instance Storageを理解して高速IOを上手に活用!-
EC2のストレージどう使う? -Instance Storageを理解して高速IOを上手に活用!-
Yuta Imai42.1K views
AWS Black Belt Tech シリーズ 2015 - Amazon Elastic MapReduce by Amazon Web Services Japan
AWS Black Belt Tech シリーズ 2015 - Amazon Elastic MapReduceAWS Black Belt Tech シリーズ 2015 - Amazon Elastic MapReduce
AWS Black Belt Tech シリーズ 2015 - Amazon Elastic MapReduce

Similar to Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Cloud(Alibaba Group)

Where should I run my code? Serverless, Containers, Virtual Machines and more by
Where should I run my code? Serverless, Containers, Virtual Machines and moreWhere should I run my code? Serverless, Containers, Virtual Machines and more
Where should I run my code? Serverless, Containers, Virtual Machines and moreBret McGowen - NYC Google Developer Advocate
800 views100 slides
[Outdated] Secrets of Performance Tuning Java on Kubernetes by
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on KubernetesBruno Borges
1.6K views27 slides
Implementing data and databases on K8s within the Dutch government by
Implementing data and databases on K8s within the Dutch governmentImplementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch governmentDoKC
39 views68 slides
OOPs, OOMs, oh my! Containerizing JVM apps by
OOPs, OOMs, oh my! Containerizing JVM appsOOPs, OOMs, oh my! Containerizing JVM apps
OOPs, OOMs, oh my! Containerizing JVM appsSematext Group, Inc.
1.5K views25 slides
Java Performance and Using Java Flight Recorder by
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight RecorderIsuru Perera
2.5K views62 slides
Jvm problem diagnostics by
Jvm problem diagnosticsJvm problem diagnostics
Jvm problem diagnosticsDanijel Mitar
634 views23 slides

Similar to Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Cloud(Alibaba Group)(20)

[Outdated] Secrets of Performance Tuning Java on Kubernetes by Bruno Borges
[Outdated] Secrets of Performance Tuning Java on Kubernetes[Outdated] Secrets of Performance Tuning Java on Kubernetes
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges1.6K views
Implementing data and databases on K8s within the Dutch government by DoKC
Implementing data and databases on K8s within the Dutch governmentImplementing data and databases on K8s within the Dutch government
Implementing data and databases on K8s within the Dutch government
DoKC39 views
Java Performance and Using Java Flight Recorder by Isuru Perera
Java Performance and Using Java Flight RecorderJava Performance and Using Java Flight Recorder
Java Performance and Using Java Flight Recorder
Isuru Perera2.5K views
Secrets of Performance Tuning Java on Kubernetes by Bruno Borges
Secrets of Performance Tuning Java on KubernetesSecrets of Performance Tuning Java on Kubernetes
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges3K views
this-is-garbage-talk-2022.pptx by Tier1 app
this-is-garbage-talk-2022.pptxthis-is-garbage-talk-2022.pptx
this-is-garbage-talk-2022.pptx
Tier1 app122 views
Вячеслав Блинов «Java Garbage Collection: A Performance Impact» by Anna Shymchenko
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko574 views
Вячеслав Блинов «Java Garbage Collection: A Performance Impact» by Anna Shymchenko
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko569 views
millions-gc-jax-2022.pptx by Tier1 app
millions-gc-jax-2022.pptxmillions-gc-jax-2022.pptx
millions-gc-jax-2022.pptx
Tier1 app141 views
Taming Java Garbage Collector by Daya Atapattu
Taming Java Garbage CollectorTaming Java Garbage Collector
Taming Java Garbage Collector
Daya Atapattu979 views
Java Performance and Profiling by WSO2
Java Performance and ProfilingJava Performance and Profiling
Java Performance and Profiling
WSO22.3K views
Build optimization mechanisms in GitLab and Docker by Dmytro Patkovskyi
Build optimization mechanisms in GitLab and DockerBuild optimization mechanisms in GitLab and Docker
Build optimization mechanisms in GitLab and Docker
Dmytro Patkovskyi409 views
Caching and tuning fun for high scalability @ FOSDEM 2012 by Wim Godden
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
Wim Godden11.3K views
Introduction to Real Time Java by Deniz Oguz
Introduction to Real Time JavaIntroduction to Real Time Java
Introduction to Real Time Java
Deniz Oguz5.3K views
Cloud native IPC for Microservices Workshop @ Containerdays 2022 by QAware GmbH
Cloud native IPC for Microservices Workshop @ Containerdays 2022Cloud native IPC for Microservices Workshop @ Containerdays 2022
Cloud native IPC for Microservices Workshop @ Containerdays 2022
QAware GmbH20 views
Memory Management: What You Need to Know When Moving to Java 8 by AppDynamics
Memory Management: What You Need to Know When Moving to Java 8Memory Management: What You Need to Know When Moving to Java 8
Memory Management: What You Need to Know When Moving to Java 8
AppDynamics34.6K views

More from NodejsFoundation

The Morality of Code - Glen Goodwin, SAS Institute, inc. by
The Morality of Code - Glen Goodwin, SAS Institute, inc.The Morality of Code - Glen Goodwin, SAS Institute, inc.
The Morality of Code - Glen Goodwin, SAS Institute, inc.NodejsFoundation
488 views45 slides
Math in V8 is Broken and How We Can Fix It - Athan Reines, Fourier by
Math in V8 is Broken and How We Can Fix It - Athan Reines, FourierMath in V8 is Broken and How We Can Fix It - Athan Reines, Fourier
Math in V8 is Broken and How We Can Fix It - Athan Reines, FourierNodejsFoundation
635 views48 slides
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0 by
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0NodejsFoundation
842 views48 slides
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon... by
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...NodejsFoundation
1.3K views23 slides
Node's Event Loop From the Inside Out - Sam Roberts, IBM by
Node's Event Loop From the Inside Out - Sam Roberts, IBMNode's Event Loop From the Inside Out - Sam Roberts, IBM
Node's Event Loop From the Inside Out - Sam Roberts, IBMNodejsFoundation
961 views24 slides
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, Bustle by
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, BustleHitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, Bustle
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, BustleNodejsFoundation
736 views93 slides

More from NodejsFoundation(20)

The Morality of Code - Glen Goodwin, SAS Institute, inc. by NodejsFoundation
The Morality of Code - Glen Goodwin, SAS Institute, inc.The Morality of Code - Glen Goodwin, SAS Institute, inc.
The Morality of Code - Glen Goodwin, SAS Institute, inc.
NodejsFoundation488 views
Math in V8 is Broken and How We Can Fix It - Athan Reines, Fourier by NodejsFoundation
Math in V8 is Broken and How We Can Fix It - Athan Reines, FourierMath in V8 is Broken and How We Can Fix It - Athan Reines, Fourier
Math in V8 is Broken and How We Can Fix It - Athan Reines, Fourier
NodejsFoundation635 views
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0 by NodejsFoundation
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0
Real-Life Node.js Troubleshooting - Damian Schenkelman, Auth0
NodejsFoundation842 views
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon... by NodejsFoundation
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...
Real-Time Machine Learning with Node.js - Philipp Burckhardt, Carnegie Mellon...
NodejsFoundation1.3K views
Node's Event Loop From the Inside Out - Sam Roberts, IBM by NodejsFoundation
Node's Event Loop From the Inside Out - Sam Roberts, IBMNode's Event Loop From the Inside Out - Sam Roberts, IBM
Node's Event Loop From the Inside Out - Sam Roberts, IBM
NodejsFoundation961 views
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, Bustle by NodejsFoundation
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, BustleHitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, Bustle
Hitchhiker's Guide to"'Serverless" Javascript - Steven Faulkner, Bustle
NodejsFoundation736 views
Nodifying the Enterprise - Prince Soni, TO THE NEW by NodejsFoundation
Nodifying the Enterprise - Prince Soni, TO THE NEWNodifying the Enterprise - Prince Soni, TO THE NEW
Nodifying the Enterprise - Prince Soni, TO THE NEW
NodejsFoundation353 views
Workshop: Science Meets Industry: Online Behavioral Experiments with nodeGame... by NodejsFoundation
Workshop: Science Meets Industry: Online Behavioral Experiments with nodeGame...Workshop: Science Meets Industry: Online Behavioral Experiments with nodeGame...
Workshop: Science Meets Industry: Online Behavioral Experiments with nodeGame...
NodejsFoundation947 views
Take Data Validation Seriously - Paul Milham, WildWorks by NodejsFoundation
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorks
NodejsFoundation653 views
Multimodal Interactions & JS: The What, The Why and The How - Diego Paez, Des... by NodejsFoundation
Multimodal Interactions & JS: The What, The Why and The How - Diego Paez, Des...Multimodal Interactions & JS: The What, The Why and The How - Diego Paez, Des...
Multimodal Interactions & JS: The What, The Why and The How - Diego Paez, Des...
NodejsFoundation509 views
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ... by NodejsFoundation
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...
NodejsFoundation356 views
Developing Nirvana - Corey A. Butler, Author.io by NodejsFoundation
Developing Nirvana - Corey A. Butler, Author.ioDeveloping Nirvana - Corey A. Butler, Author.io
Developing Nirvana - Corey A. Butler, Author.io
NodejsFoundation330 views
Express State of the Union at Nodejs Interactive EU- Doug Wilson by NodejsFoundation
Express State of the Union at Nodejs Interactive EU- Doug WilsonExpress State of the Union at Nodejs Interactive EU- Doug Wilson
Express State of the Union at Nodejs Interactive EU- Doug Wilson
NodejsFoundation424 views
Node.js Core State of the Union- James Snell by NodejsFoundation
Node.js Core State of the Union- James SnellNode.js Core State of the Union- James Snell
Node.js Core State of the Union- James Snell
NodejsFoundation1K views
Building Scalable Web Applications Using Microservices Architecture and NodeJ... by NodejsFoundation
Building Scalable Web Applications Using Microservices Architecture and NodeJ...Building Scalable Web Applications Using Microservices Architecture and NodeJ...
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
NodejsFoundation456 views
Text Mining with Node.js - Philipp Burckhardt, Carnegie Mellon University by NodejsFoundation
Text Mining with Node.js - Philipp Burckhardt, Carnegie Mellon UniversityText Mining with Node.js - Philipp Burckhardt, Carnegie Mellon University
Text Mining with Node.js - Philipp Burckhardt, Carnegie Mellon University
NodejsFoundation2.7K views
Take Data Validation Seriously - Paul Milham, WildWorks by NodejsFoundation
Take Data Validation Seriously - Paul Milham, WildWorksTake Data Validation Seriously - Paul Milham, WildWorks
Take Data Validation Seriously - Paul Milham, WildWorks
NodejsFoundation349 views
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ... by NodejsFoundation
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...
From Pterodactyls and Cactus to Artificial Intelligence - Ivan Seidel Gomes, ...
NodejsFoundation261 views
Breaking Down the Monolith - Peter Marton, RisingStack by NodejsFoundation
Breaking Down the Monolith - Peter Marton, RisingStackBreaking Down the Monolith - Peter Marton, RisingStack
Breaking Down the Monolith - Peter Marton, RisingStack
NodejsFoundation359 views

Recently uploaded

Democratising digital commerce in India-Report by
Democratising digital commerce in India-ReportDemocratising digital commerce in India-Report
Democratising digital commerce in India-ReportKapil Khandelwal (KK)
20 views161 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
38 views43 slides
GDSC CTU First Meeting Party by
GDSC CTU First Meeting PartyGDSC CTU First Meeting Party
GDSC CTU First Meeting PartyNational Yang Ming Chiao Tung University
11 views25 slides
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...The Digital Insurer
24 views52 slides
Network Source of Truth and Infrastructure as Code revisited by
Network Source of Truth and Infrastructure as Code revisitedNetwork Source of Truth and Infrastructure as Code revisited
Network Source of Truth and Infrastructure as Code revisitedNetwork Automation Forum
32 views45 slides
Piloting & Scaling Successfully With Microsoft Viva by
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
13 views160 slides

Recently uploaded(20)

Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman38 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec15 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker48 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty22 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson126 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab23 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana17 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi139 views
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn26 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf

Are your v8 garbage collection logs speaking to you?Joyee Cheung -Alibaba Cloud(Alibaba Group)

  • 2. Are Your V8 Garbage Collection Logs Speaking to You? Joyee Cheung, Alibaba Cloud
  • 3. What Prompted us to Look into them Node.js at Alibaba
  • 4. What Prompted Us to Look Into Them Why GC Logs? v Java is the mainstream at Alibaba v Chose Node.js for productivity, but it’s meaningless without availability v Usually not the bottleneck, but with a huge traffic, every optimization counts v Garbage collection is important in long-running, data-intensive servers v High CPU usage: hurts responsiveness v High memory usage: affects other processes v Memory leaks: misled by developers, crashes the process(OOM) v Java developers know their VM and its GC v … v More about Node.js at Alibaba v https://www.linux.com/blog/can-nodejs-scale-ask-team-alibaba
  • 5. What Prompted Us to Look Into Them Why GC Logs? v Tools from V8/Chromium are more about optimizing frontend applications CPU profiles are more about function calls, less about objects v Heap snapshots and timelines are more about allocations, less about collections v Lack of high-level overview of the heap, too much details Hard to use in staging/production environment
  • 6. What Prompted Us to Look Into Them Why GC Logs? v V8 provides garbage collection logs v Not documented, not available in the devtools, need to use command line args v Higher-level than heap profiles, lower-level than the number of memory usuage v Help verify the fixes by displaying patterns of GC v Not silver bullet, but nice to have v This talk is based on the versions of V8 used by Node v4 & v6 LTS v LTS plan stablizes the V8 versions for each LTS and its GC logs
  • 7. An Introduction to V8 GC What is Garbage Collection
  • 8. An Introduction to V8 GC How Most GCs are triggered
  • 9. An Introduction to V8 GC Stop-The-World, Parallel, Concurrent GC
  • 10. An Introduction to V8 GC Generational GC
  • 11. An Introduction to V8 GC Heap Organization
  • 12. An Introduction to V8 GC Heap Limits(Default) v deps/v8/src/heap/heap.h: Heap::Heap() 16MB 1MB 1.4GB 0.7GB 512MB v Can be configured via command line arguments v --max_old_space_size, --max_semi_space_size, --max_executable_space_size
  • 13. An Introduction to V8 GC New Generation – Scavenge GC
  • 14. An Introduction to V8 GC Old Generation – Mark-Sweep/Compact GC
  • 15. An Introduction to V8 GC GC Pauses in V8
  • 16. How to Get The GC Logs v Plenty of options (node --v8-options| grep gc) v We’ll be focusing on v --trace_gc v Print a line briefly describing when, how, what and why for each GC v --trace_gc_verbose v Combined with --trace_gc, summarizes about each space and the heap after each GC v --trace_gc_nvp v Print name-value pairs describing how each step of GC goes v In case you do want to read the code v deps/v8/src/heap, start with gc-tracer.cc
  • 17. How to Read The GC Logs v --trace_gc WHERE: [PID:Isolate] WHEN: Time since the process has started WHAT: Type of GC HOW MUCH: Size of all objects(Size of memory allocated from OS) HOW LONG: GC pause/Time spent on external memory WHY
  • 18. How to Read The GC Logs v --trace_gc_verbose && --trace_gc Memory V8 allocated from the OS All memory reserved for this space (inside dedicated pages) Maintained by external C++ code Adjust heap growing factor and the allocation limit that triggers the next incremental marking
  • 19. How to Read The GC Logs v --trace_gc_nvp ms=Mark-Sweep, s=Scavenge
  • 20. What We’ve Found v Tons of Scavenge GC in New Space eating up the CPU v Cache misses caused by inappropriate caching strategies v Excessive deep clones/object merging v Large Object Space keeps growing v Serialization/deserialization of huge RPC payload v Code Space keeps growing v Bugs in templating engines v Old Space keeps growing v Closures in long connections
  • 21. Tools v Our parser v Up on NPM v For people who already have applications running in production https://github.com/aliyun-node/v8-gc-log-parser http://alinode.aliyun.com/blog (translation coming soon) Visualization coming soon!
  • 22. Tools v --trace_gc_object_stats v Feed the output to https://mlippautz.github.io/v8-heap-stats/ v Requires Node >= v7 v More about the memory usuage, less about GC v --track_gc_object_stats v Combined with --log_timer_events, writes a log file to disk v Can be viewed with chrome://tracing (Incomplete???) v Pending PR: https://github.com/nodejs/node/pull/9304
  • 24. An Introduction to V8 GC Accurate GC