SlideShare une entreprise Scribd logo
1  sur  18
Fireside
Grade of the Steel
    Thomas Kejser
Grade of the Steel
1. Pick a simple workload

2. Do the naïve thing

3. Tune the … out of it

4. Find the limit

5. Get smart (optional)
Grade of the Steel Examples
• 16M BULK Rows/sec

• 50M rows SELECT (4 x 10Gbit)

• Backup at 6GB/sec

• 1.1M INSERT/sec
Step 1 – Theory and Baseline
Commit                            SQLIO.EXE
            BufferOffset           –t1
                                   –o1
                                   –b60
                            ...
   Slot 1
                           Slot
                                   –kW
     ...
                            n      -fsequential


               Writer             COREINFO.EXE > info.txt
               Queue



            Log Writer
Step 2 – Design Workload

         File 1   FG 1   Table 1


         File 2   FG 2   Table 2
                                   SQLCMD
Stripe




         File 3   FG 3             Threads
                         Table 3




         File X   FG X   Table X
Step 3 – Tune
• Add Files / Tables

                          Theory        Measure
• Thread Sweet spot

• Affinitize I/O

• Placement of Log                 Change
Messages Queues
 Part 1 – Naïve
Problem Statement

       Push                                 Pop


                    Queue Structure
300B                                              Msg
              Msg   Msg      Msg      Msg
msg



                       Ordered
The Naïve Approach
Push                      Pop
• Seek first value page   • Seek last value page
• INSERT a row at page    • DELETE/Output key on page




 Min              Max           Min            Max
                   Msg    Msg   Msg
Why this doesn’t Scale!
                             Root




               Min     Min         Min




         Min    Min   Min    Min         Min   Min
Min                                                  Max
Messages Queues
Part 2 – Getting smart
Summarising the Problem
• Hot stuff
   –   Root
   –   Min page
   –   Max page
   –   Intermediate pages
• Alloc/Dealloc
• BUT: We Must have
  order!
Cooling it down
Allocations - What if?...
Push                         Pop
• Seek first value page      • Seek last value page
• UPDATE Reference Count     • UPDATE Reference Count




 Min                  Max       Min                 Max
                     Msg++     Msg--
Dissipate the Heat

      Last Digit = 0         Last Digit = 1               Last Digit = 2




Min                Max    Min                 Max   Min                Max
Msg--             Msg++   Msg--           Msg++     Msg--             Msg++
Eliminating Thread Contention
                           VERY
                           fast!


  PopSequence++                             PushSequence++



                      Queue Structure

       4          5           6         7        8


                        Ordered
Ring Buffering

PushSequence+=2   PopSequence++                                   PushSequence+=1
    Mod 100          Mod 100                                          Mod 100



                                  MyQ
 Slot:0            Slot:42                  Slot: 97   Slot: 98      Slot: 99
Msg: 200          Msg: 142                  Msg: 197   Msg: 198      Msg: 199


                                  Ordered
Summing it up
• UPDATE instead of
  INSERT/DELETE
• Multi partitions =
  multiple trees
• Ring buffer using modulo
• Sweet spot concurrency

Contenu connexe

Similaire à Fireside fusion talk - message queues (6)

Computing on Encrypted Data
Computing on Encrypted DataComputing on Encrypted Data
Computing on Encrypted Data
 
About memcached
About memcachedAbout memcached
About memcached
 
09_Practical Multicore programming
09_Practical Multicore programming09_Practical Multicore programming
09_Practical Multicore programming
 
Top 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applicationsTop 5 mistakes when writing Spark applications
Top 5 mistakes when writing Spark applications
 
Cache aware hybrid sorter
Cache aware hybrid sorterCache aware hybrid sorter
Cache aware hybrid sorter
 
14 query processing-sorting
14 query processing-sorting14 query processing-sorting
14 query processing-sorting
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Fireside fusion talk - message queues

  • 1. Fireside Grade of the Steel Thomas Kejser
  • 2. Grade of the Steel 1. Pick a simple workload 2. Do the naïve thing 3. Tune the … out of it 4. Find the limit 5. Get smart (optional)
  • 3. Grade of the Steel Examples • 16M BULK Rows/sec • 50M rows SELECT (4 x 10Gbit) • Backup at 6GB/sec • 1.1M INSERT/sec
  • 4. Step 1 – Theory and Baseline Commit SQLIO.EXE BufferOffset –t1 –o1 –b60 ... Slot 1 Slot –kW ... n -fsequential Writer COREINFO.EXE > info.txt Queue Log Writer
  • 5. Step 2 – Design Workload File 1 FG 1 Table 1 File 2 FG 2 Table 2 SQLCMD Stripe File 3 FG 3 Threads Table 3 File X FG X Table X
  • 6. Step 3 – Tune • Add Files / Tables Theory Measure • Thread Sweet spot • Affinitize I/O • Placement of Log Change
  • 7. Messages Queues Part 1 – Naïve
  • 8. Problem Statement Push Pop Queue Structure 300B Msg Msg Msg Msg Msg msg Ordered
  • 9. The Naïve Approach Push Pop • Seek first value page • Seek last value page • INSERT a row at page • DELETE/Output key on page Min Max Min Max Msg Msg Msg
  • 10. Why this doesn’t Scale! Root Min Min Min Min Min Min Min Min Min Min Max
  • 11. Messages Queues Part 2 – Getting smart
  • 12. Summarising the Problem • Hot stuff – Root – Min page – Max page – Intermediate pages • Alloc/Dealloc • BUT: We Must have order!
  • 14. Allocations - What if?... Push Pop • Seek first value page • Seek last value page • UPDATE Reference Count • UPDATE Reference Count Min Max Min Max Msg++ Msg--
  • 15. Dissipate the Heat Last Digit = 0 Last Digit = 1 Last Digit = 2 Min Max Min Max Min Max Msg-- Msg++ Msg-- Msg++ Msg-- Msg++
  • 16. Eliminating Thread Contention VERY fast! PopSequence++ PushSequence++ Queue Structure 4 5 6 7 8 Ordered
  • 17. Ring Buffering PushSequence+=2 PopSequence++ PushSequence+=1 Mod 100 Mod 100 Mod 100 MyQ Slot:0 Slot:42 Slot: 97 Slot: 98 Slot: 99 Msg: 200 Msg: 142 Msg: 197 Msg: 198 Msg: 199 Ordered
  • 18. Summing it up • UPDATE instead of INSERT/DELETE • Multi partitions = multiple trees • Ring buffer using modulo • Sweet spot concurrency