SlideShare ist ein Scribd-Unternehmen logo
1 von 16
.NetPerformance – Tips and Techniques Bijoy Singhal Developer Evangelist Microsoft India bsinghal@microsoft.com
Key Take Aways
 Understanding reasons behind common issues that a .NET developer faces day to day How to leverage the tools in .NET framework to solve day to day issues
 Performance: What and How
 MOST IMPORTANT: The POWER of .NET framework

.NET Tools
the hidden gems FusLogVW.exe – Fusion Log Viewer NGEN.exe – Native Image Generator ILAsm.exe, ILDAsm.exe– IL Assembler and Dis-assembler MDA – Managed Debugging Assistants  SoS.dll - 
Perfmon: What is it? The name says it all. Used to monitor the performance parameters of the system and the user applications. How to use it? What are the parameters that we can track?
A few .NET Performance Counters .NET CLR Memory Counters .NET CLR Exceptions .NET CLR Loading .NET CLR JIT Processor Memory
Scenario I: Application Consuming lot of memory What should I look at? Memory counters list Indicators: Memory Leak? # bytes in all Heaps increasing  Gen 2 Heap Size increasing  # GC handles increasing  # total committed/Reserved Bytes increasing % Time in GC Indicators: Memory Fragmentation? # total reserved Bytes significantly larger than # total committed Bytes # of Pinned Objects increasing  # GC handles increasing  # bytes in all heaps always increasing.
Scenario II: Application throwing lot of exceptions unnecessarily
 Cost of throwing an exception What else can go wrong? Blocking exception handlers Loss of exception context Perfmon Exception counters to look at: # of Exceps Thrown # of Exceps Thrown / Sec # of Filters / Sec Throw to Catch Depth / Sec
Scenario III: Application Takes too long to Load Possible Reasons: Too many assemblies to load Too much of jitting happening. Perfmon counters to look at: % Time in Loading Current Assemblies Rate of Assemblies/AppDomains # of IL Bytes JITted # of methods JITed % time in JIT
A Quick note on ASP.NET specific counters Two types: System Counters Application Counters Few important Counters: ASP.NET/Application Restarts. ASP.NET/Requests Queued ASP.NET Application/Requests/sec ASP.NET Application/Errors Total AND many more

.NET Application Performance Performance is a relative term: What is good for you may not be good for others. Performance Bottlenecks in .NET: Am I loading too many assemblies at the start? Am I doing too many memory operations? Am I trying to deal with the memory management on my own? Am I misusing Exceptions and defeating their purpose? The list is long

.NET Application Performance Way outs: Add trace messages in your application. Debug it. Use Debugging tools to do post mortem analysis. Use Perfmon.
Scenario I: FileNotFoundException “Our application ran successfully on the Development machine but it is failing with FileNotFoundException when we deploy it in production” Fusion – How the CLR locates assemblies. How can the fusion log viewer help us here How to look into the Fusion Log Fusion Log Viewer: Fuslogvw.exe Demo
Scenario II: Slow To Load “Our application takes too long to load for the first time. It exhibits the same behavior once in a while
” What happens when a .NET application runs for the first time Native Images and how they speed up the loading process NGEN: Native image generation How NGEN will help us here Demo
Scenario III: Memory Leak “ My application is consuming lot of memory. It looks like a ‘Memory Leak’ to me
” .NET Memory Manager: GC How to get managed heap information How the CLRProfiler can help us here Demo
Scenario IV: PInvoke Issues “ I used PInvoke to call a native API, I’m doing everything correct, but the call is failing/ the application is failing with AccessViolationException
” Crucial to match the native API signature exactly without any exception What is MDA How MDA will help us here Demo
Thank You Questions ??? Contact me:  bsinghal@microsoft.com http://blogs.msdn.com/bsinghal

Weitere Àhnliche Inhalte

Andere mochten auch

PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...Steve Lange
 
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...Steve Lange
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Yulia Tsisyk
 
How to Do a Performance Audit of Your .NET Website
How to Do a Performance Audit of Your .NET WebsiteHow to Do a Performance Audit of Your .NET Website
How to Do a Performance Audit of Your .NET WebsiteDNN
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuu Nguyen
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websitesoazabir
 
Four Practices to Fix Your Top .NET Performance Problems
Four Practices to Fix Your Top .NET Performance ProblemsFour Practices to Fix Your Top .NET Performance Problems
Four Practices to Fix Your Top .NET Performance ProblemsAndreas Grabner
 
Metrics Driven DevOps - Automate Scalability and Performance Into your Pipeline
Metrics Driven DevOps - Automate Scalability and Performance Into your PipelineMetrics Driven DevOps - Automate Scalability and Performance Into your Pipeline
Metrics Driven DevOps - Automate Scalability and Performance Into your PipelineAndreas Grabner
 

Andere mochten auch (8)

PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
PHX Session #3 - "It Works on My Machine!" Closing the Loop Between Developme...
 
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
PHX - Session #2 Test Driven Development: Improving .NET Application Performa...
 
Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"Adam Sitnik "State of the .NET Performance"
Adam Sitnik "State of the .NET Performance"
 
How to Do a Performance Audit of Your .NET Website
How to Do a Performance Audit of Your .NET WebsiteHow to Do a Performance Audit of Your .NET Website
How to Do a Performance Audit of Your .NET Website
 
Building Scalable .NET Web Applications
Building Scalable .NET Web ApplicationsBuilding Scalable .NET Web Applications
Building Scalable .NET Web Applications
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
Four Practices to Fix Your Top .NET Performance Problems
Four Practices to Fix Your Top .NET Performance ProblemsFour Practices to Fix Your Top .NET Performance Problems
Four Practices to Fix Your Top .NET Performance Problems
 
Metrics Driven DevOps - Automate Scalability and Performance Into your Pipeline
Metrics Driven DevOps - Automate Scalability and Performance Into your PipelineMetrics Driven DevOps - Automate Scalability and Performance Into your Pipeline
Metrics Driven DevOps - Automate Scalability and Performance Into your Pipeline
 

Ähnlich wie .Net Performance by Bijoy Singhal

TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012Ashish Bhasin
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applicationsIdo Flatow
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
Code instrumentation
Code instrumentationCode instrumentation
Code instrumentationMennan Tekbir
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War StoriesIdo Flatow
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programsgreenwop
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveAndreas Grabner
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Ivo Jansch
 
Wcl303 russinovich
Wcl303 russinovichWcl303 russinovich
Wcl303 russinovichconleyc
 
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”JSFestUA
 
Works on My Machine Syndrome
Works on My Machine SyndromeWorks on My Machine Syndrome
Works on My Machine SyndromeKamran Bilgrami
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuningJerry Kurian
 
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"LogeekNightUkraine
 
Architecture: Manual vs. Automation
Architecture: Manual vs. AutomationArchitecture: Manual vs. Automation
Architecture: Manual vs. AutomationAmazon Web Services
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakSigma Software
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)jaxLondonConference
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32Eden Shochat
 
Chaos Engineering Without Observability ... Is Just Chaos
Chaos Engineering Without Observability ... Is Just ChaosChaos Engineering Without Observability ... Is Just Chaos
Chaos Engineering Without Observability ... Is Just ChaosCharity Majors
 

Ähnlich wie .Net Performance by Bijoy Singhal (20)

TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012TechGIG_Memory leaks in_java_webnair_26th_july_2012
TechGIG_Memory leaks in_java_webnair_26th_july_2012
 
Production debugging web applications
Production debugging web applicationsProduction debugging web applications
Production debugging web applications
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
Code instrumentation
Code instrumentationCode instrumentation
Code instrumentation
 
Production Debugging War Stories
Production Debugging War StoriesProduction Debugging War Stories
Production Debugging War Stories
 
Performance Analysis of Idle Programs
Performance Analysis of Idle ProgramsPerformance Analysis of Idle Programs
Performance Analysis of Idle Programs
 
JavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep DiveJavaOne 2015: Top Performance Patterns Deep Dive
JavaOne 2015: Top Performance Patterns Deep Dive
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Wcl303 russinovich
Wcl303 russinovichWcl303 russinovich
Wcl303 russinovich
 
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”
JS Fest 2019. ВоĐșŃ‚ĐŸŃ€ бурсĐșĐžĐč. 6 ŃĐżĐŸŃĐŸĐ±ĐŸĐČ ĐČĐ·Đ»ĐŸĐŒĐ°Ń‚ŃŒ тĐČĐŸĐ” JavaScript ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐ”
 
Works on My Machine Syndrome
Works on My Machine SyndromeWorks on My Machine Syndrome
Works on My Machine Syndrome
 
News In The Net40
News In The Net40News In The Net40
News In The Net40
 
Java performance tuning
Java performance tuningJava performance tuning
Java performance tuning
 
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
Kostiantyn Yelisavenko "Mastering Macro Benchmarking in .NET"
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 
Architecture: Manual vs. Automation
Architecture: Manual vs. AutomationArchitecture: Manual vs. Automation
Architecture: Manual vs. Automation
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr Sugak
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32
 
Chaos Engineering Without Observability ... Is Just Chaos
Chaos Engineering Without Observability ... Is Just ChaosChaos Engineering Without Observability ... Is Just Chaos
Chaos Engineering Without Observability ... Is Just Chaos
 

Mehr von Rishu Mehra

I Unlock Joy! - ITM Gurgaon
I Unlock Joy! - ITM GurgaonI Unlock Joy! - ITM Gurgaon
I Unlock Joy! - ITM GurgaonRishu Mehra
 
What is Microsoft Student Partner Program?
What is Microsoft Student Partner Program?What is Microsoft Student Partner Program?
What is Microsoft Student Partner Program?Rishu Mehra
 
all you need to know about windows phone
all you need to know about windows phoneall you need to know about windows phone
all you need to know about windows phoneRishu Mehra
 
Blurring the difference of Web & Native Apps with HTML 5 & IE 9
Blurring the difference of Web & Native Apps with HTML 5  & IE 9Blurring the difference of Web & Native Apps with HTML 5  & IE 9
Blurring the difference of Web & Native Apps with HTML 5 & IE 9Rishu Mehra
 
Lync Server
Lync ServerLync Server
Lync ServerRishu Mehra
 
Windows Phone 7: Interfacing
Windows Phone 7: InterfacingWindows Phone 7: Interfacing
Windows Phone 7: InterfacingRishu Mehra
 
Hello, windows phone!
Hello, windows phone!Hello, windows phone!
Hello, windows phone!Rishu Mehra
 
Windows Phone 7 Applications with Silverlight
Windows Phone 7 Applications with SilverlightWindows Phone 7 Applications with Silverlight
Windows Phone 7 Applications with SilverlightRishu Mehra
 
Windows Phone 7: Silverlight
Windows Phone 7: SilverlightWindows Phone 7: Silverlight
Windows Phone 7: SilverlightRishu Mehra
 
SharePoint 2010 for IT Pros
SharePoint 2010 for IT ProsSharePoint 2010 for IT Pros
SharePoint 2010 for IT ProsRishu Mehra
 
SharePoint 2010 for Devs
SharePoint 2010 for DevsSharePoint 2010 for Devs
SharePoint 2010 for DevsRishu Mehra
 
Ado.net entity framework_4.0
Ado.net entity framework_4.0Ado.net entity framework_4.0
Ado.net entity framework_4.0Rishu Mehra
 
SQL Server 2008 R2 - Implementing High Availabilitty
SQL Server 2008 R2 - Implementing High AvailabilittySQL Server 2008 R2 - Implementing High Availabilitty
SQL Server 2008 R2 - Implementing High AvailabilittyRishu Mehra
 
Microsoft India Academic Initiatives
Microsoft India Academic InitiativesMicrosoft India Academic Initiatives
Microsoft India Academic InitiativesRishu Mehra
 
Microsoft Community Tools
Microsoft Community ToolsMicrosoft Community Tools
Microsoft Community ToolsRishu Mehra
 
Visual studio 2010
Visual studio 2010Visual studio 2010
Visual studio 2010Rishu Mehra
 
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Rishu Mehra
 
Microsoft CTD & User Groups
Microsoft CTD & User GroupsMicrosoft CTD & User Groups
Microsoft CTD & User GroupsRishu Mehra
 
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...Rishu Mehra
 

Mehr von Rishu Mehra (20)

I Unlock Joy! - ITM Gurgaon
I Unlock Joy! - ITM GurgaonI Unlock Joy! - ITM Gurgaon
I Unlock Joy! - ITM Gurgaon
 
What is Microsoft Student Partner Program?
What is Microsoft Student Partner Program?What is Microsoft Student Partner Program?
What is Microsoft Student Partner Program?
 
all you need to know about windows phone
all you need to know about windows phoneall you need to know about windows phone
all you need to know about windows phone
 
Blurring the difference of Web & Native Apps with HTML 5 & IE 9
Blurring the difference of Web & Native Apps with HTML 5  & IE 9Blurring the difference of Web & Native Apps with HTML 5  & IE 9
Blurring the difference of Web & Native Apps with HTML 5 & IE 9
 
Lync Server
Lync ServerLync Server
Lync Server
 
Office365
Office365Office365
Office365
 
Windows Phone 7: Interfacing
Windows Phone 7: InterfacingWindows Phone 7: Interfacing
Windows Phone 7: Interfacing
 
Hello, windows phone!
Hello, windows phone!Hello, windows phone!
Hello, windows phone!
 
Windows Phone 7 Applications with Silverlight
Windows Phone 7 Applications with SilverlightWindows Phone 7 Applications with Silverlight
Windows Phone 7 Applications with Silverlight
 
Windows Phone 7: Silverlight
Windows Phone 7: SilverlightWindows Phone 7: Silverlight
Windows Phone 7: Silverlight
 
SharePoint 2010 for IT Pros
SharePoint 2010 for IT ProsSharePoint 2010 for IT Pros
SharePoint 2010 for IT Pros
 
SharePoint 2010 for Devs
SharePoint 2010 for DevsSharePoint 2010 for Devs
SharePoint 2010 for Devs
 
Ado.net entity framework_4.0
Ado.net entity framework_4.0Ado.net entity framework_4.0
Ado.net entity framework_4.0
 
SQL Server 2008 R2 - Implementing High Availabilitty
SQL Server 2008 R2 - Implementing High AvailabilittySQL Server 2008 R2 - Implementing High Availabilitty
SQL Server 2008 R2 - Implementing High Availabilitty
 
Microsoft India Academic Initiatives
Microsoft India Academic InitiativesMicrosoft India Academic Initiatives
Microsoft India Academic Initiatives
 
Microsoft Community Tools
Microsoft Community ToolsMicrosoft Community Tools
Microsoft Community Tools
 
Visual studio 2010
Visual studio 2010Visual studio 2010
Visual studio 2010
 
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
 
Microsoft CTD & User Groups
Microsoft CTD & User GroupsMicrosoft CTD & User Groups
Microsoft CTD & User Groups
 
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
Uploading Data From Microsoft Excel - Microsoft SLQ Server 2008 (by Rakesh Mi...
 

KĂŒrzlich hochgeladen

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

KĂŒrzlich hochgeladen (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

.Net Performance by Bijoy Singhal

  • 1. .NetPerformance – Tips and Techniques Bijoy Singhal Developer Evangelist Microsoft India bsinghal@microsoft.com
  • 2. Key Take Aways
 Understanding reasons behind common issues that a .NET developer faces day to day How to leverage the tools in .NET framework to solve day to day issues
 Performance: What and How
 MOST IMPORTANT: The POWER of .NET framework

  • 3. .NET Tools
the hidden gems FusLogVW.exe – Fusion Log Viewer NGEN.exe – Native Image Generator ILAsm.exe, ILDAsm.exe– IL Assembler and Dis-assembler MDA – Managed Debugging Assistants SoS.dll - 
  • 4. Perfmon: What is it? The name says it all. Used to monitor the performance parameters of the system and the user applications. How to use it? What are the parameters that we can track?
  • 5. A few .NET Performance Counters .NET CLR Memory Counters .NET CLR Exceptions .NET CLR Loading .NET CLR JIT Processor Memory
  • 6. Scenario I: Application Consuming lot of memory What should I look at? Memory counters list Indicators: Memory Leak? # bytes in all Heaps increasing Gen 2 Heap Size increasing # GC handles increasing # total committed/Reserved Bytes increasing % Time in GC Indicators: Memory Fragmentation? # total reserved Bytes significantly larger than # total committed Bytes # of Pinned Objects increasing # GC handles increasing # bytes in all heaps always increasing.
  • 7. Scenario II: Application throwing lot of exceptions unnecessarily
 Cost of throwing an exception What else can go wrong? Blocking exception handlers Loss of exception context Perfmon Exception counters to look at: # of Exceps Thrown # of Exceps Thrown / Sec # of Filters / Sec Throw to Catch Depth / Sec
  • 8. Scenario III: Application Takes too long to Load Possible Reasons: Too many assemblies to load Too much of jitting happening. Perfmon counters to look at: % Time in Loading Current Assemblies Rate of Assemblies/AppDomains # of IL Bytes JITted # of methods JITed % time in JIT
  • 9. A Quick note on ASP.NET specific counters Two types: System Counters Application Counters Few important Counters: ASP.NET/Application Restarts. ASP.NET/Requests Queued ASP.NET Application/Requests/sec ASP.NET Application/Errors Total AND many more

  • 10. .NET Application Performance Performance is a relative term: What is good for you may not be good for others. Performance Bottlenecks in .NET: Am I loading too many assemblies at the start? Am I doing too many memory operations? Am I trying to deal with the memory management on my own? Am I misusing Exceptions and defeating their purpose? The list is long

  • 11. .NET Application Performance Way outs: Add trace messages in your application. Debug it. Use Debugging tools to do post mortem analysis. Use Perfmon.
  • 12. Scenario I: FileNotFoundException “Our application ran successfully on the Development machine but it is failing with FileNotFoundException when we deploy it in production” Fusion – How the CLR locates assemblies. How can the fusion log viewer help us here How to look into the Fusion Log Fusion Log Viewer: Fuslogvw.exe Demo
  • 13. Scenario II: Slow To Load “Our application takes too long to load for the first time. It exhibits the same behavior once in a while
” What happens when a .NET application runs for the first time Native Images and how they speed up the loading process NGEN: Native image generation How NGEN will help us here Demo
  • 14. Scenario III: Memory Leak “ My application is consuming lot of memory. It looks like a ‘Memory Leak’ to me
” .NET Memory Manager: GC How to get managed heap information How the CLRProfiler can help us here Demo
  • 15. Scenario IV: PInvoke Issues “ I used PInvoke to call a native API, I’m doing everything correct, but the call is failing/ the application is failing with AccessViolationException
” Crucial to match the native API signature exactly without any exception What is MDA How MDA will help us here Demo
  • 16. Thank You Questions ??? Contact me: bsinghal@microsoft.com http://blogs.msdn.com/bsinghal

Hinweis der Redaktion

  1. .NET is a powerful platform to build mission critical, robust enterprise applications. While, .NET makes it very easy to build almost any kind of application, it is important that we as developers understand what is going on under the hood. Know, how the architecture of .Net should be leveraged in the best possible way and are aware about the tools available to measure and optimize the performance of our .NET applications. In this session – we will share some secrets to write performant .NET applications. We will touch upon performance counters, performance monitor, CLR profiler etc

  2. IndicatorsMemory Leaks Indicators: # bytes in all Heaps increasingGen 2 Heap Size increasing# GC handles increasing# of Pinned Objects increasing # total committed Bytes increasing# total reserved Bytes increasingLarge Object Heap increasing Virtual Address Space Fragmentation Indicators: # total reserved Bytes significantly larger than # total committed Bytes# of Pinned Objects increasing# GC handles increasing# bytes in all heaps always increasing. CPU Spin Indicators: Current Queue Length is very close to Threads Count and stays that way for a long time.% Processor Time is continuously at a fixed level for a long period of time (as long as the Current Queue Length is at the same value). Managed Deadlock Indicators: Current Queue Length is very close to Threads Count and stays that way for a long time.% Processor Time is 0 (or close to 0) (as long as the Current Queue Length is at the same value) and the application stopped responding. Blocked Finalizer Thread Indicators: # bytes in all heaps increasingPrivate BytesincresingVirtual Bytes increasing
  3. When is Exception Thrown.:I can think of 3 reasons off the top of my head. Exceptions are expensive. Exceptions can take you into unnecessary code paths. Exceptions are generally thrown when something went wrong. 2. Cost:Grab a stack trace by interpreting metadata emitted by the compiler to guide our stack unwind. Run through a chain of handlers up the stack, calling each handler twice. Compensate for mismatches between SEH, C++ and managed exceptions. Allocate a managed Exception instance and run its constructor. Most likely, this involves looking up resources for the various error messages. Probably take a trip through the OS kernel. Often take a hardware exception. Notify any attached debuggers, profilers, vectored exception handlers and other interested parties. Resources:1. http://blogs.msdn.com/tess/archive/2005/11/30/are-you-aware-that-you-have-thrown-over-40-000-exceptions-in-the-last-3-hours.aspx 2. http://msdn.microsoft.com/en-us/library/kfhcywhs.aspx
  4. 1. http://codebetter.com/blogs/raymond.lewallen/archive/2005/05/05/62809.aspx # of Methods Jitted – This counter displays the total number of methods compiled Just-In-Time (JIT) by the CLR JIT compiler since the start of the application. This counter does not include the pre-jitted methods.% Time in Jit – This counter displays the percentage of elapsed time spent in JIT compilation since the last JIT compilation phase. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase is the phase when a method and its dependencies are being compiled.Standard Jit Failures – This counter displays the peak number of methods the JIT compiler has failed to JIT since the start of the application. This failure can occur if the IL cannot be verified or if there was an internal error in the JIT compiler.Total # of IL Bytes Jitted – This counter displays the total IL bytes jitted since the start of the application. This counter is exactly equivalent to the "# of IL Bytes Jitted" counter.2. JIT Overview: http://blogs.msdn.com/davidnotario/archive/2004/10/26/247792.aspx
  5. http://msdn.microsoft.com/en-us/library/fxk122b4.aspxSystem performance counters are exposed in the Windows Performance monitor as the ASP.NET performance counter object.Application performance counters are exposed as the ASP.NET Applications performance object.
  6. Things to look at:Fuslogvw.exe, Default and Native sections.How to enable fusion logging using registry:Set [HKLMSoftwareMicrosoftFusionLogPath] to point to some directory (like c:FusLog)Set [HKLMSoftwareMicrosoftFusionForceLog] as a DWORD value, to 1Fusion References:http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspxhttp://msdn.microsoft.com/en-us/library/e74a18c4(VS.80).aspx
  7. Useful Commands: 1. To display contents of Native assembly Cache NGEN display /verbose 2. To install assembly in NGEN cache NGEN install assemblyname 3. To uninstall assembly from NGEN cache NGEN uninstall assemblynameReferences: http://msdn.microsoft.com/en-us/library/6t9t5wcf(VS.80).aspxhttp://blogs.msdn.com/clrcodegeneration/
  8. How to load SoS.dll in VSIn order to load sos.dll you have to open up the Immediate Window (Debug/Windows/Immediate or Ctrl+D, I) and type .load C:WINDOWSMicrosoft.NETFrameworkv2.0.50727sos.dll2. This should yield the response extension C:WINDOWSMicrosoft.NETFrameworkv2.0.50727sos.dll loaded2. References:http://blogs.msdn.com/tess/archive/2007/10/19/net-finalizer-memory-leak-debugging-with-sos-dll-in-visual-studio.aspxhttp://msdn.microsoft.com/en-us/library/bb190764.aspxhttp://blogs.msdn.com/vancem/archive/2006/03/07/545596.aspx
  9. Enable MDA by adding following registry: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework] "MDA"="1"2. Add App.exe.mda.config file:<?xml version="1.0" encoding="UTF-8" ?> <mdaConfig> <assistants> <pInvokeStackImbalance /> </assistants> </mdaConfig>3. References:http://blogs.msdn.com/jmstall/archive/2005/11/10/introducing_mdas.aspx http://msdn.microsoft.com/en-us/library/d21c150d.aspxhttp://pinvoke.net