The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Abstract: We will introduce RAPIDS, a suite of open source libraries for GPU-accelerated data science, and illustrate how it operates seamlessly with MLflow to enable reproducible training, model storage, and deployment. We will walk through a baseline example that incorporates MLflow locally, with a simple SQLite backend, and briefly introduce how the same workflow can be deployed in the context of GPU enabled Kubernetes clusters.
This document summarizes a presentation by Erin LeDell from H2O.ai about machine learning using the H2O software. H2O is an open-source machine learning platform that provides APIs for R, Python, Scala and other languages. It allows distributed machine learning on large datasets across clusters. The presentation covers H2O's architecture, algorithms like random forests and deep learning, and how to use H2O within R including loading data, training models, and running grid searches. It also discusses H2O on Spark via Sparkling Water and real-world use cases with customers.
1. The document discusses using Deeplearning4j and Kafka together for machine learning workflows. It describes how Deeplearning4j can be used to build, train, and deploy neural networks on JVM and Spark, while Kafka can be used to stream data for training and inference.
2. An example application is described that performs anomaly detection on log files from a CDN by aggregating the data to reduce the number of data points. This allows the model to run efficiently on available GPU hardware.
3. The document provides a link to a GitHub repository with a code example that uses Kafka to stream data, Keras to train a model, and Deeplearning4j to perform inference in Java and deploy the model.
With Anaconda (in particular Numba and Dask) you can scale up your NumPy and Pandas stack to many cpus and GPUs as well as scale-out to run on clusters of machines including Hadoop.
Azul Product Manager Matt Schuetze's presentation on JVM memory details to the Philadelphia Java User Group.
This session dovetails with the March, 2014 PhillyJUG deep dive session topic focused on Java compiler code transformation and JVM runtime execution. That session exposes myths that Java is slow and Java uses too much memory. In this session we will take a deeper look at Java memory management. The dreaded Out of Memory (OOM) error is one problem. Garbage collector activity and spikes leading to long pauses is another. He covers the foundations of garbage collection and why historically Java gets a bad rap, even though GC provides a marvelous memory management paradigm.
Strata NYC 2015: Sketching Big Data with Spark: randomized algorithms for lar...
1) Reynold Xin presented on using sketches like Bloom filters, HyperLogLog, count-min sketches, and stratified sampling to summarize and analyze large datasets in Spark.
2) Sketches allow analyzing data in small space and in one pass to identify frequent items, estimate cardinality, and sample data.
3) Spark incorporates sketches to speed up exploration, feature engineering, and building faster exact algorithms for processing large datasets.
Machine learning at scale with Google Cloud Platform
Machine Learning typically involves big datasets and lots of model iterations. This presentation shows how to use GCP to speed up that process with ML Engine and Dataflow. The focus of the presentation is on tooling not on models or business cases.
This document discusses the need for a time series database and introduces OpenTSDB as an option. Some key points:
- Time series data is useful for analyzing metrics and patterns over time but is currently scattered across different databases.
- OpenTSDB is an open source time series database that can store trillions of data points, scale using HBase, and never loses precision.
- It is optimized for write throughput and can handle thousands of data points per second. Reads depend on the cardinality of metrics but it supports time-based queries.
- OpenTSDB uses HBase under the hood and stores tags with metrics to allow for flexible filtering of time series data without affecting performance.
First steps with Keras 2: A tutorial with Examples
In this presentation, we give a brief introduction to Keras and Neural networks, and use examples to explain how to build and train neural network models using this framework.
Talk given as part of an event by Rio Machine Learning Meetup.
View, Act, and React: Shaping Business Activity with Analytics, BigData Queri...
Sun Tzu said “if you know your enemies and know yourself, you can win a hundred battles without a single loss.” Those words have never been truer than in our time. We are faced with an avalanche of data. Many believe the ability to process and gain insights from a vast array of available data will be the primary competitive advantage for organizations in the years to come.
To make sense of data, you will have to face many challenges: how to collect, how to store, how to process, and how to react fast. Although you can build these systems from bottom up, it is a significant problem. There are many technologies, both open source and proprietary, that you can put together to build your analytics solution, which will likely save you effort and provide a better solution.
In this session, Srinath will discuss WSO2’s middleware offering in BigData and explain how you can put them together to build a solution that will make sense of your data. The session will cover technologies like thrift for collecting data, Cassandra for storing data, Hadoop for analyzing data in batch mode, and Complex event processing for analyzing data real time.
Using Spark ML on Spark Errors - What do the clusters tell us?
If you’re subscribed to user@spark.apache.org, or work in a large company, you may see some common Spark error messages. Even attending Spark Summit over the past few years you have seen talks like the “Top K Mistakes in Spark.” While cool non-machine learning based tools do exist to examine Spark’s logs — they don’t use machine learning and therefore are not as cool but also limited in by the amount of effort humans can put into writing rules for them. This talk will look what happens when we train “regular” clustering models on stack traces, and explore DL models for classifying user message to the Spark list. Come for the reassurance that the robots are not yet able to fix themselves, and stay to learn how to work better with the help of our robot friends. The tl;dr of this talk is Spark ML on Spark output, plus a little bit of Tensorflow is fun for the whole family, but probably shouldn’t automatically respond to user list posts just yet.
Chronix Time Series Database - The New Time Series Kid on the Block
Chronix is a time series database that can efficiently store billions of time series data points in a small amount of disk space and retrieve data within milliseconds. It works by splitting time series into fixed-size chunks, compressing the chunks, and storing the compressed chunks and associated metadata in Solr/Lucene records. Chronix provides common time series aggregations, transformations, and analyses through its API. The developers tuned Chronix's performance by evaluating different compression techniques and chunk sizes on real-world time series data. Chronix outperformed other time series databases in storage needs and query speeds in their tests.
Training Deep Learning Models on Multiple GPUs in the Cloud by Enrique Otero ...
This document discusses training deep learning models using multiple GPUs in the cloud. It covers the challenges of distributed training including data bottlenecks, communication bottlenecks, and scaling batch sizes and learning rates. It provides benchmarks for frameworks like MXNet and TensorFlow on AWS and discusses the impact of infrastructure like GPU type and interconnect bandwidth on training performance and efficiency. It also analyzes the costs of using different cloud platforms for deep learning training.
Apache TVM is an open source machine learning compiler that distills the largest, most powerful deep learning models into lightweight software that can run on the edge. This allows the outputed model to run inference much faster on a variety of target hardware (CPUs, GPUs, FPGAs & accelerators) and save significant costs.
In this deep dive, we’ll discuss how Apache TVM works, share the latest and upcoming features and run a live demo of how to optimize a custom machine learning model.
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...
Large scale data processing analyses and makes sense of large amounts of data. Although the field itself is not new, it is finding many usecases under the theme "Bigdata" where Google itself, IBM Watson, and Google's Driverless car are some of success stories. Spanning many fields, Large scale data processing brings together technologies like Distributed Systems, Machine Learning, Statistics, and Internet of Things together. It is a multi-billion-dollar industry including use cases like targeted advertising, fraud detection, product recommendations, and market surveys. With new technologies like Internet of Things (IoT), these use cases are expanding to scenarios like Smart Cities, Smart health, and Smart Agriculture. Some usecases like Urban Planning can be slow, which is done in batch mode, while others like stock markets need results within Milliseconds, which are done in streaming fashion. There are different technologies for each case: MapReduce for batch processing and Complex Event Processing and Stream Processing for real-time usecases. Furthermore, the type of analysis range from basic statistics like mean to complicated prediction models based on machine Learning. In this talk, we will discuss data processing landscape: concepts, usecases, technologies and open questions while drawing examples from real world scenarios.
http://icter.org/conference/invited_speeches
Real time and reliable processing with Apache Storm
Storm is a framework for reliably processing streaming data. It allows defining topologies composed of spouts (data sources) and bolts (processing components). Spouts emit tuples that are processed by bolts which can emit additional tuples. The document describes a topology for processing tweets in real-time to identify top hashtags and display tweets on a map. It includes spouts to fetch tweets and bolts for filtering, counting hashtags, ranking them and storing results to Redis. Storm provides reliability by tracking processing of tuples through a topology using acknowledgments.
ConFoo - Exploring .NET’s memory management – a trip down memory lane
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The document discusses Java garbage collection. It explains that garbage collection automatically reclaims memory from objects that are no longer reachable to avoid memory leaks. It describes different garbage collection algorithms and strategies like generational and incremental garbage collection. It also discusses best practices and myths around memory management in Java.
The slides for the first ever SnappyData webinar. Covers SnappyData core concepts, programming models, benchmarks and more.
SnappyData is open sourced here: https://github.com/SnappyDataInc/snappydata
We also have a deep technical paper here: http://www.snappydata.io/snappy-industrial
We can be easily contacted on Slack, Gitter and more: http://www.snappydata.io/about#contactus
For More information, refer to Java EE 7 performance tuning and optimization book:
The book is published by Packt Publishing:
http://www.packtpub.com/java-ee-7-performance-tuning-and-optimization/book
How to approach a problem from a performance standpoint. A small real world application is used as a case study.
I\'ve presented "High Performance With Java" at Codebits\'2008 held from 13 to 15 November 2008
(*) Codebits is a programming contest held in Portugal held the spirit of Yahoo Hack! Day
Presentation from DICE Coder's Day (2010 November) by Andreas Fredriksson in the Frostbite team.
Goes into detail about Scope Stacks, which are a systems programming tool for memory layout that provides
• Deterministic memory map behavior
• Single-cycle allocation speed
• Regular C++ object life cycle for objects that need it
This makes it very suitable for games.
Hibernate provides object relational mapping and allows working with data at the object level rather than directly with SQL. It abstracts the underlying database, handles change detection and caching. The session factory handles connection pooling and caching of mappings. The session represents a unit of work and tracks changes to objects, flushing updates to the database at the end of the session. The first level cache tracks changes to objects within a session. Query caching caches query results to improve performance. The second level cache caches objects beyond a single session.
Even if your program is just a few lines of code, .NET's runtime will create a number of object in memory. Are all objects being destroyed by the garbage collector? Or is there a potential memory leak? And why is the application seemingly slow when having lots of objects in memory? In this webinar, we'll explore the new dotMemory 4 memory profiler. We'll see why we want to use a memory profiler and how easy it is to use JetBrains dotMemory for that.
Memory management best practices in Android include using the sparse array family for collections below 1,000 items, avoiding unnecessary object creation, using StringBuilder for string concatenation, properly closing streams to prevent memory leaks, and using patterns like object pools and flyweights to reduce memory usage. The onTrimMemory callback and memory monitoring tools like Memory Monitor and Heap Viewer can help detect memory issues and leaks in an Android application.
Find out more about:
• Techniques and tips to optimize trainingon Apache MXNet
• Infrastructure performance:storage and I/O, GPU throughput, distributed training, CPU-based training, cost
• Model performance:data augmentation, initializers, optimizers, etc.
• Level 666: you should be familiar with Deep Learning and MXNet
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDBCody Ray
Building a Scalable Distributed Stats Infrastructure with Storm and KairosDB
Many startups collect and display stats and other time-series data for their users. A supposedly-simple NoSQL option such as MongoDB is often chosen to get started... which soon becomes 50 distributed replica sets as volume increases. This talk describes how we designed a scalable distributed stats infrastructure from the ground up. KairosDB, a rewrite of OpenTSDB built on top of Cassandra, provides a solid foundation for storing time-series data. Unfortunately, though, it has some limitations: millisecond time granularity and lack of atomic upsert operations which make counting (critical to any stats infrastructure) a challenge. Additionally, running KairosDB atop Cassandra inside AWS brings its own set of challenges, such as managing Cassandra seeds and AWS security groups as you grow or shrink your Cassandra ring. In this deep-dive talk, we explore how we've used a mix of open-source and in-house tools to tackle these challenges and build a robust, scalable, distributed stats infrastructure.
TensorFrames: Google Tensorflow on Apache SparkDatabricks
Presentation at Bay Area Spark Meetup by Databricks Software Engineer and Spark committer Tim Hunter.
This presentation covers how you can use TensorFrames with Tensorflow to distributed computing on GPU.
Understanding Java Garbage Collection - And What You Can Do About ItAzul Systems Inc.
Garbage collection is an integral but often misunderstood part of application behavior on Java platforms. As such, it is important for Java developers to understand how collector mechanisms work. This presentation reviews and classifies the major garbage collectors available in JVMs today. Following an overview of common garbage collection techniques such as generational, parallel, stop-the-world, incremental, and concurrent algorithms, it defines terms and metrics common to all collectors. It also discusses trade-offs in balancing requirements for responsiveness, throughput, space, and available memory and covers some pitfalls, common misconceptions, and garbage collection behavior myths.
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementEmery Berger
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDSDatabricks
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Abstract: We will introduce RAPIDS, a suite of open source libraries for GPU-accelerated data science, and illustrate how it operates seamlessly with MLflow to enable reproducible training, model storage, and deployment. We will walk through a baseline example that incorporates MLflow locally, with a simple SQLite backend, and briefly introduce how the same workflow can be deployed in the context of GPU enabled Kubernetes clusters.
High Performance Machine Learning in R with H2OSri Ambati
This document summarizes a presentation by Erin LeDell from H2O.ai about machine learning using the H2O software. H2O is an open-source machine learning platform that provides APIs for R, Python, Scala and other languages. It allows distributed machine learning on large datasets across clusters. The presentation covers H2O's architecture, algorithms like random forests and deep learning, and how to use H2O within R including loading data, training models, and running grid searches. It also discusses H2O on Spark via Sparkling Water and real-world use cases with customers.
1. The document discusses using Deeplearning4j and Kafka together for machine learning workflows. It describes how Deeplearning4j can be used to build, train, and deploy neural networks on JVM and Spark, while Kafka can be used to stream data for training and inference.
2. An example application is described that performs anomaly detection on log files from a CDN by aggregating the data to reduce the number of data points. This allows the model to run efficiently on available GPU hardware.
3. The document provides a link to a GitHub repository with a code example that uses Kafka to stream data, Keras to train a model, and Deeplearning4j to perform inference in Java and deploy the model.
With Anaconda (in particular Numba and Dask) you can scale up your NumPy and Pandas stack to many cpus and GPUs as well as scale-out to run on clusters of machines including Hadoop.
Azul Product Manager Matt Schuetze's presentation on JVM memory details to the Philadelphia Java User Group.
This session dovetails with the March, 2014 PhillyJUG deep dive session topic focused on Java compiler code transformation and JVM runtime execution. That session exposes myths that Java is slow and Java uses too much memory. In this session we will take a deeper look at Java memory management. The dreaded Out of Memory (OOM) error is one problem. Garbage collector activity and spikes leading to long pauses is another. He covers the foundations of garbage collection and why historically Java gets a bad rap, even though GC provides a marvelous memory management paradigm.
Strata NYC 2015: Sketching Big Data with Spark: randomized algorithms for lar...Databricks
1) Reynold Xin presented on using sketches like Bloom filters, HyperLogLog, count-min sketches, and stratified sampling to summarize and analyze large datasets in Spark.
2) Sketches allow analyzing data in small space and in one pass to identify frequent items, estimate cardinality, and sample data.
3) Spark incorporates sketches to speed up exploration, feature engineering, and building faster exact algorithms for processing large datasets.
Machine learning at scale with Google Cloud PlatformMatthias Feys
Machine Learning typically involves big datasets and lots of model iterations. This presentation shows how to use GCP to speed up that process with ML Engine and Dataflow. The focus of the presentation is on tooling not on models or business cases.
This document discusses the need for a time series database and introduces OpenTSDB as an option. Some key points:
- Time series data is useful for analyzing metrics and patterns over time but is currently scattered across different databases.
- OpenTSDB is an open source time series database that can store trillions of data points, scale using HBase, and never loses precision.
- It is optimized for write throughput and can handle thousands of data points per second. Reads depend on the cardinality of metrics but it supports time-based queries.
- OpenTSDB uses HBase under the hood and stores tags with metrics to allow for flexible filtering of time series data without affecting performance.
First steps with Keras 2: A tutorial with ExamplesFelipe
In this presentation, we give a brief introduction to Keras and Neural networks, and use examples to explain how to build and train neural network models using this framework.
Talk given as part of an event by Rio Machine Learning Meetup.
View, Act, and React: Shaping Business Activity with Analytics, BigData Queri...Srinath Perera
Sun Tzu said “if you know your enemies and know yourself, you can win a hundred battles without a single loss.” Those words have never been truer than in our time. We are faced with an avalanche of data. Many believe the ability to process and gain insights from a vast array of available data will be the primary competitive advantage for organizations in the years to come.
To make sense of data, you will have to face many challenges: how to collect, how to store, how to process, and how to react fast. Although you can build these systems from bottom up, it is a significant problem. There are many technologies, both open source and proprietary, that you can put together to build your analytics solution, which will likely save you effort and provide a better solution.
In this session, Srinath will discuss WSO2’s middleware offering in BigData and explain how you can put them together to build a solution that will make sense of your data. The session will cover technologies like thrift for collecting data, Cassandra for storing data, Hadoop for analyzing data in batch mode, and Complex event processing for analyzing data real time.
Using Spark ML on Spark Errors - What do the clusters tell us?Holden Karau
If you’re subscribed to user@spark.apache.org, or work in a large company, you may see some common Spark error messages. Even attending Spark Summit over the past few years you have seen talks like the “Top K Mistakes in Spark.” While cool non-machine learning based tools do exist to examine Spark’s logs — they don’t use machine learning and therefore are not as cool but also limited in by the amount of effort humans can put into writing rules for them. This talk will look what happens when we train “regular” clustering models on stack traces, and explore DL models for classifying user message to the Spark list. Come for the reassurance that the robots are not yet able to fix themselves, and stay to learn how to work better with the help of our robot friends. The tl;dr of this talk is Spark ML on Spark output, plus a little bit of Tensorflow is fun for the whole family, but probably shouldn’t automatically respond to user list posts just yet.
Chronix Time Series Database - The New Time Series Kid on the BlockQAware GmbH
Chronix is a time series database that can efficiently store billions of time series data points in a small amount of disk space and retrieve data within milliseconds. It works by splitting time series into fixed-size chunks, compressing the chunks, and storing the compressed chunks and associated metadata in Solr/Lucene records. Chronix provides common time series aggregations, transformations, and analyses through its API. The developers tuned Chronix's performance by evaluating different compression techniques and chunk sizes on real-world time series data. Chronix outperformed other time series databases in storage needs and query speeds in their tests.
Training Deep Learning Models on Multiple GPUs in the Cloud by Enrique Otero ...Big Data Spain
This document discusses training deep learning models using multiple GPUs in the cloud. It covers the challenges of distributed training including data bottlenecks, communication bottlenecks, and scaling batch sizes and learning rates. It provides benchmarks for frameworks like MXNet and TensorFlow on AWS and discusses the impact of infrastructure like GPU type and interconnect bandwidth on training performance and efficiency. It also analyzes the costs of using different cloud platforms for deep learning training.
How to use Apache TVM to optimize your ML modelsDatabricks
Apache TVM is an open source machine learning compiler that distills the largest, most powerful deep learning models into lightweight software that can run on the edge. This allows the outputed model to run inference much faster on a variety of target hardware (CPUs, GPUs, FPGAs & accelerators) and save significant costs.
In this deep dive, we’ll discuss how Apache TVM works, share the latest and upcoming features and run a live demo of how to optimize a custom machine learning model.
ICTER 2014 Invited Talk: Large Scale Data Processing in the Real World: from ...Srinath Perera
Large scale data processing analyses and makes sense of large amounts of data. Although the field itself is not new, it is finding many usecases under the theme "Bigdata" where Google itself, IBM Watson, and Google's Driverless car are some of success stories. Spanning many fields, Large scale data processing brings together technologies like Distributed Systems, Machine Learning, Statistics, and Internet of Things together. It is a multi-billion-dollar industry including use cases like targeted advertising, fraud detection, product recommendations, and market surveys. With new technologies like Internet of Things (IoT), these use cases are expanding to scenarios like Smart Cities, Smart health, and Smart Agriculture. Some usecases like Urban Planning can be slow, which is done in batch mode, while others like stock markets need results within Milliseconds, which are done in streaming fashion. There are different technologies for each case: MapReduce for batch processing and Complex Event Processing and Stream Processing for real-time usecases. Furthermore, the type of analysis range from basic statistics like mean to complicated prediction models based on machine Learning. In this talk, we will discuss data processing landscape: concepts, usecases, technologies and open questions while drawing examples from real world scenarios.
http://icter.org/conference/invited_speeches
Real time and reliable processing with Apache StormAndrea Iacono
Storm is a framework for reliably processing streaming data. It allows defining topologies composed of spouts (data sources) and bolts (processing components). Spouts emit tuples that are processed by bolts which can emit additional tuples. The document describes a topology for processing tweets in real-time to identify top hashtags and display tweets on a map. It includes spouts to fetch tweets and bolts for filtering, counting hashtags, ranking them and storing results to Redis. Storm provides reliability by tracking processing of tuples through a topology using acknowledgments.
ConFoo - Exploring .NET’s memory management – a trip down memory laneMaarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Maarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Java Garbage Collection, Monitoring, and TuningCarol McDonald
The document discusses Java garbage collection. It explains that garbage collection automatically reclaims memory from objects that are no longer reachable to avoid memory leaks. It describes different garbage collection algorithms and strategies like generational and incremental garbage collection. It also discusses best practices and myths around memory management in Java.
The slides for the first ever SnappyData webinar. Covers SnappyData core concepts, programming models, benchmarks and more.
SnappyData is open sourced here: https://github.com/SnappyDataInc/snappydata
We also have a deep technical paper here: http://www.snappydata.io/snappy-industrial
We can be easily contacted on Slack, Gitter and more: http://www.snappydata.io/about#contactus
For More information, refer to Java EE 7 performance tuning and optimization book:
The book is published by Packt Publishing:
http://www.packtpub.com/java-ee-7-performance-tuning-and-optimization/book
How to approach a problem from a performance standpoint. A small real world application is used as a case study.
I\'ve presented "High Performance With Java" at Codebits\'2008 held from 13 to 15 November 2008
(*) Codebits is a programming contest held in Portugal held the spirit of Yahoo Hack! Day
Presentation from DICE Coder's Day (2010 November) by Andreas Fredriksson in the Frostbite team.
Goes into detail about Scope Stacks, which are a systems programming tool for memory layout that provides
• Deterministic memory map behavior
• Single-cycle allocation speed
• Regular C++ object life cycle for objects that need it
This makes it very suitable for games.
Hibernate provides object relational mapping and allows working with data at the object level rather than directly with SQL. It abstracts the underlying database, handles change detection and caching. The session factory handles connection pooling and caching of mappings. The session represents a unit of work and tracks changes to objects, flushing updates to the database at the end of the session. The first level cache tracks changes to objects within a session. Query caching caches query results to improve performance. The second level cache caches objects beyond a single session.
Even if your program is just a few lines of code, .NET's runtime will create a number of object in memory. Are all objects being destroyed by the garbage collector? Or is there a potential memory leak? And why is the application seemingly slow when having lots of objects in memory? In this webinar, we'll explore the new dotMemory 4 memory profiler. We'll see why we want to use a memory profiler and how easy it is to use JetBrains dotMemory for that.
Memory management best practices in Android include using the sparse array family for collections below 1,000 items, avoiding unnecessary object creation, using StringBuilder for string concatenation, properly closing streams to prevent memory leaks, and using patterns like object pools and flyweights to reduce memory usage. The onTrimMemory callback and memory monitoring tools like Memory Monitor and Heap Viewer can help detect memory issues and leaks in an Android application.
Find out more about:
• Techniques and tips to optimize trainingon Apache MXNet
• Infrastructure performance:storage and I/O, GPU throughput, distributed training, CPU-based training, cost
• Model performance:data augmentation, initializers, optimizers, etc.
• Level 666: you should be familiar with Deep Learning and MXNet
Optimizing training on Apache MXNet (January 2018)Julien SIMON
This document provides tips and techniques for optimizing training on Apache MXNet. It discusses optimizing infrastructure performance through efficient data storage and distribution, maximizing GPU usage through techniques like batch size tuning, and optimizing model performance through techniques like data augmentation, learning rate scheduling, and optimizer selection. The document demonstrates these concepts through examples and recommends experimenting to find the best approach for each problem.
Native Code, Off-Heap Data & JSON Facet API for Solr (Heliosearch)Yonik Seeley
My slides on Heliosearch/Solr, covering native code performance optimizations, off-heap data structures to prevent garbage collection issues, and the new JSON Facet API.
invited netflix talk: JVM issues in the age of scale! We take an under the hood look at java locking, memory model, overheads, serialization, uuid, gc tuning, CMS, ParallelGC, java.
Centralized log-management-with-elastic-stackRich Lee
Centralized log management is implemented using the Elastic Stack including Filebeat, Logstash, Elasticsearch, and Kibana. Filebeat ships logs to Logstash which transforms and indexes the data into Elasticsearch. Logs can then be queried and visualized in Kibana. For large volumes of logs, Kafka may be used as a buffer between the shipper and indexer. Backups are performed using Elasticsearch snapshots to a shared file system or cloud storage. Logs are indexed into time-based indices and a cron job deletes old indices to control storage usage.
ApacheCon2010: Cache & Concurrency Considerations in Cassandra (& limits of JVM)srisatish ambati
Cache & Concurrency considerations for a high performance Cassandra deployment.
SriSatish Ambati
Cassandra has hit it's stride as a distributed java NoSQL database! It's fast, it's in-memory, it's scalable, it's seda; It's eventually consistent model makes it practical for the large & growing volumes of unstructured data usecases. It is also time to run it through the filters of performance analysis. For starters it runs on the java virtual machine and inherits the capabilities and culpabilities of the platform. This presentation reviews the runtime architecture, cache behavior & performance of a real-world workload on Cassandra. We blend existing system & jvm tools to get a quick overview & a breakdown of hotspots in the get, put & update operations. We highlight the role played by garbage collection & fragmentation due to long lived objects; We investigate lock contention in the data structures under concurrent usage. Cassandra uses UDP for management & TCP for data: we look at robustness of the communication patterns during high spikes and cluster-wide events. We review Non-Blocking Hashmap modifications to Cassandra that improve concurrency & amplify performance of this frontrunner in the NoSQL space
ApacheCon2010 NA
Wed, 03 November 2010 15:00
cassandra
The document discusses several topics related to optimizing Java program performance including:
1. Using buffering and non-blocking I/O for file reading/writing to improve efficiency.
2. Minimizing network calls by retrieving related data in one call and using design patterns like the session facade.
3. Reusing objects when possible rather than constantly creating new instances to reduce garbage collection overhead.
Similar to CodeStock - Exploring .NET memory management - a trip down memory lane (20)
Bringing nullability into existing code - dammit is not the answer.pptxMaarten Balliauw
The C# nullability features help you minimize the likelihood of encountering that dreaded System.NullReferenceException. Nullability syntax and annotations give hints as to whether a type can be nullable or not, and better static analysis is available to catch unhandled nulls while developing your code. What's not to like?
Introducing explicit nullability into an existing code bases is a Herculean effort. There's much more to it than just sprinkling some `?` and `!` throughout your code. It's not a silver bullet either: you'll still need to check non-nullable variables for null.
In this talk, we'll see some techniques and approaches that worked for me, and explore how you can migrate an existing code base to use the full potential of C# nullability.
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Maarten Balliauw
After buying a set of Sonos-compatible speakers at IKEA, I was disappointed there's no support for playing audio from a popular video streaming service. They stream Internet radio, podcasts and what not. Well, not that service I want it to play!
Determined - and not knowing how deep the rabbit hole would be - I ventured on a trip that included network sniffing on my access point, learning about UPnP and running a web server on my phone (without knowing how to write anything Android), learning how MP4 audio is packaged (and has to be re-packaged). This ultimately resulted in an Android app for personal use, which does what I initially wanted: play audio from that popular video streaming service on Sonos.
Join me for this story about an adventure that has no practical use, probably violates Terms of Service, but was fun to build!
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
Space is a team tool that integrates chats, meetings, git hosting, automation, and more. It has an HTTP API to integrate third party apps and workflows, but it's massive! And slightly opinionated.
In this session, we will see how we built the .NET SDK for Space, and how we make that massive API more digestible. We will see how we used code generation, and incrementally made the API feel more like a real .NET SDK.
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices.
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider.
We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
https://blog.maartenballiauw.be/post/2019/07/30/indexing-searching-nuget-with-azure-functions-and-search.html
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchMaarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
Approaches for application request throttling - Cloud Developer Days PolandMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Maarten Balliauw
This document discusses indexing NuGet packages using Azure Functions and Azure Search to power search capabilities in ReSharper and Rider. It proposes using Functions triggered by changes to the NuGet.org catalog to download packages, index them using reflection metadata, and upload the results to an Azure Search index. Each step would be a separate function to allow independent scaling. The final system would watch the catalog, index new/updated packages, and provide APIs for searching packages by type or namespace.
Approaches for application request throttling - dotNetCologneMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
ConFoo Montreal - Approaches for application request throttlingMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
VISUG - Approaches for application request throttlingMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
What is going on - Application diagnostics on Azure - TechDays FinlandMaarten Balliauw
We all like building and deploying cloud applications. But what happens once that’s done? How do we know if our application behaves like we expect it to behave? Of course, logging! But how do we get that data off of our machines? How do we sift through a bunch of seemingly meaningless diagnostics? In this session, we’ll look at how we can keep track of our Azure application using structured logging, AppInsights and AppInsights analytics to make all that data more meaningful.
Everybody is consuming or producing NuGet packages these days. It’s easy, right? We’ll look beyond what everyone is doing. How can we use the NuGet client API to fetch data from NuGet? Can we build an application plugin system based on NuGet? What hidden gems are there in the NuGet server API? Can we create a full copy of NuGet.org?
Speaking from experience building MyGet.org: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Everybody is consuming NuGet packages these days. It’s easy, right? But how can we create and share our own packages? What is .NET Standard? How should we version, create, publish and share our package?
Once we have those things covered, we’ll look beyond what everyone is doing. How can we use the NuGet client API to fetch data from NuGet? Can we build an application plugin system based on NuGet? What hidden gems are there in the NuGet server API? Can we create a full copy of NuGet.org?
Good questions! In this talk, we will get them answered.
Sustainability requires ingenuity and stewardship. Did you know Pigging Solutions pigging systems help you achieve your sustainable manufacturing goals AND provide rapid return on investment.
How? Our systems recover over 99% of product in transfer piping. Recovering trapped product from transfer lines that would otherwise become flush-waste, means you can increase batch yields and eliminate flush waste. From raw materials to finished product, if you can pump it, we can pig it.
Measuring the Impact of Network Latency at TwitterScyllaDB
Widya Salim and Victor Ma will outline the causal impact analysis, framework, and key learnings used to quantify the impact of reducing Twitter's network latency.
The Rise of Supernetwork Data Intensive ComputingLarry Smarr
Invited Remote Lecture to SC21
The International Conference for High Performance Computing, Networking, Storage, and Analysis
St. Louis, Missouri
November 18, 2021
YOUR RELIABLE WEB DESIGN & DEVELOPMENT TEAM — FOR LASTING SUCCESS
WPRiders is a web development company specialized in WordPress and WooCommerce websites and plugins for customers around the world. The company is headquartered in Bucharest, Romania, but our team members are located all over the world. Our customers are primarily from the US and Western Europe, but we have clients from Australia, Canada and other areas as well.
Some facts about WPRiders and why we are one of the best firms around:
More than 700 five-star reviews! You can check them here.
1500 WordPress projects delivered.
We respond 80% faster than other firms! Data provided by Freshdesk.
We’ve been in business since 2015.
We are located in 7 countries and have 22 team members.
With so many projects delivered, our team knows what works and what doesn’t when it comes to WordPress and WooCommerce.
Our team members are:
- highly experienced developers (employees & contractors with 5 -10+ years of experience),
- great designers with an eye for UX/UI with 10+ years of experience
- project managers with development background who speak both tech and non-tech
- QA specialists
- Conversion Rate Optimisation - CRO experts
They are all working together to provide you with the best possible service. We are passionate about WordPress, and we love creating custom solutions that help our clients achieve their goals.
At WPRiders, we are committed to building long-term relationships with our clients. We believe in accountability, in doing the right thing, as well as in transparency and open communication. You can read more about WPRiders on the About us page.
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc
Six months into 2024, and it is clear the privacy ecosystem takes no days off!! Regulators continue to implement and enforce new regulations, businesses strive to meet requirements, and technology advances like AI have privacy professionals scratching their heads about managing risk.
What can we learn about the first six months of data privacy trends and events in 2024? How should this inform your privacy program management for the rest of the year?
Join TrustArc, Goodwin, and Snyk privacy experts as they discuss the changes we’ve seen in the first half of 2024 and gain insight into the concrete, actionable steps you can take to up-level your privacy program in the second half of the year.
This webinar will review:
- Key changes to privacy regulations in 2024
- Key themes in privacy and data governance in 2024
- How to maximize your privacy program in the second half of 2024
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionBert Blevins
Cybersecurity is a major concern in today's connected digital world. Threats to organizations are constantly evolving and have the potential to compromise sensitive information, disrupt operations, and lead to significant financial losses. Traditional cybersecurity techniques often fall short against modern attackers. Therefore, advanced techniques for cyber security analysis and anomaly detection are essential for protecting digital assets. This blog explores these cutting-edge methods, providing a comprehensive overview of their application and importance.
Mitigating the Impact of State Management in Cloud Stream Processing SystemsScyllaDB
Stream processing is a crucial component of modern data infrastructure, but constructing an efficient and scalable stream processing system can be challenging. Decoupling compute and storage architecture has emerged as an effective solution to these challenges, but it can introduce high latency issues, especially when dealing with complex continuous queries that necessitate managing extra-large internal states.
In this talk, we focus on addressing the high latency issues associated with S3 storage in stream processing systems that employ a decoupled compute and storage architecture. We delve into the root causes of latency in this context and explore various techniques to minimize the impact of S3 latency on stream processing performance. Our proposed approach is to implement a tiered storage mechanism that leverages a blend of high-performance and low-cost storage tiers to reduce data movement between the compute and storage layers while maintaining efficient processing.
Throughout the talk, we will present experimental results that demonstrate the effectiveness of our approach in mitigating the impact of S3 latency on stream processing. By the end of the talk, attendees will have gained insights into how to optimize their stream processing systems for reduced latency and improved cost-efficiency.
The DealBook is our annual overview of the Ukrainian tech investment industry. This edition comprehensively covers the full year 2023 and the first deals of 2024.
Best Programming Language for Civil EngineersAwais Yaseen
The integration of programming into civil engineering is transforming the industry. We can design complex infrastructure projects and analyse large datasets. Imagine revolutionizing the way we build our cities and infrastructure, all by the power of coding. Programming skills are no longer just a bonus—they’re a game changer in this era.
Technology is revolutionizing civil engineering by integrating advanced tools and techniques. Programming allows for the automation of repetitive tasks, enhancing the accuracy of designs, simulations, and analyses. With the advent of artificial intelligence and machine learning, engineers can now predict structural behaviors under various conditions, optimize material usage, and improve project planning.
How Social Media Hackers Help You to See Your Wife's Message.pdfHackersList
In the modern digital era, social media platforms have become integral to our daily lives. These platforms, including Facebook, Instagram, WhatsApp, and Snapchat, offer countless ways to connect, share, and communicate.
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Erasmo Purificato
Slide of the tutorial entitled "Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Emerging Trends" held at UMAP'24: 32nd ACM Conference on User Modeling, Adaptation and Personalization (July 1, 2024 | Cagliari, Italy)
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
5. Memory management and GC
“Virtually unlimited memory for our applications”
Big chunk of memory pre-allocated
Runtime manages allocation in that chunk
Garbage Collector (GC) reclaims unused memory, making it available again
6. .NET memory management 101
Memory allocation
Objects allocated in “managed heap” (big chunk of memory)
Allocating memory is fast, it’s just adding a pointer
Some unmanaged memory is also consumed (not GC-ed)
.NET CLR, Dynamic libraries, Graphics buffer, …
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap
7. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
GC releases objects no longer in use by examining application roots
GC builds a graph of all the objects that are reachable from these roots
Object unreachable? Remove object, release memory, compact heap
Takes time to scan all objects!
Generations
Large Object Heap
8. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap
Generation 0 Generation 1 Generation 2
Short-lived objects (e.g. Local
variables)
In-between objects Long-lived objects (e.g. App’s
main form)
9. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap (LOH)
Special segment for large objects (>85KB)
Collected only during full garbage collection
Not compacted (by default) -> fragmentation!
Fragmentation can cause OutOfMemoryException
10. The .NET garbage collector
Runs very often for gen0
Short-lived objects, few references, fast to clean
Local variable, web request/response
Higher generation
Usually more references, slower to clean
GC pauses the running application to do its thing
Usually short, except when not…
Background GC (enabled by default)
Concurrent with application threads
May still introduce short locks/pauses, usually just for one thread
11. The .NET garbage collector
When does it run? Vague… But usually:
Out of memory condition – when the system fails to allocate or re-allocate memory
After some significant allocation – if X memory is allocated since previous GC
Failure of allocating some native resources – internal to .NET
Profiler – when triggered from profiler API
Forced – when calling methods on System.GC
Application moves to background
GC is not guaranteed to run
http://blogs.msdn.com/b/oldnewthing/archive/2010/08/09/10047586.aspx
http://blogs.msdn.com/b/abhinaba/archive/2008/04/29/when-does-the-net-compact-framework-garbage-collector-run.aspx
12. Helping the GC, avoid pauses
Optimize allocations (use struct when it makes sense, Span<T>, object pooling)
Don’t allocate when not needed
Make use of IDisposable / using statement
Clean up references, giving the GC an easy job
Weak references
Allow the GC to collect these objects, no need for checks
Finalizers
Beware! Moved to finalizer queue -> always gen++
15. When is memory allocated?
Not for value types (int, bool, struct, decimal, enum, float, byte, long, …)
Allocated on stack, not on heap
Not managed by garbage collector
For reference types
When you new
When you load data into a variable, object, property, ...
16. Hidden allocations!
Boxing!
Put an int in a box
Take an int out of a box
Lambda’s/closures
Allocate compiler-generated
DisplayClass to capture state
Params arrays
And more!
int i = 42;
// boxing - wraps the value type in an "object box"
// (allocating a System.Object)
object o = i;
// unboxing - unpacking the "object box" into an int again
// (CPU effort to unwrap)
int j = (int)o;
17. How to find them?
Past experience
Intermediate Language (IL)
Profiler
“Heap allocations viewer”
ReSharper Heap Allocations Viewer plugin
Roslyn’s Heap Allocation Analyzer
19. Measure!
Don’t do premature optimization – measure!
Allocations don’t always matter (that much)
Measure!
How frequently are we allocating?
How frequently are we collecting?
What generation do we end up on?
Are our allocations introducing pauses?
www.jetbrains.com/dotmemory (and www.jetbrains.com/dottrace)
23. Object pools / object re-use
Re-use objects / collections (when it makes sense)
Fewer allocations, fewer objects for the GC to scan
Less memory traffic that can trigger a full GC
Object pooling - object pool pattern
Create a pool of objects that can be re-used
https://www.codeproject.com/articles/20848/c-object-pooling
“Optimize ASP.NET Core” - https://github.com/aspnet/AspLabs/issues/3
System.Buffers.ArrayPool
24. Garbage Collector summary
GC is optimized for high memory traffic in short-lived objects
Use that knowledge! Don’t fear allocations!
Don’t optimize what should not be optimized…
GC is the concept that makes .NET / C# tick – use it!
Know when allocations happen
GC is awesome
Gen2 collection that stop the world not so much…
Measure!
26. Strings are objects
.NET tries to make them look like a value type, but they are a reference type
Read-only collection of char
Length property
A bunch of operator overloading
Allocated on the managed heap
var a = new string('-', 25);
var b = a.Substring(5);
var c = httpClient.GetStringAsync("http://blog.maartenballiauw.be");
27. String literals
Are all strings on the heap? Are all strings duplicated?
var a = "Hello, World!";
var b = "Hello, World!";
Console.WriteLine(a == b);
Console.WriteLine(Object.ReferenceEquals(a, b));
Prints true twice. So “Hello World” only in memory once?
29. String literals in #US
Compile-time optimization
Store literals only once in PE header metadata stream ECMA-335 standard, section II.24.2.4
Reference literals (IL: ldstr)
var a = Console.ReadLine();
var b = Console.ReadLine();
Console.WriteLine(a == b);
Console.WriteLine(Object.ReferenceEquals(a, b));
30. String duplicates
Any .NET application has them (System.Globalization duplicates quite a few)
Are they bad?
.NET GC is fast for short-lived objects, so meh.
Don’t waste memory with string duplicates on gen2
(but: it’s okay to have strings there)
31. String interning
Store (and read) strings from the intern pool
Simply call String.Intern when “allocating” or reading the string
Scans intern pool and returns reference
var url = "http://blog.maartenballiauw.be";
var stringList = new List<string>();
for (int i = 0; i < 1000000; i++)
{
stringList.Add(string.Intern(url + "/"));
}
32. String interning caveats
Why are not all strings interned by default?
CPU vs. memory
Not on the heap but on intern pool
No GC on intern pool – all strings in memory for AppDomain lifetime!
Rule of thumb
Lot of long-lived, few unique -> interning good
Lot of long-lived, many unique -> no benefit, memory growth
Lot of short-lived -> trust the GC
Measure!
34. How would you...
…build a managed type system, store in memory, CPU/memory friendly
Probably:
Store type info (what’s in there, what’s the offset of fieldN, …)
Store field data (just data)
Store method pointers
Inheritance information
36. Stuff on the Managed Heap
(scroll down for more...)
37. Theory is nice...
Microsoft.Diagnostics.Runtime (ClrMD)
“ClrMD is a set of advanced APIs for programmatically inspecting a crash dump of
a .NET program much in the same way that the SOS Debugging Extensions (SOS)
do. This allows you to write automated crash analysis for your applications as well
as automate many common debugger tasks. In addition to reading crash dumps
ClrMD also allows supports attaching to live processes.”
“LINQ-to-heap”
Maarten’s definition
39. But... Why?
Programmatic insight into memory space of a running project
Unit test critical paths and assert behavior (did we clean up what we expected?)
Capture memory issues in running applications
Other (easier) options in this space
dotMemory Unit (JetBrains)
Benchmark.NET
42. Conclusion
Garbage Collector (GC) optimized for high memory traffic + short-lived objects
Don’t fear allocations! But beware of gen2 “stop the world”
Don’t optimize what should not be optimized…
Measure!
Using a profiler/memory analysis tool
ClrMD to automate inspections
dotMemory Unit, Benchmark.NET, … to profile unit tests
Blog series: https://blog.maartenballiauw.be
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Open TripDownMemoryLane.sln
Show WeakReferenceDemo (demo “1-1”)
Explain weak reference allows GC to collect reference
Show Cache object – has weak references to data, we expect these to probably be cleaned up by GC
Attach profiler, run demo “1-1”, snapshot, see 20 instances of WeakReference<Data>
Snapshot again, compare – see WeakReference<Data> has been regenerated a couple of times
Show DisposeObjectsDemo (demo “1-2”)
Explain first demo does not dispose and relies on GC + finalizers. This will mean our object remains in memory for two GC cycles!
Explain dispose does clean them up and requires only one cycle
In SampleDisposable, explain GC.SuppressFinalize -> tell the GC no finalizer queue work is needed here!
Open TripDownMemoryLane.sln
Show Demo02_Random
Open IL viewer tool window, show what happens in IL for each code sample
Explain IL viewer + hovering statements to see what they do
BoxingRing() – show boxing and unboxing statements in IL, explain they consume CPU and allocate an object
ParamsArray() – the call to ParamsArrayImpl() actually allocates a new string array! CPU + memory
AverageWithinBounds() – temporary class is created to capture state of all variables, then passed around
IL_0000: newobj instance void TripDownMemoryLane.Demo02.Demo02_Random/'<>c__DisplayClass3_0'::.ctor()
Lambdas() – same thing, temporary class to capture state in the loop
IL_001f: newobj instance void Allocatey.Talk.Demo02_Random/'<>c__DisplayClass4_0'::.ctor()
Show Demo02_ValidateArgumentsDemo – this one is fun!
Explain what we want to do: build a guard function – check a condition, show error
First one is the easy one, but it allocates a string and runs string.Format
Second one is better – does not allocate the string! But does allocate a function and a state capture...
Third one – allocates an array (params)
Fourth one – no allocations, yay! Using overloads...
Show heap allocations viewer!
Open TripDownMemoryLane.sln
Show BeersDemoUnoptimized (demo “3-1” and “3-2”)
Explain we’re building an application that shows all beers in the world and their ratings
Stored in beers.json (show document) with beer name, brewery, number of votes
For a view in our application, read this file into a multi-dimensional dictionary that contains breweries, beers, and their rating
Show BeerLoader and note the dictionary format
Show LoadBeersInsane and explain this is BAD BAD BAD because of the high memory usage
Show LoadBeersUnoptimized, explain what it does, optimized against the insane version as we’re streaming over our file
Load beers a number of times
Inspect snapshots
GC is very visible
Most memory in gen2 (we keep our beers around)
Compare two snapshots: high traffic on dictionary items
(Lots of string allocations - JSON.NET)
Show LoadBeersOptimized, explain what it does, re-using dictionary and updating items as we read the JSON
Load beers a number of times
Inspect snapshots
GC is almost invisible
Less allocations happening
Compare two snapshots: almost no traffic
Less work for GC, less pauses!
Measure and make it look good!
There is an old adage in IT that says “don’t do premature optimization”. In other words: maybe some allocations are okay to have, as the GC will take care of cleaning them up anyway. While some do not agree with this, I believe in the middle ground.
The garbage collector is optimized for high memory traffic in short-lived objects, and I think it’s okay to make use of what the .NET runtime has to offer us here. If it’s in a critical path of a production application, fewer allocations are better, but we can’t write software with zero allocations - it’s what our high-level programming language uses to make our developer life easier. It’s not okay to have objects go to gen2 and stay there when in fact they should be gone from memory.
Learn where allocations happen, using any of the above methods, and profile your production applications frequently to see if there are large objects in higher generations of the heap that don’t belong there.
Will print “true” twice.
Open our demo application in dotPeek
Explain PE headers
Show #US table
Open StringAllocationDemo class. Jump to IL code, show ldstr statement for strings that are in #US table
Code = trick question, what if we enter same value twice? String equals, reference not equals!
How many strings are stored
How many strings are stored
Open ClrMD.sln
Explain: two projects, one target application, one running ClrMD to analyze what we have
Open ClrMD.Explorer.Program, show attaching ClrMD
Get CLR version – gets info about the current CLR version
Get runtime – gets info about the actual runtime hosting our app
Show DumpClrInfo – get info, stress DAC data access components location – defines the runtime structures, used by ClrMD and VS Debugger etc to explore runtime while debugging/profiling/...
Explore DumpHeapObjects, stress the heap structure
Loop object addresses - foreach (var objectAddress in generation)
Get type of object at address - var type = heap.GetObjectType(objectAddress.Ptr);
Use type info to get value - type.GetValue(objectAddress.Ptr)
Explore type autocomplete – structure to get enum, method addresses, ...
Open TestsWithDMU.sln
Explain: similar Clock leak as in previous demo
Two unit tests that create the clock, and timer. Then run GC.Collect, then use dMU to check whether instances are left in memory.
Easy way to test, after investigation, when a memory leak comes back (or not)