SlideShare a Scribd company logo
1 of 14
Wait Stats e Extended
Events
diga-me onde dói
Ricardo Leka Roveri
   ricardo@leka.com.br
   http://leka.com.br
   @bigleka
Agenda

 Waits?

 Extended Events

 Demos

 Q/A
Waits ?

Um processo rodando no Windows precisa aguardar por
recursos.

Sentado na fila por muito tempo? O processo está
aguardando…

O SQL é um processo do Windows, logo segue as mesmas
regras…
… e ainda têm suas próprias filas internas.
Waits ?

O processo do SQL, em sua forma mais básica, executa
apenas duas tarefas:
     Consumir CPU;
     Espera por recursos (incluindo CPU).


… então, para agilizar as tarefas:
    Upgrade da CPU
    Redução da espera.
Waits ?



          SQL 2000 possui 78 wait types
          SQL 2005 possui 201 wait types
          SQL 2008 possui 484 wait types
          SQL 2008 R2 possui 490 wait types
          SQL 2012 possui 646 wait types
Waits ?

O SQL expõe, via DMV, a latência de vários
recursos, Locks, latches, I/O, paralelismo, mirror, etc..

 Nem todos os Waits são ruins.

 É normal uma tarefa ter que esperar. Ex. Quando transmite
  dados para uma estação.

 Tarefas de Background, na maior parte das vezes, estão
  sempre esperando.
Extended Events, whatahell?

Quem precisa de outra ferramenta se temos o Profiler, certo?

Afinal ele pode monitorar basicamente tudo.
Extended Events, whatahell?

 Desenhado para performance.

 É muito difícil de trabalhar no SQL 2008.

 Não possui ferramenta gráfica (oficial).

 Muito XML.
XE – complicado?

 Sem Intellisense, prepare-se para muita memorização.

 Todo o evento é criado parado, você precisa lembrar de
  inicia-lo:
             ALTER EVENT SESSION [x]
             ON SERVER STATE=START
 Se utilizar ring buffer e parar o evento antes de analisar, o
  resultado do evento será perdido.

 Lembre-se de colocar as clausulas mais restritivas primeiro.
XE – criando um evento

 CREATE EVENT SESSION [session_name]
 ON SERVER
 ADD EVENT [package].[event_name]
 ( ACTION ( [package].[action_name] ) [,…]
   WHERE ( [predicate] [,…] ) ) [,…]
 ADD TARGET [package].[target_name]
   ( SET [target_setting] = [setting] [,…])
 WITH ([configration_options])
demo
QA
© 2009 Microsoft Corporation. Todos os direitos reservados.
Microsoft, Active Directory, Windows e Windows Vista são marcas registradas ou comerciais da Microsoft Corporation nos Estados Unidos e/ou outros países. Os
nomes de empresas e produtos reais aqui mencionados podem ser marcas comerciais de seus respectivos proprietários. As informações aqui contidas destinam-se
a fins informativos apenas e representam a visão atual da Microsoft Corporation na data desta apresentação. Como a Microsoft deve responder às mudanças das
condições de mercado, este documento não deve ser interpretado como um compromisso da parte da Microsoft, e a Microsoft não pode assegurar a exatidão de
qualquer informação fornecida após a data desta apresentação. A MICROSOFT NÃO DÁ NENHUMA GARANTIA, EXPRESSA, IMPLÍCITA OU
ESTATUTÁRIA, QUANTO ÀS INFORMAÇÕES NESTA APRESENTAÇÃO.

More Related Content

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Wait Stats e Extended Events

  • 1. Wait Stats e Extended Events diga-me onde dói
  • 2. Ricardo Leka Roveri ricardo@leka.com.br http://leka.com.br @bigleka
  • 3. Agenda  Waits?  Extended Events  Demos  Q/A
  • 4. Waits ? Um processo rodando no Windows precisa aguardar por recursos. Sentado na fila por muito tempo? O processo está aguardando… O SQL é um processo do Windows, logo segue as mesmas regras… … e ainda têm suas próprias filas internas.
  • 5. Waits ? O processo do SQL, em sua forma mais básica, executa apenas duas tarefas:  Consumir CPU;  Espera por recursos (incluindo CPU). … então, para agilizar as tarefas:  Upgrade da CPU  Redução da espera.
  • 6. Waits ? SQL 2000 possui 78 wait types SQL 2005 possui 201 wait types SQL 2008 possui 484 wait types SQL 2008 R2 possui 490 wait types SQL 2012 possui 646 wait types
  • 7. Waits ? O SQL expõe, via DMV, a latência de vários recursos, Locks, latches, I/O, paralelismo, mirror, etc..  Nem todos os Waits são ruins.  É normal uma tarefa ter que esperar. Ex. Quando transmite dados para uma estação.  Tarefas de Background, na maior parte das vezes, estão sempre esperando.
  • 8. Extended Events, whatahell? Quem precisa de outra ferramenta se temos o Profiler, certo? Afinal ele pode monitorar basicamente tudo.
  • 9. Extended Events, whatahell?  Desenhado para performance.  É muito difícil de trabalhar no SQL 2008.  Não possui ferramenta gráfica (oficial).  Muito XML.
  • 10. XE – complicado?  Sem Intellisense, prepare-se para muita memorização.  Todo o evento é criado parado, você precisa lembrar de inicia-lo: ALTER EVENT SESSION [x] ON SERVER STATE=START  Se utilizar ring buffer e parar o evento antes de analisar, o resultado do evento será perdido.  Lembre-se de colocar as clausulas mais restritivas primeiro.
  • 11. XE – criando um evento CREATE EVENT SESSION [session_name] ON SERVER ADD EVENT [package].[event_name] ( ACTION ( [package].[action_name] ) [,…] WHERE ( [predicate] [,…] ) ) [,…] ADD TARGET [package].[target_name] ( SET [target_setting] = [setting] [,…]) WITH ([configration_options])
  • 12. demo
  • 13. QA
  • 14. © 2009 Microsoft Corporation. Todos os direitos reservados. Microsoft, Active Directory, Windows e Windows Vista são marcas registradas ou comerciais da Microsoft Corporation nos Estados Unidos e/ou outros países. Os nomes de empresas e produtos reais aqui mencionados podem ser marcas comerciais de seus respectivos proprietários. As informações aqui contidas destinam-se a fins informativos apenas e representam a visão atual da Microsoft Corporation na data desta apresentação. Como a Microsoft deve responder às mudanças das condições de mercado, este documento não deve ser interpretado como um compromisso da parte da Microsoft, e a Microsoft não pode assegurar a exatidão de qualquer informação fornecida após a data desta apresentação. A MICROSOFT NÃO DÁ NENHUMA GARANTIA, EXPRESSA, IMPLÍCITA OU ESTATUTÁRIA, QUANTO ÀS INFORMAÇÕES NESTA APRESENTAÇÃO.