26
START – Self-Tuning Adaptive Radix Tree Philipp Fent, Michael Jungmair, Andreas Kipf, Thomas Neumann Technische Universität München April 20, 2020

START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

START – Self-Tuning Adaptive Radix Tree

Philipp Fent, Michael Jungmair, Andreas Kipf, Thomas Neumann

Technische Universität München

April 20, 2020

Page 2: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Practical Database Indexes

Learned indexes• Small and efficient• Adapt to data

distribution• Fast for read-only

workloads

STARTSelf Tuning ART• Bridges the gap• Adapts to data:

85% faster!• Keep robustness

ART – Adaptive Radix Tree• Used in practice• Well understood• Fast for various workloads• But:

limited adaption to datadistribution

• and slower than a well-trainedmachine learning model

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 2 / 12

Page 3: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Practical Database Indexes

Learned indexes• Small and efficient• Adapt to data

distribution• Fast for read-only

workloads

STARTSelf Tuning ART• Bridges the gap• Adapts to data:

85% faster!• Keep robustness

ART – Adaptive Radix Tree• Used in practice• Well understood• Fast for various workloads• But:

limited adaption to datadistribution

• and slower than a well-trainedmachine learning model

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 2 / 12

Page 4: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Practical Database Indexes

Learned indexes• Small and efficient• Adapt to data

distribution• Fast for read-only

workloads

STARTSelf Tuning ART

• Bridges the gap• Adapts to data:

85% faster!• Keep robustness

ART – Adaptive Radix Tree• Used in practice• Well understood• Fast for various workloads• But:

limited adaption to datadistribution

• and slower than a well-trainedmachine learning model

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 2 / 12

Page 5: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Self-Tuning ART

Byte 1

Byte 2

Byte 3

Byte 4

ART

costmodel

optimizerintroduce

multilevel nodes

START

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 3 / 12

Page 6: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Self-Tuning ART

Byte 1

Byte 2

Byte 3

Byte 4

ART

costmodel

optimizerintroduce

multilevel nodes

START

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 3 / 12

Page 7: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Self-Tuning ART

Byte 1

Byte 2

Byte 3

Byte 4

ART

costmodel

optimizerintroduce

multilevel nodes

START

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 3 / 12

Page 8: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Multilevel Nodes

Rewired memory nodes• Dense regions with many keys• Subtrees of full nodes• Keep data continuous

Sparse regions• Already use path compression• Still: improve common prefixes• Reduce chains of small nodes

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 4 / 12

Page 9: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Multilevel Nodes

Rewired memory nodes• Dense regions with many keys• Subtrees of full nodes• Keep data continuous

Sparse regions• Already use path compression• Still: improve common prefixes• Reduce chains of small nodes

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 4 / 12

Page 10: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

Node256256 children

Node16M64 K Node256

Node256…

Node256…

Node256…

Node256……

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 5 / 12

Page 11: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

Node256256 children

Node16M64 K Node256

Node256…

Node256…

Node256…

Node256……

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 5 / 12

Page 12: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

memoryfile ’a’ ’b’ ∅ ∅

virtualpages ’a’ ’b’ ’b’ ∅

physicalpages ’a’ ’b’

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 6 / 12

Page 13: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

physicalpages ∅

virtualpages

page 1 page 2 page 3 page 4access(19)access(11)

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 7 / 12

Page 14: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

physicalpages ∅

virtualpages

page 1 page 2 page 3 page 4access(19)access(11)

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 7 / 12

Page 15: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

physicalpages ∅

virtualpages

page 1 page 2 page 3 page 4access(19)access(11)

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 7 / 12

Page 16: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

physicalpages ∅

virtualpages

page 1 page 2 page 3 page 4access(19)access(11)

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 7 / 12

Page 17: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Rewired Memory Nodes

physicalpages ∅

virtualpages

page 1 page 2 page 3 page 4access(19)access(11)

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 7 / 12

Page 18: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Multilevel Node4

• Helps reduce sparse affix nodes• Use all 64 Bytes of a cacheline

up to 4 B keys0 0 1 1 2 2 3 3

4 children

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 8 / 12

Page 19: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Cost Model for Node Lookup

• Minimize the average child lookup cost• Consider individual node cost

[ns/lookup] Levels

Cached Header Cached Uncached

Node4 1

7 7 68

Node16 1

5 77 162

Node48 1

2 165 168

Node256 1

2 88 92

Rewired64K 2

6 87 162

Rewired16M 3

6 88 165

MultiNode4 2-4

6 6 68

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 9 / 12

Page 20: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Cost Model for Node Lookup

• Minimize the average child lookup cost• Consider individual node cost

[ns/lookup] Levels Cached Header Cached Uncached

Node4 1 7 7 68Node16 1 5 77 162Node48 1 2 165 168Node256 1 2 88 92

Rewired64K 2 6 87 162Rewired16M 3 6 88 165MultiNode4 2-4 6 6 68

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 9 / 12

Page 21: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Bottom-up Optimization

… … … …

20[60, . . .]

5[20, . . .]

10[30, . . .]

5[25, . . .]

25[130, 80, . . .]

2

15[85, 55, . . .]2

[295255 , 215, 135, . . .

]40·3+135

40·2+215130+85 80+551-level:

2-level:32

4025+15

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 10 / 12

Page 22: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Bottom-up Optimization

… … … …

20[60, . . .]

5[20, . . .]

10[30, . . .]

5[25, . . .]

25[130, 80, . . .]

2

15[85, 55, . . .]2

[295255 , 215, 135, . . .

]40·3+135

40·2+215130+85 80+551-level:

2-level:32

4025+15

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 10 / 12

Page 23: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Bottom-up Optimization

… … … …

20[60, . . .]

5[20, . . .]

10[30, . . .]

5[25, . . .]

25[130, 80, . . .]

2

15[85, 55, . . .]2

[295255 , 215, 135, . . .

]40·3+135

40·2+215130+85 80+551-level:

2-level:32

4025+15

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 10 / 12

Page 24: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Bottom-up Optimization

… … … …

20[60, . . .]

5[20, . . .]

10[30, . . .]

5[25, . . .]

25[130, 80, . . .]

2

15[85, 55, . . .]2

[295255 , 215, 135, . . .

]40·3+135

40·2+215130+85 80+551-level:

2-level:32

4025+15

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 10 / 12

Page 25: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Performancehttps://learned.systems/sosd

0

100

200

300

400

books fblognormal

normalosm_cellid

s dense sparse wiki_ts

Datasets

Late

ncy

[ns

/op

]Indexes

ARTSTARTRSRMI

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 11 / 12

Page 26: START – Self-Tuning Adaptive Radix Treefent/papers/Self Tuning Art Slides.pdf · START–Self-TuningAdaptiveRadixTree PhilippFent,MichaelJungmair,AndreasKipf,ThomasNeumann TechnischeUniversitätMünchen

Conclusion

• START – Best of both worlds?• Adapt to real-world data distribution• Still with robust underpinning of ART• Inserts still possible and efficient• But: might degrade multilevel nodes

github.com/jungmair/START

[email protected]

Philipp Fent et al. START – Self-Tuning Adaptive Radix Tree 12 / 12