Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Houston, we have a problem with the queries

Houston, we have a problem with the queries

During this talk, you will see how the performance problems on the queries could affect an API in different aspects. Some of them are connected with the harmful use of the join operations, but others imply that you wrote the query without the assistance of any framework.

You will see a short scenario with a microservice that executes different queries to insert/update or obtain the information from other tables with performance issues. This scenario will help you to learn how to create some test on the layer that access the database and include some library like QuickPerf to analyze and detect problems in the performance.

Avatar for Andres Sacco

Andres Sacco

August 06, 2023
Tweet

Other Decks in Programming

Transcript

  1. @socialmedia 2 saccoandres ABOUT ME I’ve worked as developer since

    2007 using different languages like Java, Kotlin, Scala, PHP, and NodeJS. I've participated as a Technical Reviewer of Packt, Apress, and Manning books. I published books, courses, and different theoretical-practical projects. I participated as speaker on different conferences. ANDRES SACCO [email protected] andres-sacco Testμ 2023
  2. @socialmedia 3 CONTEXT AN ENDPOINT TAKES MORE TIME TO RESPOND

    INCREASE THE LATENCY IN ALL THE PLATFORM You have a microservice which have performance issues INCREASE THE USE OF RESOURCES IT IS NOT SIMPLE TO FIND THE PROBLEM Testμ 2023
  3. @socialmedia 4 @socialmedia 4 HOW TO FIND THE PROBLEM? TEST

    THE ENTIRE LOGIC TO FIND THE PROBLEM END-TO-END TOOLS LIKE NEWRELIC OR ELK TO SEE THE TRACES APM TO CHECK THE PERFORMANCE OF THE ENDPOINT PERFORMANCE TO SHOW THE TIME ON EACH LAYER OR SECTION LOGS Testμ 2023
  4. @socialmedia 5 WHY THESE APPROACHES COULD FAIL? DIFFICULT TO FIND

    DIFFICULT TO UNDERSTAND DIFFICULT TO CHECK NOT OCCURS AGAIN Testμ 2023
  5. @socialmedia 6 WHICH TOOLS EXIST TO CHECK AND TEST? MAIN

    DIFFERENCES JFRUNIT QUICKPERF GATLING JMETER 01 DETECT PROBLEM ON PERFORMANCE 02 SIMPLE TO IMPLEMENT 03 CHECK PROBLEM ON QUERIES 04 HAVE A BIG LEVEL OF DETAIL ON MORE THAN ONE LANGUAGE 05 SUPPORT APPLICATION OR TESTING LIBRARIES 06 RUNNING OUTSIDE OF THE APPLICATION Testμ 2023
  6. @socialmedia 7 PROS/CONS OF USE QUICKPERF SHOW YOU WHERE IS

    THE PROBLEM YOU CAN VALIDATE THE NUMBER OF QUERIES INTEGRATE WITH FRAMEWORKS LIKE SPRING BOOT CHECK THE CONSUME OF RESOURCES NEED ACCESS TO A DATABASE COULD BE NOT IDEMPOTENT Testμ 2023
  7. @socialmedia 8 SPRING BOOT JAVA DOCKER MAVEN EXAMPLE Let’s see

    an example https://github.com/andres-sacco/houston-problem Testμ 2023
  8. @socialmedia 9 @socialmedia 9 CREATE TESTS FOR EACH COMPLEX QUERY

    BEST PRACTICES ALWAYS HAVE TESTS IT IS A GOOD WAY TO DETECTED PROBLEMS CREATE PERFORMANCE TESTS RUN THE TESTS IN A PIPELINE RUN THE QUERY TESTS CREATE ALERTS FOR PROBLEMS ON THE PERFORMANCE DEFINE ALERTS IF YOU HAVE ANY DOUBTS SEND THE QUERY TO YOUR DBA CHECK WITH YOUR DBA Testμ 2023