SlideShare uma empresa Scribd logo
1 de 78
A miało być tak…
bez wycieków!
Konrad Kokosa
Jeden bajt
Pamięć
po
prostu
jest?
Kiedyś
Kiedyś
to
było,
kurła…
Teraz…
“MySQL instances created before April 2014 used
an ext3 filesystem which has a 2TB file size limit”
Brian Donohue @ Instapaper
“All non-trivial abstractions, to some degree, are leaky.”
Pamięć vs CPU
https://mechanical-sympathy.blogspot.com/2013/02/cpu-cache-flushing-fallacy.html
“Latency Numbers Every Programmer Should Know”
https://gist.github.com/jboner/2841832
Norvig’s Nowadays
(Haswell i7 @2.3Ghz)
L1 cache reference 0.5 ns <2.0 ns
L2 cache reference 7.0 ns 4.8 ns
L3 cache reference 14.4 ns
Main memory reference 100 ns 71.4 ns
Disk seek 10 000 000 ns 150 000 ns
Hardware - ISA - System -
Framework (JVM, CLR, Go,
…) - Programista
int n = 5000;
int m = 5000;
int[,] tab = new int[n, m];
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
tab[j, i] = 1;
}
}
int n = 5000;
int m = 5000;
int[,] tab = new int[n, m];
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
tab[i, j] = 1;
}
}
Method | Size | Mean | Error | StdDev |
--------- |----- |---------------:|--------------:|--------------:|
IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us |
JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us |
Method | Size | Mean | Error | StdDev |
--------- |----- |---------------:|--------------:|--------------:|
IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us |
JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us |
IJAccess | 500 | 459.295 us | 8.8558 us | 7.3950 us |
JIAccess | 500 | 616.643 us | 11.3232 us | 10.0377 us |
Method | Size | Mean | Error | StdDev |
--------- |----- |---------------:|--------------:|--------------:|
IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us |
JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us |
IJAccess | 500 | 459.295 us | 8.8558 us | 7.3950 us |
JIAccess | 500 | 616.643 us | 11.3232 us | 10.0377 us |
IJAccess | 5000 | 48,728.263 us | 273.4506 us | 255.7859 us |
JIAccess | 5000 | 243,778.158 us | 6,232.9454 us | 5,525.3433 us |
public static int[] counters = new int[4];
...
Thread[] workers = new Thread[4];
for (int i = 0; i < 4; ++i)
{
workers[i] = new Thread(idx =>
{
int index = (int)idx;
for (int j = 0; j < 100_000_000; ++j)
{
counters[index] = counters[index] + 1;
}
});
}
64B (cache-line)
64B (cache-line)
64B (cache-line)
Method | Mean | Error | StdDev |
-------------- |---------:|----------:|----------:|
DoSharingTest | 925.7 ms | 19.233 ms | 46.816 ms |
DoSharingTest2 | 338.4 ms | 9.131 ms | 26.779 ms |
DoSharingTest3 | 166.8 ms | 1.732 ms | 1.536 ms |
Data Oriented Design
input -> data transformation -> output
“Problem Oriented Design” with an efficient data
transformations
Array of Structs
vs
Struct of Arrays
class CustomerClassRepository
{
List<Customer> customers = new List<Customer>();
public void UpdateScorings()
{
foreach (var customer in customers)
{
customer.UpdateScoring();
}
}
}
public class Customer
{
private double Earnings;
private DateTime DateOfBirth;
private bool IsSmoking;
private double Scoring;
private HealthData Health;
private AuxiliaryData Auxiliary;
private Company Employer;
public void UpdateScoring()
{
Scoring = Earnings * (IsSmoking ? 0.8 : 1.0) * ProcessAge(DateOfBirth);
}
private double ProcessAge(DateTime dateOfBirth) => dateOfBirth.Year / 2048.0;
}
class Program
{
// NuGet package ObjectLayoutInspector
static void Main(string[] args)
{
TypeLayout.PrintLayout(typeof(Customer));
Console.ReadLine();
}
public class Customer
{
private double Earnings;
private DateTime DateOfBirth;
private bool IsSmoking;
private double Scoring;
private HealthData Health;
private AuxiliaryData Auxiliary;
private Company Employer;
}
}
public void UpdateScoring()
{
Scoring = Earnings * (IsSmoking ? 0.8 : 1.0) *
ProcessAge(DateOfBirth);
}
Size: 56 bytes. Paddings: 7 bytes (%12 of empty space)
|==========================================|
| Object Header (8 bytes) |
|------------------------------------------|
| Method Table Ptr (8 bytes) |
|==========================================|
| 0-7: HealthData Health (8 bytes) |
|------------------------------------------|
| 8-15: AuxiliaryData Auxiliary (8 bytes) |
|------------------------------------------|
| 16-23: Company Employer (8 bytes) |
|------------------------------------------|
| 24-31: Double Earnings (8 bytes) |
|------------------------------------------|
| 32-39: Double Scoring (8 bytes) |
|------------------------------------------|
| 40: Boolean IsSmoking (1 byte) |
|------------------------------------------|
| 41-47: padding (7 bytes) |
|------------------------------------------|
| 48-55: DateTime DateOfBirth (8 bytes) |
|==========================================|Cacheline#1acheline2
Method | Mean | Allocated | LlcMisses/Op | LlcReference/Op |
------------- |-----------:|----------:|-------------:|----------------:|
ObjectStyle | 2,152.5 us | 0 B | 24680 | 30031 |
class CustomerRepositoryDOD
{
int NumberOfCustomers;
double[] Scoring;
double[] Earnings;
bool[] IsSmoking;
int[] YearOfBirth;
DateTime[] DateOfBirth;
// ...
public void UpdateScorings()
{
for (int i = 0; i < NumberOfCustomers; ++i)
{
Scoring[i] = Earnings[i] * (IsSmoking[i] ? 0.8 : 1.0) * ProcessAge(YearOfBirth[i]);
}
}
public double ProcessAge(int yearOfBirth) => yearOfBirth / 2048.0;
}
// No any Customer!!!
Method | Mean | Allocated | LlcMisses/Op | LlcReference/Op |
------------- |-----------:|----------:|-------------:|----------------:|
ObjectStyle | 2,152.5 us | 0 B | 24680 | 30031 |
DoDStyle | 213.9 us | 0 B | 272 | 816 |
Entity Component System
Przykłady: Unity3D ECS, Entitas…
The Garbage Collector
[HttpGet]
[Route("values/concatenated/{count}")]
public string GetConcatenated(int count)
{
Random rand = new Random();
string result = string.Empty;
for (int i = 0; i <= count; i++)
{
result += "<Customer Id="";
result += i.ToString();
result += "" lastUpdateDate="";
result += DateTime.Now.ToString();
result += "" branchId="";
result += i.ToString();
result += "" firstName="";
result += i.ToString(); ;
result += "" lastName="";
result += "This is the customer with the Id: ";
result += i.ToString();
result += "" ranking="";
result += rand.Next(100).ToString();
result += ""/>";
}
result = "<Customers>" +
result +
"</Customers>";
return result;
}
[HttpGet]
[Route("values/builder/{count}")]
public string GetBuilder(int count)
{
Random rand = new Random();
StringBuilder sb = new StringBuilder("<Customers>");
for (int i = 0; i <= count; i++)
{
sb.Append("<Customer Id="");
sb.Append(i.ToString());
sb.Append("" lastUpdateDate="");
sb.Append(DateTime.Now.ToString());
sb.Append("" branchId="");
sb.Append(i.ToString());
sb.Append("" firstName="");
sb.Append(i.ToString());
sb.Append("" lastName="");
sb.Append("This is the customer with the Id: ");
sb.Append(i.ToString());
sb.Append("" ranking="");
sb.Append(rand.Next(100).ToString());
sb.Append(""/>");
}
sb.Append("</Customers>");
return sb.ToString();
}
All non-trivial abstractions, to some degree, are leaky.
-server -Xss4096k -Xms12G -Xmx12G -XX:MaxPermSize=512m
-XX:+HeapDumpOnOutOfMemoryError -verbose:gc -Xmaxf1
-XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:+AggressiveOpts
-XX:+ScavengeBeforeFullGC -XX:CMSFullGCsBeforeCompaction=10
-XX:CMSInitiatingOccupancyFraction=80 -XX:+UseParNewGC
-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing -XX:+CMSParallelRemarkEnabled
-XX:GCTimeRatio=19 -XX:+UseAdaptiveSizePolicy
-XX:MaxGCPauseMillis=500 -XX:+PrintGCTaskTimeStamps
-XX:+PrintGCApplicationStoppedTime -XX:+PrintHeapAtGC
-XX:+PrintTenuringDistribution -XX:+PrintGCDetails
-XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime
-XX:+PrintTenuringDistribution -Xloggc:gc.log
-server -Xms24G -Xmx24G -XX:PermSize=512m -XX:+UseG1GC
-XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20
-XX:ConcGCThreads=5
-XX:InitiatingHeapOccupancyPercent=70
Czy to musi tak być…?
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
From: k...@rational.com (Kent Mitchell)
Subject: Re: Does memory leak?
Date: 1995/03/31
Norman H. Cohen (nco...@watson.ibm.com) wrote:
: The only programs I know of with deliberate memory leaks are those whose
: executions are short enough, and whose target machines have enough
: virtual memory space, that running out of memory is not a concern.
: (This class of programs includes many student programming exercises and
: some simple applets and utilities; it includes few if any embedded or
: safety-critical programs.)
This sparked an interesting memory for me. I was once working with a
customer who was producing on-board software for a missile. In my analysis
of the code, I pointed out that they had a number of problems with storage
leaks. Imagine my surprise when the customers chief software engineer said
"Of course it leaks". He went on to point out that they had calculated the
amount of memory the application would leak in the total possible flight time
for the missile and then doubled that number. They added this much additional
memory to the hardware to "support" the leaks. Since the missile will explode
when it hits its target or at the end of its flight, the ultimate in garbage
collection is performed without programmer intervention.
Epsilon GC
.NET Core 2.1+:
COMPlus_GCName=F:CoreCLR.ZeroGCx64ReleaseOurCustomGC.dll
A czy można inaczej…?
Witaj
Rust!
let s1 = String::from("hello");
let s2 = s1;
println!("{}, world!", s1);
error[E0382]: use of moved value: `s1`
--> src/main.rs:5:28
|
3 | let s2 = s1;
| -- value moved here
4 |
5 | println!("{}, world!", s1);
| ^^ value used here after move
|
= note: move occurs because `s1` has type `std::string::String`, which does
not implement the `Copy` trait
fn main() {
let s = String::from("hello"); // s comes into scope
takes_ownership(s); // s's value moves into the function...
// ... and so is no longer valid here
}
fn takes_ownership(some_string: String) { // some_string comes into scope
println!("{}", some_string);
} // Here, some_string goes out of scope and `drop` is called. The backing
// memory is freed.
fn main() {
let s = String::from("hello");
use(&s);
}
fn use(some_string: &String) {
// …
}
fn main() {
let s = String::from("hello");
change(&s);
}
fn change(some_string: &String) {
some_string.push_str(", world");
}
error[E0596]: cannot borrow immutable borrowed content `*some_string` as mutable
--> error.rs:8:5
|
7 | fn change(some_string: &String) {
| ------- use `&mut String` here to make mutable
8 | some_string.push_str(", world");
| ^^^^^^^^^^^ cannot borrow as mutable
fn main() {
let mut s = String::from("hello");
change(&mut s);
}
fn change(some_string: &mut String) {
some_string.push_str(", world");
}
let mut s = String::from("hello");
let r1 = &mut s;
let r2 = &mut s;
println!("{}, {}", r1, r2);
error[E0499]: cannot borrow `s` as mutable more than once at a time
--> src/main.rs:5:14
|
4 | let r1 = &mut s;
| ------ first mutable borrow occurs here
5 | let r2 = &mut s;
| ^^^^^^ second mutable borrow occurs here
6 |
7 | println!("{}, {}", r1, r2);
| -- first borrow later used here
let mut s = String::from("hello");
let r1 = &s; // no problem
let r2 = &s; // no problem
let r3 = &mut s; // BIG PROBLEM
println!("{}, {}, and {}", r1, r2, r3);
error[E0502]: cannot borrow `s` as mutable because it is also borrowed as
immutable
--> src/main.rs:6:14
|
4 | let r1 = &s; // no problem
| -- immutable borrow occurs here
5 | let r2 = &s; // no problem
6 | let r3 = &mut s; // BIG PROBLEM
| ^^^^^^ mutable borrow occurs here
7 |
8 | println!("{}, {}, and {}", r1, r2, r3);
| -- immutable borrow later used here
Mechanical
Sympathy
“You don’t have to be an engineer to be a racing
driver, but you do have to have Mechanical
Sympathy.”
Jackie Stewart, racing driver
Dziękuję!
Pytania?

Mais conteúdo relacionado

Mais procurados

My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningPuneet Behl
 
The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196Mahmoud Samir Fayed
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsTimur Shemsedinov
 
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaPraktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaMuhammad Yusuf
 
Database Wizardry for Legacy Applications
Database Wizardry for Legacy ApplicationsDatabase Wizardry for Legacy Applications
Database Wizardry for Legacy ApplicationsGabriela Ferrara
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genMongoDB
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
NDC London 2013 - Mongo db for c# developers
NDC London 2013 - Mongo db for c# developersNDC London 2013 - Mongo db for c# developers
NDC London 2013 - Mongo db for c# developersSimon Elliston Ball
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
Recent Changes to jQuery's Internals
Recent Changes to jQuery's InternalsRecent Changes to jQuery's Internals
Recent Changes to jQuery's Internalsjeresig
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoTJustin Lin
 

Mais procurados (20)

My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 SederhanaPraktik Pengembangan Konten E-Learning HTML5 Sederhana
Praktik Pengembangan Konten E-Learning HTML5 Sederhana
 
Xdebug confoo11
Xdebug confoo11Xdebug confoo11
Xdebug confoo11
 
Database Wizardry for Legacy Applications
Database Wizardry for Legacy ApplicationsDatabase Wizardry for Legacy Applications
Database Wizardry for Legacy Applications
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
 
Introduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10genIntroduction to the new official C# Driver developed by 10gen
Introduction to the new official C# Driver developed by 10gen
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
NDC London 2013 - Mongo db for c# developers
NDC London 2013 - Mongo db for c# developersNDC London 2013 - Mongo db for c# developers
NDC London 2013 - Mongo db for c# developers
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Recent Changes to jQuery's Internals
Recent Changes to jQuery's InternalsRecent Changes to jQuery's Internals
Recent Changes to jQuery's Internals
 
Arduino、Web 到 IoT
Arduino、Web 到 IoTArduino、Web 到 IoT
Arduino、Web 到 IoT
 

Semelhante a A miało być tak... bez wycieków

Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logsStefan Krawczyk
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...Andrew Lamb
 
Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the codeWim Godden
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak PROIDEA
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeWim Godden
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeWim Godden
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Windows Developer
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScriptDenis Voituron
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindAndreas Czakaj
 
112 portfpres.pdf
112 portfpres.pdf112 portfpres.pdf
112 portfpres.pdfsash236
 
Tools for Solving Performance Issues
Tools for Solving Performance IssuesTools for Solving Performance Issues
Tools for Solving Performance IssuesOdoo
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchMongoDB
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisFastly
 
Automated malware analysis
Automated malware analysisAutomated malware analysis
Automated malware analysisIbrahim Baliç
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiInfluxData
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 

Semelhante a A miało być tak... bez wycieków (20)

Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
 
Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the code
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 
Beyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Beyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
How to write clean & testable code without losing your mind
How to write clean & testable code without losing your mindHow to write clean & testable code without losing your mind
How to write clean & testable code without losing your mind
 
112 portfpres.pdf
112 portfpres.pdf112 portfpres.pdf
112 portfpres.pdf
 
Tools for Solving Performance Issues
Tools for Solving Performance IssuesTools for Solving Performance Issues
Tools for Solving Performance Issues
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
Automated malware analysis
Automated malware analysisAutomated malware analysis
Automated malware analysis
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Price of an Error
Price of an ErrorPrice of an Error
Price of an Error
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 

Mais de Konrad Kokosa

Narysuj Swoją Karierę IT - Konrad Kokosa
Narysuj Swoją Karierę IT - Konrad KokosaNarysuj Swoją Karierę IT - Konrad Kokosa
Narysuj Swoją Karierę IT - Konrad KokosaKonrad Kokosa
 
ETW w służbie programisty .NET
ETW w służbie programisty .NETETW w służbie programisty .NET
ETW w służbie programisty .NETKonrad Kokosa
 
ETW w służbie programisty .NET
ETW w służbie programisty .NETETW w służbie programisty .NET
ETW w służbie programisty .NETKonrad Kokosa
 
Wydajność webowa jak to ugryźć
Wydajność webowa   jak to ugryźćWydajność webowa   jak to ugryźć
Wydajność webowa jak to ugryźćKonrad Kokosa
 
Zarzadzanie pamiecia w .NET - WDI
Zarzadzanie pamiecia w .NET - WDIZarzadzanie pamiecia w .NET - WDI
Zarzadzanie pamiecia w .NET - WDIKonrad Kokosa
 
BoilingFrogs 2016 - Web performance
BoilingFrogs 2016 - Web performanceBoilingFrogs 2016 - Web performance
BoilingFrogs 2016 - Web performanceKonrad Kokosa
 
WG.NET 90 - Testy obciążeniowe – co, jak, czym?
WG.NET 90 - Testy obciążeniowe – co, jak, czym?WG.NET 90 - Testy obciążeniowe – co, jak, czym?
WG.NET 90 - Testy obciążeniowe – co, jak, czym?Konrad Kokosa
 

Mais de Konrad Kokosa (7)

Narysuj Swoją Karierę IT - Konrad Kokosa
Narysuj Swoją Karierę IT - Konrad KokosaNarysuj Swoją Karierę IT - Konrad Kokosa
Narysuj Swoją Karierę IT - Konrad Kokosa
 
ETW w służbie programisty .NET
ETW w służbie programisty .NETETW w służbie programisty .NET
ETW w służbie programisty .NET
 
ETW w służbie programisty .NET
ETW w służbie programisty .NETETW w służbie programisty .NET
ETW w służbie programisty .NET
 
Wydajność webowa jak to ugryźć
Wydajność webowa   jak to ugryźćWydajność webowa   jak to ugryźć
Wydajność webowa jak to ugryźć
 
Zarzadzanie pamiecia w .NET - WDI
Zarzadzanie pamiecia w .NET - WDIZarzadzanie pamiecia w .NET - WDI
Zarzadzanie pamiecia w .NET - WDI
 
BoilingFrogs 2016 - Web performance
BoilingFrogs 2016 - Web performanceBoilingFrogs 2016 - Web performance
BoilingFrogs 2016 - Web performance
 
WG.NET 90 - Testy obciążeniowe – co, jak, czym?
WG.NET 90 - Testy obciążeniowe – co, jak, czym?WG.NET 90 - Testy obciążeniowe – co, jak, czym?
WG.NET 90 - Testy obciążeniowe – co, jak, czym?
 

Último

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Último (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

A miało być tak... bez wycieków

  • 1. A miało być tak… bez wycieków! Konrad Kokosa
  • 2.
  • 4.
  • 5.
  • 8.
  • 11.
  • 12. “MySQL instances created before April 2014 used an ext3 filesystem which has a 2TB file size limit” Brian Donohue @ Instapaper
  • 13.
  • 14. “All non-trivial abstractions, to some degree, are leaky.”
  • 17. “Latency Numbers Every Programmer Should Know” https://gist.github.com/jboner/2841832 Norvig’s Nowadays (Haswell i7 @2.3Ghz) L1 cache reference 0.5 ns <2.0 ns L2 cache reference 7.0 ns 4.8 ns L3 cache reference 14.4 ns Main memory reference 100 ns 71.4 ns Disk seek 10 000 000 ns 150 000 ns
  • 18. Hardware - ISA - System - Framework (JVM, CLR, Go, …) - Programista
  • 19. int n = 5000; int m = 5000; int[,] tab = new int[n, m]; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { tab[j, i] = 1; } } int n = 5000; int m = 5000; int[,] tab = new int[n, m]; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { tab[i, j] = 1; } }
  • 20. Method | Size | Mean | Error | StdDev | --------- |----- |---------------:|--------------:|--------------:| IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us | JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us |
  • 21. Method | Size | Mean | Error | StdDev | --------- |----- |---------------:|--------------:|--------------:| IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us | JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us | IJAccess | 500 | 459.295 us | 8.8558 us | 7.3950 us | JIAccess | 500 | 616.643 us | 11.3232 us | 10.0377 us |
  • 22. Method | Size | Mean | Error | StdDev | --------- |----- |---------------:|--------------:|--------------:| IJAccess | 50 | 3.350 us | 0.0435 us | 0.0407 us | JIAccess | 50 | 3.372 us | 0.0491 us | 0.0460 us | IJAccess | 500 | 459.295 us | 8.8558 us | 7.3950 us | JIAccess | 500 | 616.643 us | 11.3232 us | 10.0377 us | IJAccess | 5000 | 48,728.263 us | 273.4506 us | 255.7859 us | JIAccess | 5000 | 243,778.158 us | 6,232.9454 us | 5,525.3433 us |
  • 23. public static int[] counters = new int[4]; ... Thread[] workers = new Thread[4]; for (int i = 0; i < 4; ++i) { workers[i] = new Thread(idx => { int index = (int)idx; for (int j = 0; j < 100_000_000; ++j) { counters[index] = counters[index] + 1; } }); }
  • 24.
  • 28.
  • 29.
  • 30.
  • 31. Method | Mean | Error | StdDev | -------------- |---------:|----------:|----------:| DoSharingTest | 925.7 ms | 19.233 ms | 46.816 ms | DoSharingTest2 | 338.4 ms | 9.131 ms | 26.779 ms | DoSharingTest3 | 166.8 ms | 1.732 ms | 1.536 ms |
  • 33. input -> data transformation -> output “Problem Oriented Design” with an efficient data transformations
  • 35. class CustomerClassRepository { List<Customer> customers = new List<Customer>(); public void UpdateScorings() { foreach (var customer in customers) { customer.UpdateScoring(); } } } public class Customer { private double Earnings; private DateTime DateOfBirth; private bool IsSmoking; private double Scoring; private HealthData Health; private AuxiliaryData Auxiliary; private Company Employer; public void UpdateScoring() { Scoring = Earnings * (IsSmoking ? 0.8 : 1.0) * ProcessAge(DateOfBirth); } private double ProcessAge(DateTime dateOfBirth) => dateOfBirth.Year / 2048.0; }
  • 36. class Program { // NuGet package ObjectLayoutInspector static void Main(string[] args) { TypeLayout.PrintLayout(typeof(Customer)); Console.ReadLine(); } public class Customer { private double Earnings; private DateTime DateOfBirth; private bool IsSmoking; private double Scoring; private HealthData Health; private AuxiliaryData Auxiliary; private Company Employer; } } public void UpdateScoring() { Scoring = Earnings * (IsSmoking ? 0.8 : 1.0) * ProcessAge(DateOfBirth); } Size: 56 bytes. Paddings: 7 bytes (%12 of empty space) |==========================================| | Object Header (8 bytes) | |------------------------------------------| | Method Table Ptr (8 bytes) | |==========================================| | 0-7: HealthData Health (8 bytes) | |------------------------------------------| | 8-15: AuxiliaryData Auxiliary (8 bytes) | |------------------------------------------| | 16-23: Company Employer (8 bytes) | |------------------------------------------| | 24-31: Double Earnings (8 bytes) | |------------------------------------------| | 32-39: Double Scoring (8 bytes) | |------------------------------------------| | 40: Boolean IsSmoking (1 byte) | |------------------------------------------| | 41-47: padding (7 bytes) | |------------------------------------------| | 48-55: DateTime DateOfBirth (8 bytes) | |==========================================|Cacheline#1acheline2
  • 37. Method | Mean | Allocated | LlcMisses/Op | LlcReference/Op | ------------- |-----------:|----------:|-------------:|----------------:| ObjectStyle | 2,152.5 us | 0 B | 24680 | 30031 |
  • 38. class CustomerRepositoryDOD { int NumberOfCustomers; double[] Scoring; double[] Earnings; bool[] IsSmoking; int[] YearOfBirth; DateTime[] DateOfBirth; // ... public void UpdateScorings() { for (int i = 0; i < NumberOfCustomers; ++i) { Scoring[i] = Earnings[i] * (IsSmoking[i] ? 0.8 : 1.0) * ProcessAge(YearOfBirth[i]); } } public double ProcessAge(int yearOfBirth) => yearOfBirth / 2048.0; } // No any Customer!!!
  • 39. Method | Mean | Allocated | LlcMisses/Op | LlcReference/Op | ------------- |-----------:|----------:|-------------:|----------------:| ObjectStyle | 2,152.5 us | 0 B | 24680 | 30031 | DoDStyle | 213.9 us | 0 B | 272 | 816 |
  • 40. Entity Component System Przykłady: Unity3D ECS, Entitas…
  • 42. [HttpGet] [Route("values/concatenated/{count}")] public string GetConcatenated(int count) { Random rand = new Random(); string result = string.Empty; for (int i = 0; i <= count; i++) { result += "<Customer Id=""; result += i.ToString(); result += "" lastUpdateDate=""; result += DateTime.Now.ToString(); result += "" branchId=""; result += i.ToString(); result += "" firstName=""; result += i.ToString(); ; result += "" lastName=""; result += "This is the customer with the Id: "; result += i.ToString(); result += "" ranking=""; result += rand.Next(100).ToString(); result += ""/>"; } result = "<Customers>" + result + "</Customers>"; return result; } [HttpGet] [Route("values/builder/{count}")] public string GetBuilder(int count) { Random rand = new Random(); StringBuilder sb = new StringBuilder("<Customers>"); for (int i = 0; i <= count; i++) { sb.Append("<Customer Id=""); sb.Append(i.ToString()); sb.Append("" lastUpdateDate=""); sb.Append(DateTime.Now.ToString()); sb.Append("" branchId=""); sb.Append(i.ToString()); sb.Append("" firstName=""); sb.Append(i.ToString()); sb.Append("" lastName=""); sb.Append("This is the customer with the Id: "); sb.Append(i.ToString()); sb.Append("" ranking=""); sb.Append(rand.Next(100).ToString()); sb.Append(""/>"); } sb.Append("</Customers>"); return sb.ToString(); }
  • 43.
  • 44.
  • 45.
  • 46. All non-trivial abstractions, to some degree, are leaky.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. -server -Xss4096k -Xms12G -Xmx12G -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -verbose:gc -Xmaxf1 -XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:+AggressiveOpts -XX:+ScavengeBeforeFullGC -XX:CMSFullGCsBeforeCompaction=10 -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:+CMSParallelRemarkEnabled -XX:GCTimeRatio=19 -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=500 -XX:+PrintGCTaskTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintHeapAtGC -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintTenuringDistribution -Xloggc:gc.log -server -Xms24G -Xmx24G -XX:PermSize=512m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70
  • 53. Czy to musi tak być…?
  • 54. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 55. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 56. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 57. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 58. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 59. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 60. From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.
  • 63.
  • 64. A czy można inaczej…?
  • 65.
  • 67. let s1 = String::from("hello"); let s2 = s1; println!("{}, world!", s1); error[E0382]: use of moved value: `s1` --> src/main.rs:5:28 | 3 | let s2 = s1; | -- value moved here 4 | 5 | println!("{}, world!", s1); | ^^ value used here after move | = note: move occurs because `s1` has type `std::string::String`, which does not implement the `Copy` trait
  • 68. fn main() { let s = String::from("hello"); // s comes into scope takes_ownership(s); // s's value moves into the function... // ... and so is no longer valid here } fn takes_ownership(some_string: String) { // some_string comes into scope println!("{}", some_string); } // Here, some_string goes out of scope and `drop` is called. The backing // memory is freed.
  • 69. fn main() { let s = String::from("hello"); use(&s); } fn use(some_string: &String) { // … }
  • 70. fn main() { let s = String::from("hello"); change(&s); } fn change(some_string: &String) { some_string.push_str(", world"); } error[E0596]: cannot borrow immutable borrowed content `*some_string` as mutable --> error.rs:8:5 | 7 | fn change(some_string: &String) { | ------- use `&mut String` here to make mutable 8 | some_string.push_str(", world"); | ^^^^^^^^^^^ cannot borrow as mutable
  • 71. fn main() { let mut s = String::from("hello"); change(&mut s); } fn change(some_string: &mut String) { some_string.push_str(", world"); }
  • 72. let mut s = String::from("hello"); let r1 = &mut s; let r2 = &mut s; println!("{}, {}", r1, r2); error[E0499]: cannot borrow `s` as mutable more than once at a time --> src/main.rs:5:14 | 4 | let r1 = &mut s; | ------ first mutable borrow occurs here 5 | let r2 = &mut s; | ^^^^^^ second mutable borrow occurs here 6 | 7 | println!("{}, {}", r1, r2); | -- first borrow later used here
  • 73. let mut s = String::from("hello"); let r1 = &s; // no problem let r2 = &s; // no problem let r3 = &mut s; // BIG PROBLEM println!("{}, {}, and {}", r1, r2, r3); error[E0502]: cannot borrow `s` as mutable because it is also borrowed as immutable --> src/main.rs:6:14 | 4 | let r1 = &s; // no problem | -- immutable borrow occurs here 5 | let r2 = &s; // no problem 6 | let r3 = &mut s; // BIG PROBLEM | ^^^^^^ mutable borrow occurs here 7 | 8 | println!("{}, {}, and {}", r1, r2, r3); | -- immutable borrow later used here
  • 75. “You don’t have to be an engineer to be a racing driver, but you do have to have Mechanical Sympathy.” Jackie Stewart, racing driver
  • 76.
  • 77.

Notas do Editor

  1. - Story o dodaniu pola w obiekcie w grze na PS4 - kto ostatnio myślał o pamięci? - Jest gdzieś inny świat, w którym takimi rzeczami trzeba się martwić.
  2. Jak wyżej, ale zakończyć tą zabawę i mówić dalej: zielony: moc komputerów, w tym dostępność pamięci. Zaczynaliśmy od bajtów, teraz nawet smartwatch ma 4GB czerwony: wraz z mocą komputerów maleje nasze zrozumienie i dobre ich wykorzystanie PC z 4MB, kto bawił się w konfiguracje ustawień w autoexec.bat oraz config.sys, wyładowywanie sterowników od SB (Sound Blaster) w jednej oraz przydzielane dodatkowych kilobajtów (tak kilobajtów!) pamięci XMS czy DMA że to refleksja o pamięci, ale że celem jest oczywiście, by wynieśli coś ciekawego i praktycznego
  3. Jak wyżej, ale zakończyć tą zabawę i mówić dalej: zielony: moc komputerów, w tym dostępność pamięci. Zaczynaliśmy od bajtów, teraz nawet smartwatch ma 4GB czerwony: wraz z mocą komputerów maleje nasze zrozumienie i dobre ich wykorzystanie PC z 4MB, kto bawił się w konfiguracje ustawień w autoexec.bat oraz config.sys, wyładowywanie sterowników od SB (Sound Blaster) w jednej oraz przydzielane dodatkowych kilobajtów (tak kilobajtów!) pamięci XMS czy DMA
  4. - Witamy w pracy z Mark I/ENIAC! Mark I 16 metrów długości, 2.5 metra wysokości kto zgadnie ile pamięci mieściła? 72 rejestry 23 znakowe (78-bitowe) zatem oferowała pamięć rzędu 702 bajtów RAMU, brak dysków ENIAC -
  5. Nie ma tu abstrakcji, programujemy na żywym metalu i jesteśmy świadomi każdego rejestru, każdego bitu/cyfry bawiąc się kabelkami i guzikami.
  6. Teraz oczywiście bardzo to się zmieniło, ale tamto było tylko 70 lat temu!
  7. Co tu przecieka? :D
  8. [Slajd ze schematem współczesnego CPU, L1/L2/L3 cache, RAM (Random Access Memory)] - Wspomnieć o L4 dostępnych przez chwilę w Broadwellu - Jesteśmy szczęśliwymi (?) programistami assemblera i nie przejmujemy się niczym - mamy abstrakcję pamięci i instrukcji na nich operujących
  9. - Przy okazji - odnieść się do takiego samego wykresu krążącego po Internecie. Jeff Dean z Google na podstawie artykułu Petera Norviga z 2002 - Bardzo istotne dla wydajności staje się jak używa pamięci
  10. Tu zatrzymamy się na chwilę, bo to nasza codzienność.
  11. Czy framework (CLR?) przykrywa poprzednio pokazany problem z memory access?
  12. Diagnostic – Intel VTune
  13. Diagnostic – Intel VTune
  14. Diagnostic – Intel VTune
  15. Demo Bartka Adamczewskiego: - zly “access patern” poprzez bezsensowne wczytywanie 64B cache lines by tylko odczytać jeden int, - CPU nie ma szans wykorzystać żadnego prefetchingu - Cache hit/miss - kto to obserwuje np. performance counterami?
  16. Diagnostic – Intel VTune
  17. Diagnostic – Intel VTune
  18. Jakie tu demo?
  19. Jakie tu demo?
  20. Na początku deploy w piątek o 18, potem sobie działa działa i po północy jestem na imprezie a oni dzwonią, że PRD przestał działać. To NIE fajny wyciek abstrakcji.
  21. Miał na myśli, że zrozumienie jak działa samochód i co tam jest “pod spodem” czyni Cię lepszym kierowcą rajdowym. Kierowca pracujący w harmonii z samochodem by wykorzystać go jak najlepiej. Powiedzenie zaaplikowane do IT przez Martin Thompson.