Optimizing the Performance-Related Configurations of Object-Relational Mapping Frameworks Using a Multi-Objective Genetic Algorithm
1. Optimizing the Performance-RelatedOptimizing the Performance-Related
Configurations of ORM FrameworksConfigurations of ORM Frameworks
Ravjot Singh, Cor-Paul Bezemer,Weiyi Shang,Ahmed E. Hassan
Using a Multi-Objective Genetic AlgorithmUsing a Multi-Objective Genetic Algorithm
3. 3
27% of customer issues are27% of customer issues are
due to misconfigurationdue to misconfiguration
4. 4
20% of misconfigurations cause20% of misconfigurations cause
performance degradationsperformance degradations
5. 5
A popular online store estimates a $1.6A popular online store estimates a $1.6
billion loss for a 1-second slowdownbillion loss for a 1-second slowdown
6. 6
Databases are at the coreDatabases are at the core
of many large systemsof many large systems
10. 10
Code without ORM isCode without ORM is
tedioustedious
public class Person {
// ...
public String getName(){
sql = “SELECT name FROM … WHERE …”;
ResultSet rs = stmt.executeQuery(sql);
while(rs.next())
return rs.getString(“name”);
}
}
11. 11
Code with ORM is cleanCode with ORM is clean
@Entity
public class Person {
@Id Integer getId() { ... }
public String getName(){
return this.name;
}
}
16. 16
The impact of one ORMThe impact of one ORM
configuration optionconfiguration option
hibernate.max_fetch_depth = {0|1|2|3|...}
17. 17
The impact of one ORMThe impact of one ORM
configuration optionconfiguration option
hibernate.max_fetch_depth = {0|1|2|3|...}
Optimal configuration depends on what you need!
18. 18
Should we care about ORMShould we care about ORM
performance configuration?performance configuration?
Analyze 11 boolean configuration options
hence 211
= 2048 configurations
19. 19
We compare the 'default' withWe compare the 'default' with
the optimal configurationthe optimal configuration
Default configuration
System Tests
Run tests
Default
execution
time
20. 20
We compare the 'default' withWe compare the 'default' with
the optimal configurationthe optimal configuration
Default configuration
System Tests
Run tests
Optimal configuration
System Tests
Default
execution
time
Optimal
execution
time
Run tests
21. 21
We compare the 'default' withWe compare the 'default' with
the optimal configurationthe optimal configuration
Default configuration
System Tests
Run tests
Optimal configuration
System Tests
Compare
Default
execution
time
Optimal
execution
time
Run tests
22. 22
Yes, we should care about ORMYes, we should care about ORM
performance configuration!performance configuration!
89% 96%
of the test cases are significantly
slower using default!
23. 23
How can we guide ORMHow can we guide ORM
performance configuration?performance configuration?
25. 25
Optimize ORM configurationOptimize ORM configuration
by trial-and-errorby trial-and-error
Evaluate configuration A
on some workload W
Randomly select
configuration A
26. 26
Optimize ORM configurationOptimize ORM configuration
by trial-and-errorby trial-and-error
Evaluate configuration A
on some workload W
Compare execution time for configuration A
with execution time for current best configuration
Randomly select
configuration A
27. 27
Optimize ORM configurationOptimize ORM configuration
by trial-and-errorby trial-and-error
Evaluate configuration A
on some workload W
Compare execution time for configuration A
with execution time for current best configuration
Randomly select
configuration A
Use best configuration
28. 28
Optimize ORM configurationOptimize ORM configuration
by trial-and-errorby trial-and-error
Evaluate configuration A
on some workload W
Compare execution time for configuration A
with execution time for current best configuration
Randomly select
configuration A
Use best configuration
30. 30
Genetic algorithm conceptGenetic algorithm concept
Optimize population based on
one or more objectives
We start from the 'default'
configuration as supplied by
the developer
38. 38
Evaluation of our approachEvaluation of our approach
1. Closeness of configurations found by
our approach to the optimal
configuration
2. Speed with which we can find sub-
optimal configurations
40. 40
Closeness of configurationsCloseness of configurations
to the optimalto the optimal
We rank all existing configurations based on
dominance
Configuration A dominates configuration B if:
1. B is not better than A for all objectives
2.A is better than B for at least one objective
41. 41
Ranking of configurationsRanking of configurations
Configuration CPU usage Memory
usage
Execution time
Default 0 0 0
A +50% +50% 0
B -80% -20% 0
C 0 -80% -20%
42. 42
Ranking of configurationsRanking of configurations
Configuration CPU usage Memory
usage
Execution time
Default 0 0 0
A +50% +50% 0
B -80% -20% 0
C 0 -80% -20%
Rank 1: B and C
Rank 2: default
Rank 3:A
43. 43
The genetic algorithm findsThe genetic algorithm finds
configurations close to the best rankconfigurations close to the best rank
BEST WORST
44. 44
Speed with whichSpeed with which
configurations are foundconfigurations are found
Depends on:
- Workload
- Application
- Data
45. 45
The genetic algorithm findsThe genetic algorithm finds
configurations fast (~5-20 minutes)configurations fast (~5-20 minutes)
46. 46
Yes, we should care about ORMYes, we should care about ORM
performance configuration!performance configuration!
89% 96%
of the test cases are significantly
slower using default!