Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Memory Leak Health Check
Andrew Duncan
May 10, 2015
Technology
0
250
Memory Leak Health Check
Andrew Duncan
May 10, 2015
Tweet
Share
More Decks by Andrew Duncan
See All by Andrew Duncan
Using Ext JS 6 for Mobile Development
andrewmduncan
0
71
Scot-Cloud 15 - Using Cloud as an enabler for Web/Mobile
andrewmduncan
0
25
Succeeding with Sencha Development
andrewmduncan
0
41
Securing Client-Side Data
andrewmduncan
0
110
Strategies for Working with Offline Data
andrewmduncan
1
120
Other Decks in Technology
See All in Technology
Adopting Kafka for the #1 job site in the world
ymyzk
1
360
CADDi HCMC Technology Center
caddi_eng
0
250
AWSの基礎を学ぼうで学んだ9種類のDBを勝手にふりかえる
98lerr
2
720
我々はなぜテストをするのか?
kawaguti
PRO
0
280
プロダクトグロースと技術のベースアップを両立させるRettyのアプリ開発スタイル / Achieve Product Growth and Tech Update
imaizume
1
290
Dagu | オンプレ向けワークフローエンジン(WebUI 同梱)
yohamta
0
140
tfcon-2022-cpp
cpp
5
5k
Graph API について
miyakemito
0
240
読者のことを考えて書いてみよう / Write with your reader in mind
line_developers
PRO
3
350
長年運用されてきたモノリシックアプリケーションをコンテナ化しようとするとどんな問題に遭遇するか? / SRE NEXT 2022
nulabinc
PRO
15
7.4k
Learning from AWS Customer Security Incidents [2022]
ramimac
0
740
ニフティでSRE推進活動を始めて取り組んできたこと
niftycorp
2
300
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
316
22k
Designing for humans not robots
tammielis
241
23k
Stop Working from a Prison Cell
hatefulcrawdad
261
17k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
15
910
What’s in a name? Adding method to the madness
productmarketing
11
1.5k
Infographics Made Easy
chrislema
233
17k
Code Review Best Practice
trishagee
41
6.7k
Statistics for Hackers
jakevdp
781
210k
The Language of Interfaces
destraynor
148
20k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
237
19k
Gamification - CAS2011
davidbonilla
75
3.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
315
19k
Transcript
Andrew Duncan Managing Director, SwarmOnline Member No. 149387 @andrewduncan andrew@swarmonline.com
© 2015 SwarmOnline
1. Memory Management 2. Tools of the trade MEMORY LEAK
HEALTH CHECK Our Quest to Diagnose & Cure © 2015 SwarmOnline
WHY IS THIS TOPIC IMPORTANT? • Move to richer /
interactive applications • More use of JavaScript to achieve this • Single Page Applications • Cross integration of multiple frameworks and technologies • Multiple device types, operating systems and browsers © 2015 SwarmOnline
MEMORY LEAK DEFINITION mem . o . ry leak noun
COMPUTING noun: memory leak; plural noun: memory leaks a failure in a program to release discarded memory, causing impaired performance or failure. © 2015 SwarmOnline
YES • Garbage Collection NO • Coding Mishaps DOESN’T THIS
GET HANDLED FOR ME? © 2015 SwarmOnline
WHAT TOOLS DO WE HAVE © 2015 SwarmOnline
CHROME & DEVELOPER TOOLS •Task Manager •Timeline •Profiles © 2015
SwarmOnline
TASK MANAGER © 2015 SwarmOnline
•1st round of testing •Instantaneous view of memory •Useful for
monitoring changes over small periods of time TASK MANAGER © 2015 SwarmOnline
TIMELINE © 2015 SwarmOnline
• Monitors memory over time • Sudden drops === GC
• Look out for two things: • Steady rise in the chart • GC not returning to original memory usage TIMELINE © 2015 SwarmOnline
PROFILES © 2015 SwarmOnline
PROFILES •Identify increase in objects •Do comparison © 2015 SwarmOnline
RECORD HEAP ALLOCATIONS © 2015 SwarmOnline
RECORD HEAP ALLOCATIONS © 2015 SwarmOnline
N.B. • Memory is skewed just by having Chrome Developer
Tools open • Observer Effect © 2015 SwarmOnline
OTHER BROWSER TOOLS All of these browsers have tools that
can be used to monitor memory • Internet Explorer • Safari • Firefox © 2015 SwarmOnline
INTERNET EXPLORER DEVELOPER TOOLS © 2015 SwarmOnline
SAFARI FOR DEVELOPERS © 2015 SwarmOnline
FIREFOX DEVELOPER © 2015 SwarmOnline
TASK MANAGER & WINDOWS TOOLS • Record memory usage in
Perfmon & PsTools (PsList) • Plot and view memory usage over time • In our case 1 hour, 24 hours, 1 week, 1 month PsTools PsList © 2015 SwarmOnline
TASK MANAGER & WINDOWS TOOLS Pipe data out to CSV
for charting © 2015 SwarmOnline
AUTOMATE MEMORY MONITORING How do we do this? • Virtual
Machines • Auto snapshot every X minutes • Reduce Observer Effect • Graph your results © 2015 SwarmOnline
HOW TO DO THIS YOURSELF • Strip it back to
basics • App in container only • Send data but don’t enable parsing • Add in the data package • If your app has multiple parsers for different types of data, enable each data packet individually • Gradually add in your controllers and view • Each view will need tested individually • Create your app with only one view enabled • We run over 30 VM’s with different versions of an app to get as much coverage as possible © 2015 SwarmOnline
HOW TO DO THIS YOURSELF (2) • If you suspect
something is going wrong • Take snapshot • Run code • Take snapshot • Review differences • Obviously new data (e.g. Ajax requests) are going to skew your results between snapshots © 2015 SwarmOnline
FINAL THOUGHTS • If all else fails… • Or in
extreme circumstances…rm -rf* © 2015 SwarmOnline
Andrew Duncan Managing Director, SwarmOnline @andrewduncan andrew@swarmonline.com © 2015 SwarmOnline