SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Denis Reznik
• Data Architect
Intapp
/denis-reznik-2345023
@denisreznik
/denis.reznik.5
Sergii Bielskyi
Head of R&D
ELEKS
sergii-bielskyi-884a7a2b
@sergey_belskiy
/sergey.belskiy
Agenda
• Application Issue 1
• Database Issue 1
• Application Issue 2
• Database Issue 2
• Application Issue 3
ASYNC_NETWORK_IO Wait
0
Schedulers
Runnable Queue
1
2
3
1
Suspended Queue
1
SELECT * FROM Users
1
ASYNC_NETWORK_IO
ASYNC_NETWORK_IO
1
Client
Id Name
1 John Snow
2 Darth Vader
3 Peter Parker
4 Andriy Yarmolenko
Users
var command = new SqlCommand("SELECT * FROM Users", connection);
connection.Open();
var reader = command.ExecuteReader();
while (reader.Read())
{
// some business logic
}
Index Seek
…
…
1 .. 1M
1 .. 2K 2K+1 .. 4K 1M-2K .. 1M
1 .. 300 301 .. 800 801 .. 1,5K 1,5K+1 .. 2K
SELECT * FROM Users
WHERE Id = 523
Index Scan
…
…
1 .. 1M
1 .. 2K 2K+1 .. 4K 1M-2K .. 1M
1 .. 300 301 .. 800 801 .. 1,5K 1,5K+1 .. 2K
SELECT * FROM Users
SNAT
Source Network Address
Translation
SNAT exhaustion
Imagine having multiple browsers going to https://www.microsoft.com,
which is:
• Destination IP = 23.53.254.142
• Destination Port = 443
• Protocol = TCP
TCP SNAT port release
• If either server/client sends FINACK, SNAT port will be released after 240 seconds.
• If a RST is seen, SNAT port will be released after 15 seconds.
• If idle timeout has been reached, port is released.
65536 ports per load balancer * 5 / 2000 instances = ~ 160 SNAT ports per instance
Symptoms SNAT exhaustion
• Slow response times on all or some of the instances in a service plan.
• Intermittent 5xx or Bad Gateway errors
• Timeout error messages
• Could not connect to external endpoints (like SQLDB, Service Fabric,
other App services etc.)
How to solve that issue
From application:
• Modify the application to reuse connections
• Modify the application to use connection pooling
• Modify the application to use less aggressive retry logic
• Use keepalives to reset the outbound idle timeout
From database:
• DbContext pooling
From App Service:
• Scale out the App Service plan to more instances
• Use App Service Environment, whose worker instance can have more SNAT ports, due to its smaller instances pool size.
• connection pools: By pooling your connections, you avoid opening new network connections for calls to the same address
and port.
• service endpoints: You don't have a SNAT port restriction to the services secured with service endpoints. (VNet)
• private endpoints: You don't have a SNAT port restriction to services secured with private endpoints. (VNet)
• NAT Gateway: With a NAT Gateway, you have 64k outbound SNAT ports that are usable by the resources sending traffic
through it.
Sample
• DBContextPool
• Reuse HttpClient
• Release HttpWebRequest
• Scale out App service
LCK_M_* Waits
0
Schedulers
Runnable Queue
1
2 1
Suspended Queue
2
SELECT * FROM Users
WHERE Name LIKE 'K%'
UPDATE Users
SET Name = 'Jesse Pinkman'
WHERE Id = 3
Id Name
1 John Snow
2 Peter Partner
3 Kirill Nenahov
4 Jane Dow
1
Users
2
3
2
Id Name
1 John Snow
2 Peter Partner
3 Jesse Pinkman
4 Jane Dow
LCK_M_X
LCK_M_X
2
X S
Summary
• Paging
• Indexes
• SNAT
• Blocking
• Transaction
Denis Reznik
Data Architect
Intapp
/denis-reznik-2345023
@denisreznik
/denis.reznik.5
Sergii Bielskyi
Head of R&D
ELEKS
/sergii-bielskyi-884a7a2b
@sergey_belskiy
/sergey.belskiy
As an encore
…
Regular mistakes of using ORM (EF)
• Too greedy with Columns
• Too greedy with Rows
• Bulk insert
• Mismatched data types
• Autochangetracker
• AsNoTracking
• Dynamic types of arrays
• toList(), toGroup(), etc

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

8 cloud design patterns you ought to know - Update Conference 2018
8 cloud design patterns you ought to know - Update Conference 20188 cloud design patterns you ought to know - Update Conference 2018
8 cloud design patterns you ought to know - Update Conference 2018
 
Achieving Zero Downtime for SQL
Achieving Zero Downtime for SQLAchieving Zero Downtime for SQL
Achieving Zero Downtime for SQL
 
Top 5 Challenges to Upgrading to SQL Server 2016
Top 5 Challenges to Upgrading to SQL Server 2016Top 5 Challenges to Upgrading to SQL Server 2016
Top 5 Challenges to Upgrading to SQL Server 2016
 
Scale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with AkkaScale and Throughput @ Clicktale with Akka
Scale and Throughput @ Clicktale with Akka
 
Scala Security: Eliminate 200+ Code-Level Threats With Fortify SCA For Scala
Scala Security: Eliminate 200+ Code-Level Threats With Fortify SCA For ScalaScala Security: Eliminate 200+ Code-Level Threats With Fortify SCA For Scala
Scala Security: Eliminate 200+ Code-Level Threats With Fortify SCA For Scala
 
.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?
.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?
.NET Fest 2017. Anton Moldovan. How do we cook highload microservices at SBTech?
 
ADDO Open Source Observability Tools
ADDO Open Source Observability Tools ADDO Open Source Observability Tools
ADDO Open Source Observability Tools
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' Performance
 
Spark Streaming @ Scale (Clicktale)
Spark Streaming @ Scale (Clicktale)Spark Streaming @ Scale (Clicktale)
Spark Streaming @ Scale (Clicktale)
 
Cloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong CodeaholicsCloud Design Patterns - Hong Kong Codeaholics
Cloud Design Patterns - Hong Kong Codeaholics
 
Using Redgate, AKS and Azure to bring DevOps to your Database
Using Redgate, AKS and Azure to bring DevOps to your DatabaseUsing Redgate, AKS and Azure to bring DevOps to your Database
Using Redgate, AKS and Azure to bring DevOps to your Database
 
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
 
Migrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systemsMigrating from Java EE to cloud-native Reactive systems
Migrating from Java EE to cloud-native Reactive systems
 
Case Study: Elasticsearch Ingest Using StreamSets at Cisco Intercloud
Case Study: Elasticsearch Ingest Using StreamSets at Cisco IntercloudCase Study: Elasticsearch Ingest Using StreamSets at Cisco Intercloud
Case Study: Elasticsearch Ingest Using StreamSets at Cisco Intercloud
 
Live Coding a KSQL Application
Live Coding a KSQL ApplicationLive Coding a KSQL Application
Live Coding a KSQL Application
 
Going serverless with azure functions
Going serverless with azure functionsGoing serverless with azure functions
Going serverless with azure functions
 
DockerCon Europe 2018 Monitoring & Logging Workshop
DockerCon Europe 2018 Monitoring & Logging WorkshopDockerCon Europe 2018 Monitoring & Logging Workshop
DockerCon Europe 2018 Monitoring & Logging Workshop
 
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
Reactive Fast Data & the Data Lake with Akka, Kafka, SparkReactive Fast Data & the Data Lake with Akka, Kafka, Spark
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
 
PowerShell DSC - State of the Art & Community by Gael Colas
PowerShell DSC - State of the Art & Community by Gael ColasPowerShell DSC - State of the Art & Community by Gael Colas
PowerShell DSC - State of the Art & Community by Gael Colas
 
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
 

Ähnlich wie "What database can tell about application issues? What application can tell about database issues?" Denis Reznik/Sergii Bielskyi

Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Fwdays
 
AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2
Sean Braymen
 
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay RaiConquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
Databricks
 
Introduction to couchbase
Introduction to couchbaseIntroduction to couchbase
Introduction to couchbase
Dipti Borkar
 

Ähnlich wie "What database can tell about application issues? What application can tell about database issues?" Denis Reznik/Sergii Bielskyi (20)

Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
Денис Резник "Зачем мне знать SQL и Базы Данных, ведь у меня есть ORM?"
 
Oracle e-Business Suite & RAC 11GR2
Oracle e-Business Suite & RAC 11GR2Oracle e-Business Suite & RAC 11GR2
Oracle e-Business Suite & RAC 11GR2
 
Opal: Simple Web Services Wrappers for Scientific Applications
Opal: Simple Web Services Wrappers for Scientific ApplicationsOpal: Simple Web Services Wrappers for Scientific Applications
Opal: Simple Web Services Wrappers for Scientific Applications
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
SQL Server Deep Drive
SQL Server Deep Drive SQL Server Deep Drive
SQL Server Deep Drive
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedSQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type Explained
 
Delivering big content at NBC News with RavenDB
Delivering big content at NBC News with RavenDBDelivering big content at NBC News with RavenDB
Delivering big content at NBC News with RavenDB
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2
 
How companies use NoSQL & Couchbase - NoSQL Now 2014
How companies use NoSQL & Couchbase - NoSQL Now 2014How companies use NoSQL & Couchbase - NoSQL Now 2014
How companies use NoSQL & Couchbase - NoSQL Now 2014
 
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay RaiConquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
Conquering Hadoop and Apache Spark with Operational Intelligence with Akshay Rai
 
Introduction to couchbase
Introduction to couchbaseIntroduction to couchbase
Introduction to couchbase
 
Move a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloudMove a successful onpremise oltp application to the cloud
Move a successful onpremise oltp application to the cloud
 
Stay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolithStay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolith
 
Performance ananlysis of the effect of load balancer in sdn based cloud
Performance ananlysis of the effect of load balancer in sdn based cloudPerformance ananlysis of the effect of load balancer in sdn based cloud
Performance ananlysis of the effect of load balancer in sdn based cloud
 
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive MetastoreOracleStore: A Highly Performant RawStore Implementation for Hive Metastore
OracleStore: A Highly Performant RawStore Implementation for Hive Metastore
 
Data Lake and the rise of the microservices
Data Lake and the rise of the microservicesData Lake and the rise of the microservices
Data Lake and the rise of the microservices
 
What's New in .Net 4.5
What's New in .Net 4.5What's New in .Net 4.5
What's New in .Net 4.5
 
Bloomreach - BloomStore Compute Cloud Infrastructure
Bloomreach - BloomStore Compute Cloud Infrastructure Bloomreach - BloomStore Compute Cloud Infrastructure
Bloomreach - BloomStore Compute Cloud Infrastructure
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout Session
 

Mehr von Fwdays

Mehr von Fwdays (20)

"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y..."How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
"How Preply reduced ML model development time from 1 month to 1 day",Yevhen Y...
 
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
"GenAI Apps: Our Journey from Ideas to Production Excellence",Danil Topchii
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
 

KĂźrzlich hochgeladen

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
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
 

KĂźrzlich hochgeladen (20)

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

"What database can tell about application issues? What application can tell about database issues?" Denis Reznik/Sergii Bielskyi

  • 1.
  • 2. Denis Reznik • Data Architect Intapp /denis-reznik-2345023 @denisreznik /denis.reznik.5 Sergii Bielskyi Head of R&D ELEKS sergii-bielskyi-884a7a2b @sergey_belskiy /sergey.belskiy
  • 3. Agenda • Application Issue 1 • Database Issue 1 • Application Issue 2 • Database Issue 2 • Application Issue 3
  • 4. ASYNC_NETWORK_IO Wait 0 Schedulers Runnable Queue 1 2 3 1 Suspended Queue 1 SELECT * FROM Users 1 ASYNC_NETWORK_IO ASYNC_NETWORK_IO 1 Client Id Name 1 John Snow 2 Darth Vader 3 Peter Parker 4 Andriy Yarmolenko Users var command = new SqlCommand("SELECT * FROM Users", connection); connection.Open(); var reader = command.ExecuteReader(); while (reader.Read()) { // some business logic }
  • 5. Index Seek … … 1 .. 1M 1 .. 2K 2K+1 .. 4K 1M-2K .. 1M 1 .. 300 301 .. 800 801 .. 1,5K 1,5K+1 .. 2K SELECT * FROM Users WHERE Id = 523
  • 6. Index Scan … … 1 .. 1M 1 .. 2K 2K+1 .. 4K 1M-2K .. 1M 1 .. 300 301 .. 800 801 .. 1,5K 1,5K+1 .. 2K SELECT * FROM Users
  • 8. SNAT exhaustion Imagine having multiple browsers going to https://www.microsoft.com, which is: • Destination IP = 23.53.254.142 • Destination Port = 443 • Protocol = TCP TCP SNAT port release • If either server/client sends FINACK, SNAT port will be released after 240 seconds. • If a RST is seen, SNAT port will be released after 15 seconds. • If idle timeout has been reached, port is released. 65536 ports per load balancer * 5 / 2000 instances = ~ 160 SNAT ports per instance
  • 9. Symptoms SNAT exhaustion • Slow response times on all or some of the instances in a service plan. • Intermittent 5xx or Bad Gateway errors • Timeout error messages • Could not connect to external endpoints (like SQLDB, Service Fabric, other App services etc.)
  • 10. How to solve that issue From application: • Modify the application to reuse connections • Modify the application to use connection pooling • Modify the application to use less aggressive retry logic • Use keepalives to reset the outbound idle timeout From database: • DbContext pooling From App Service: • Scale out the App Service plan to more instances • Use App Service Environment, whose worker instance can have more SNAT ports, due to its smaller instances pool size. • connection pools: By pooling your connections, you avoid opening new network connections for calls to the same address and port. • service endpoints: You don't have a SNAT port restriction to the services secured with service endpoints. (VNet) • private endpoints: You don't have a SNAT port restriction to services secured with private endpoints. (VNet) • NAT Gateway: With a NAT Gateway, you have 64k outbound SNAT ports that are usable by the resources sending traffic through it.
  • 11. Sample • DBContextPool • Reuse HttpClient • Release HttpWebRequest • Scale out App service
  • 12. LCK_M_* Waits 0 Schedulers Runnable Queue 1 2 1 Suspended Queue 2 SELECT * FROM Users WHERE Name LIKE 'K%' UPDATE Users SET Name = 'Jesse Pinkman' WHERE Id = 3 Id Name 1 John Snow 2 Peter Partner 3 Kirill Nenahov 4 Jane Dow 1 Users 2 3 2 Id Name 1 John Snow 2 Peter Partner 3 Jesse Pinkman 4 Jane Dow LCK_M_X LCK_M_X 2 X S
  • 13. Summary • Paging • Indexes • SNAT • Blocking • Transaction
  • 14. Denis Reznik Data Architect Intapp /denis-reznik-2345023 @denisreznik /denis.reznik.5 Sergii Bielskyi Head of R&D ELEKS /sergii-bielskyi-884a7a2b @sergey_belskiy /sergey.belskiy
  • 16. Regular mistakes of using ORM (EF) • Too greedy with Columns • Too greedy with Rows • Bulk insert • Mismatched data types • Autochangetracker • AsNoTracking • Dynamic types of arrays • toList(), toGroup(), etc