The document provides an introduction to Ruby memory management and garbage collection. It discusses how Ruby uses garbage collection to automatically free memory for objects rather than requiring explicit freeing like in C. It then covers how the garbage collector works, when it is triggered, and how to tune garbage collection settings. It provides examples of how to optimize Ruby code for memory efficiency and compares different approaches.
The Titanium OpenGL Module (Ti.OpenGL) opens the door to sophisticated graphics development for the Titanium programmer by exposing the entire OpenGL ES 1 and ES 2 graphics API to the Ti Javascript environment. The Ti.OpenGL view extends Ti.UI.View with a graphics rendering canvas that is easily managed within the Titanium view hierarchy. In addition, the module provides a databuffer object to hold large datasets and mitigate any inefficiency that arises from modeling datasets in Javascript.
This talk demonstrates the pragmatics of building sophisticated graphics displays using Ti.OpenGL in both ES 1 and ES 2. It will reveal several reusable design abstractions that take advantage of features of the Javascript environment. Among the topics to be covered are:
- OpenGL basic setup and animation
- Use of databuffers for attribute and index arrays
- Connecting databuffers and vertex buffer objects (vbo’s)
- Using external resources (textures, shaders, etc.)
Abstract: Nowadays it’s only a lazy one who haven’t written his own metric storage and aggregation system. I am lazy, and that’s why I have to choose what to use and how to use. I don’t want you to do the same job, so I decided to share my considerations concerning architectures and test results.
The Titanium OpenGL Module (Ti.OpenGL) opens the door to sophisticated graphics development for the Titanium programmer by exposing the entire OpenGL ES 1 and ES 2 graphics API to the Ti Javascript environment. The Ti.OpenGL view extends Ti.UI.View with a graphics rendering canvas that is easily managed within the Titanium view hierarchy. In addition, the module provides a databuffer object to hold large datasets and mitigate any inefficiency that arises from modeling datasets in Javascript.
This talk demonstrates the pragmatics of building sophisticated graphics displays using Ti.OpenGL in both ES 1 and ES 2. It will reveal several reusable design abstractions that take advantage of features of the Javascript environment. Among the topics to be covered are:
- OpenGL basic setup and animation
- Use of databuffers for attribute and index arrays
- Connecting databuffers and vertex buffer objects (vbo’s)
- Using external resources (textures, shaders, etc.)
Abstract: Nowadays it’s only a lazy one who haven’t written his own metric storage and aggregation system. I am lazy, and that’s why I have to choose what to use and how to use. I don’t want you to do the same job, so I decided to share my considerations concerning architectures and test results.
Big Data Day LA 2015 - Large Scale Distinct Count -- The HyperLogLog algorith...Data Con LA
"At OpenX we not only use the tools in big data ecosystems to solve our business problems, but also explore the cutting edge algorithms for practical uses. HyperLogLog is one of the algorithm that we use intensively in our internal system. It has really low computation cost and can easily plug into map-reduce framework (hadoop or spark). Some of the applications that worth to highlight are:
* high cardinality test
* distinct count of unique users over time
* Visualize hyperloglog for fraud detection"
Do something in 5 minutes with gas 1-use spreadsheet as databaseBruce McPherson
Here's one in a series of tutorials where you can do something useful from scratch in 5 minutes using Google Apps Script. This example shows how to use a Google Spreadsheet as a database
Probabilistic data structures. Part 2. CardinalityAndrii Gakhov
The book "Probabilistic Data Structures and Algorithms in Big Data Applications" is now available at Amazon and from local bookstores. More details at https://pdsa.gakhov.com
In the presentation, I described common data structures and algorithms to estimate the number of distinct elements in a set (cardinality), such as Linear Counting, HyperLogLog, and HyperLogLog++. Each approach comes with some math that is behind it and simple examples to clarify the theory statements.
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetBruce McPherson
Another in the 'do something useful with Google Apps Script' series. This time you'll see how to use the Analytics service and use exponential backoff to mitigate for quota rate limiting.
In class, we discussed min-heaps. In a min-heap the element of the heap with ...licservernoida
In class, we discussed min-heaps. In a min-heap the element of the heap with the smallest key is the root of a binary tree. A max-heap has as root
always the element with the biggest key and the relationship between the keys of a node and its parent is less than or equal (). Your task is to
develop your own binary tree ADT and your own flex-heap ADT. The flex-heap ADT must implement a min- as well as a max-heap. Apparently,
instead of defining a removeMin or removeMax operation you will only provide a remove operation in your flex-heap. It must be implemented
using your binary tree ADT. You have to implement these two ADTs in Java. The flex-heap ADT has to additionally support the dynamic switch
from a min- to a max-heap and vice versa: remove() removes and returns the element with the smallest or biggest key value depending on the heap
status (min-heap vs. max-heap) and repairs the flex-heap afterwards accordingly. toggleHeap() transforms a min- to a max-heap or vice versa.
switchMinHeap() transforms a max- to a min-heap. switchMaxHeap() transforms a min- to a max-heap. Binary trees must be implemented with an
extendable array-list similar to what we discussed in class and in §7.3.5 of the textbook. You are not allowed to implement trees with lists. Further,
you are not allowed to use any array-list, queue, vector, (binary) tree, or heap interfaces already available in Java. Your toggleHeap,
switchMinHeap, and switchMaxHeap operations must run in O(n) time. All other flex-heap operations must be either in O(1) or O(log n). You
may safely assume for the binary tree and flex-heap ADT that keys are of type integer and values are of type character. So, the use of generics is
not required. You have to submit the following deliverables: a) Specification of the binary tree and flex-heap ADTs including comments about
assumptions and semantics (especially about the 3 added flex-heap operations). b) Pseudo code of your implementation of the binary tree and
flex-heap ADTs. Keep in mind that Java code will not be considered as pseudo code. Your pseudo code must be on a higher and more abstract
level. c) Well-formatted and documented Java source code and the corresponding executable jar file with at least 20 different but representative
examples demonstrating the functionality of your implemented ADTs. These examples should demonstrate all cases of your ADT functionality (e.g.,
all operations of your ADTs, sufficient sizes of flex-heaps, sufficient number of down and up-heap, toggleHeap, switchMinHeap, and
switchMaxHeap operations). You must have separate tests for each ADT but the majority of tests should cover flex-heaps because they are
implemented using binary trees.
Taming Go's Memory Usage — and Avoiding a Rust RewriteScyllaDB
Last summer, my team and I faced a question many young startups face. Should we rewrite our system in Rust?
At the time of the decision, we were primarily writing in Go. I was working on an agent that passively watches network traffic, parses API calls, and sends obfuscated summaries back to our service for analysis. As users were starting to run more traffic through us, memory usage by the agent grew to an unacceptably high level, impacting performance.
This led me to spend 25 days in despair and immerse myself in the details of Go’s memory management, our technology stack, and the profiling tools available – trying to get our memory footprint back under control. Go’s fully automatic memory management makes this no easy feat.
Spoiler: I emerged victorious and our team still uses Go. In this talk, I’ll talk about key steps and lessons learned from my project. I intend this talk to be helpful for people curious about reducing their memory footprint in Go, or anybody wondering about the tradeoffs of switching to or from Go.
Big Data Day LA 2015 - Large Scale Distinct Count -- The HyperLogLog algorith...Data Con LA
"At OpenX we not only use the tools in big data ecosystems to solve our business problems, but also explore the cutting edge algorithms for practical uses. HyperLogLog is one of the algorithm that we use intensively in our internal system. It has really low computation cost and can easily plug into map-reduce framework (hadoop or spark). Some of the applications that worth to highlight are:
* high cardinality test
* distinct count of unique users over time
* Visualize hyperloglog for fraud detection"
Do something in 5 minutes with gas 1-use spreadsheet as databaseBruce McPherson
Here's one in a series of tutorials where you can do something useful from scratch in 5 minutes using Google Apps Script. This example shows how to use a Google Spreadsheet as a database
Probabilistic data structures. Part 2. CardinalityAndrii Gakhov
The book "Probabilistic Data Structures and Algorithms in Big Data Applications" is now available at Amazon and from local bookstores. More details at https://pdsa.gakhov.com
In the presentation, I described common data structures and algorithms to estimate the number of distinct elements in a set (cardinality), such as Linear Counting, HyperLogLog, and HyperLogLog++. Each approach comes with some math that is behind it and simple examples to clarify the theory statements.
Do something in 5 with gas 4- Get your analytics profiles to a spreadsheetBruce McPherson
Another in the 'do something useful with Google Apps Script' series. This time you'll see how to use the Analytics service and use exponential backoff to mitigate for quota rate limiting.
In class, we discussed min-heaps. In a min-heap the element of the heap with ...licservernoida
In class, we discussed min-heaps. In a min-heap the element of the heap with the smallest key is the root of a binary tree. A max-heap has as root
always the element with the biggest key and the relationship between the keys of a node and its parent is less than or equal (). Your task is to
develop your own binary tree ADT and your own flex-heap ADT. The flex-heap ADT must implement a min- as well as a max-heap. Apparently,
instead of defining a removeMin or removeMax operation you will only provide a remove operation in your flex-heap. It must be implemented
using your binary tree ADT. You have to implement these two ADTs in Java. The flex-heap ADT has to additionally support the dynamic switch
from a min- to a max-heap and vice versa: remove() removes and returns the element with the smallest or biggest key value depending on the heap
status (min-heap vs. max-heap) and repairs the flex-heap afterwards accordingly. toggleHeap() transforms a min- to a max-heap or vice versa.
switchMinHeap() transforms a max- to a min-heap. switchMaxHeap() transforms a min- to a max-heap. Binary trees must be implemented with an
extendable array-list similar to what we discussed in class and in §7.3.5 of the textbook. You are not allowed to implement trees with lists. Further,
you are not allowed to use any array-list, queue, vector, (binary) tree, or heap interfaces already available in Java. Your toggleHeap,
switchMinHeap, and switchMaxHeap operations must run in O(n) time. All other flex-heap operations must be either in O(1) or O(log n). You
may safely assume for the binary tree and flex-heap ADT that keys are of type integer and values are of type character. So, the use of generics is
not required. You have to submit the following deliverables: a) Specification of the binary tree and flex-heap ADTs including comments about
assumptions and semantics (especially about the 3 added flex-heap operations). b) Pseudo code of your implementation of the binary tree and
flex-heap ADTs. Keep in mind that Java code will not be considered as pseudo code. Your pseudo code must be on a higher and more abstract
level. c) Well-formatted and documented Java source code and the corresponding executable jar file with at least 20 different but representative
examples demonstrating the functionality of your implemented ADTs. These examples should demonstrate all cases of your ADT functionality (e.g.,
all operations of your ADTs, sufficient sizes of flex-heaps, sufficient number of down and up-heap, toggleHeap, switchMinHeap, and
switchMaxHeap operations). You must have separate tests for each ADT but the majority of tests should cover flex-heaps because they are
implemented using binary trees.
Taming Go's Memory Usage — and Avoiding a Rust RewriteScyllaDB
Last summer, my team and I faced a question many young startups face. Should we rewrite our system in Rust?
At the time of the decision, we were primarily writing in Go. I was working on an agent that passively watches network traffic, parses API calls, and sends obfuscated summaries back to our service for analysis. As users were starting to run more traffic through us, memory usage by the agent grew to an unacceptably high level, impacting performance.
This led me to spend 25 days in despair and immerse myself in the details of Go’s memory management, our technology stack, and the profiling tools available – trying to get our memory footprint back under control. Go’s fully automatic memory management makes this no easy feat.
Spoiler: I emerged victorious and our team still uses Go. In this talk, I’ll talk about key steps and lessons learned from my project. I intend this talk to be helpful for people curious about reducing their memory footprint in Go, or anybody wondering about the tradeoffs of switching to or from Go.
.NET Core, ASP.NET Core Course, Session 4aminmesbahi
Session 4,
What is Garbage Collector?
Fundamentals of memory
Conditions for a garbage collection
Generations
Configuring garbage collection
Workstation
Server
What are some of the performance implications of using lambdas and what strategies can be used to address these. When might be want an alternative to using a lambda and how can we design our APIs to be flexible in this regard. What are the principles of writing low latency code in Java? How do we tune and optimize our code for low latency? When don’t we optimize our code? Where does the JVM help and where does it get in our way? How does this apply to lambdas? How can we design our APIs to use lambdas and minimize garbage?
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...Rob Skillington
The world in which we monitor software is growing more complex every year. There are increasingly more ways to run server-side software, with many more independent services and more points of failures, the list goes on! On the plus side, there’s a lot of great tools and patterns being developed to try and make things simple to assess and understand. This talk covers how metrics and monitoring can be leveraged in a variety of different ways, auto-discovering applications and their usage of databases, caches, load balancers, etc, setting up and tearing down dashboards and monitoring automatically for services and instances, and more.
We’ll also talk about how you can accomplish all this with a global view of your systems using both Prometheus and Graphite with M3, our open source metrics platform. We’ll take a deep dive look at how we use M3DB, distributed aggregation with the M3 aggregator and the M3 Kubernetes operator to horizontally scale a metrics platform in a way that doesn’t cost outrageous amounts to run with a system that’s still sane to operate with petabytes of metrics data.
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!
MongoDB 4.2 comes GA soon delivering some amazing new features on multiple areas. In this talk, we will focus on changes related to sharded clusters. We are going to cover distributed transactions & mutable shard keys providing examples that will reveal the internals of those new features. We will provide best practices around the new sharding features and we will cover other minor changes related to it.
This session brings to your attention how several millions of dollars are wasted and what you can do to save money. Optimizing garbage collection performance not only saves money, but also improves the overall customer experience as well.
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.
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
Talk presented at Kubernetes Community Day, New York, May 2024.
Technical summary of Multi-Cluster Kubernetes Networking architectures with focus on 4 key topics.
1) Key patterns for Multi-cluster architectures
2) Architectural comparison of several OSS/ CNCF projects to address these patterns
3) Evolution trends for the APIs of these projects
4) Some design recommendations & guidelines for adopting/ deploying these solutions.
1.Wireless Communication System_Wireless communication is a broad term that i...JeyaPerumal1
Wireless communication involves the transmission of information over a distance without the help of wires, cables or any other forms of electrical conductors.
Wireless communication is a broad term that incorporates all procedures and forms of connecting and communicating between two or more devices using a wireless signal through wireless communication technologies and devices.
Features of Wireless Communication
The evolution of wireless technology has brought many advancements with its effective features.
The transmitted distance can be anywhere between a few meters (for example, a television's remote control) and thousands of kilometers (for example, radio communication).
Wireless communication can be used for cellular telephony, wireless access to the internet, wireless home networking, and so on.
This 7-second Brain Wave Ritual Attracts Money To You.!nirahealhty
Discover the power of a simple 7-second brain wave ritual that can attract wealth and abundance into your life. By tapping into specific brain frequencies, this technique helps you manifest financial success effortlessly. Ready to transform your financial future? Try this powerful ritual and start attracting money today!
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC
Ellisha Heppner, Grant Management Lead, presented an update on APNIC Foundation to the PNG DNS Forum held from 6 to 10 May, 2024 in Port Moresby, Papua New Guinea.
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
2. Hi, I’m Bruce
6 ½ years experience developing
complex Ruby on Rails applications
4 years as Senior Lead Developer
at Prezentt
5 years as Technical Director at
GTP iCommerce
3. Agenda
• Introduction to the Garbage Collector
• Garbage Collector Tuning
• General tips and tricks
4. C code vs Ruby cde
void my_function() {
char *stack = "Hello";
char *heap = malloc(6);
strncopy(heap, "world", 5);
free(heap);
}
Memory explicitly allocated on the
stack or the heap
Heap allocated memory must be
free()’d or it will leak
def my_function
local = "Hello"
@instance = "world"
end
No stack allocated variables, even local
variables live on the heap
Memory is freed automatically
How does it do this?
5. Garbage Collection
The Ruby interpreter will trigger
garbage collection to free memory
when certain conditions are met.
Ruby uses a “Stop the world”
mechanism which is the cause of
many performance problems.
6. How Garbage Collection Works
Ruby < 2.0 used various mark and sweep algorithms.
Traverses object graph and checks if the memory is still in
use.
Ruby 2.0 replaced it with a Bitmap Marking algorithm. Each
heap has a corresponding memory structure with bit
values indicating if allocated memory is still in use.
Ruby 2.1 added a Generational Garbage Collection
algorithm. “Minor” sweep focuses on newly allocated
memory. “Major” sweep checks entire object graph.
7. Garbage Collection Triggers
Minor Garbage Collection (Fast, looks at new objects)
• Not enough space on the heap to allocate new objects
• Every 16-32Mb of memory allocated in new objects
Major Garbage Collection (Slow, looks at all objects)
• Number of old objects increases by more than a factor of 2
• Every 16-32Mb of memory allocated in old objects
8. Garbage Collection Tuning
Goal is to manage a tradeoff between memory usage vs. the
frequency and duration of garbage collection.
RUBY_GC_HEAP_GROWTH_FACTOR (1.8)
The factor by which the size of the heap grows when it needs to be expanded
RUBY_GC_MALLOC_LIMIT & _MAX (16Mb - 32Mb)
The minimum value for malloc limits that would trigger a Minor Garbage
Collection.
RUBY_GC_OLDMALLOC_LIMIT & _MAX (16Mb - 32Mb)
The minimum value for malloc limits that would trigger a Major Garbage
Collection.
9. Garbage Collection Tuning (Cont)
How do we know which values to change, and to what?
• Monitor changes with GC.stat
• Great third party tools like New Relic and Scout
• My favourite: TuneMyGC (https://tunemygc.com/)
10. TuneMyGC
How do we know which values t change, and to what?
• Monitor changes with GC.stat
• Great third party tools like New Relic and Scout
• My favourite: TuneMyGC (https://tunemygc.com/)
15. Memory Efficient Ruby
Lots of advice out there on micro-optimisation, avoid:
require 'objspace'
ObjectSpace.memsize_of([]) # => 40
ObjectSpace.memsize_of([1,2,3]) # => 40
ObjectSpace.memsize_of([1,2,3,4]) # => 72
Writing beautiful Ruby is more important than saving mere
bytes.
The best memory saving comes from not allocating
additional objects if you can avoid it.
16. Memory Efficient Ruby
require 'memory_profiler'
large_array = [*1..1_000_000]
report = MemoryProfiler.report do
new_array = large_array.map { |el| el * 2 }
end
report.total_allocated_memsize # => 8000040
report = MemoryProfiler.report do
large_array.map! { |el| el * 2 }
end
report.total_allocated_memsize # => 0