SlideShare uma empresa Scribd logo
1 de 118
Java Performance
           artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Oracle as Datasource
Java Performance
                                                                                        2

                               artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




JDBC
   1) JDBC Overview
   2) JDBC
   3) JDBC Architecture


Oracle JDBC Driver
   1)   Oracle JDBC Driver
   2)   JDBC Driver Performance Test

Cursor & JDBC
   1)   Oracle SQL Execution
   2)   Java SQL Execution
   3)   JDBC Performance
Java Performance
       artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




   JDBC
Java Performance
                                                                        4
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
   JDBC Overview




• JDBC
   – RDBMS                                                   API
        • RDBMS                        table        spreadsheet        flat
          file
   – Java Database Connectivity
        • Trademark name


                   parameter                                  SQL
Application
                                 JDBC
                                               JDBC Driver
                               Interface                              RDBMS
    SQL                                                      Result
                    return
Java Performance
                                                                     5
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Overview




• JDBC History


                  Version         JSR Specification     JDK Implementation

2006              JDBC 4.0            JSR 221               Java SE 6

2001              JDBC 3.0             JSR 54                JDK 1.4

1999              JDBC 2.1                                   JDK 1.2

1997              JDBC 1.2                                   JDK 1.1
Java Performance
                                                            6
         Java Performance Fundamental | twitter @novathinker
                      artdb@ex-em.com | performeister.tistory.com
  JDBC




• JDBC API
  –        Database         Java Program

  – Write once Run Anywhere
  – DB      Table             Datasource

  – J2SE, J2EE
  – java.sql, javax.sql package
Java Performance
                                                                        7
              Java Performance Fundamental | twitter @novathinker
                           artdb@ex-em.com | performeister.tistory.com
     JDBC




 • JDBC API
                                                        javax.sql.DataSource
            DriverManager          Driver                javax.sql.RowSet


SavePoint    Connection       Statement     ResultSet           Types


                          PrepearedStatemen      ResultSetMetetaData


                          CallableStatement       DatabaseMetaData



 SQLData       SQLInput       SQLOutput       Struct      Ref     Array

                          Blob       Clob
Java Performance
                                                                   8
                Java Performance Fundamental | twitter @novathinker
                             artdb@ex-em.com | performeister.tistory.com
  JDBC




• JDBC API
  – Package java.sql
         • DB                                     Core JDBC API
  – Package javax.sql
         • JDBC client         Server     Datasource
             API
  – JDK             Interface
  –                      JDBC Driver
Java Performance
                                                              9
           Java Performance Fundamental | twitter @novathinker
                        artdb@ex-em.com | performeister.tistory.com
  JDBC




• JDBC Drive Manager
  – JDBC Driver                      Java App.
                    Class

  – JDBC Architecture

  – Java Application                          DB
         Driver           load
Java Performance
                                                              10
           Java Performance Fundamental | twitter @novathinker
                        artdb@ex-em.com | performeister.tistory.com
  JDBC




• JDBC Test Suit
  – Driver Vendor

  – J2EE        Driver

  – JDBC Version

  – JDBC Test Suit 1.2.1              JDBC 2.0 API
  – JDBC Test Suit 1.3.1              JDBC 3.0 API
Java Performance
                                                              11
           Java Performance Fundamental | twitter @novathinker
                        artdb@ex-em.com | performeister.tistory.com
  JDBC




• JDBC-ODBC Bridge
  – ODBC                    JDBC Type 1 Driver

  – JDBC     Method Call           ODBC        Function Call



  –      sun.jdbc.odbc java package

  – ODBC                    native library
Java Performance
                                                                         12
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Layer of the JDBC Architecture

             Java                                       JDBC Driver
                                     JDBC API
          Application                                     Manager
                                                   n
                                             la tio
                                            s
                                    T ran
         JDBC Driver               JDBC Driver          JDBC Driver




                                       ODBC
                 RDBMS                                    Oracle
                                    Data Source
Java Performance
                                                                         13
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 1 JDBC Architecture
     Java
  Application


                Type 1 JDBC
                Driver (Java)


                              JDBC-ODBC
                                Library
                             (Native code)


                                        ODBC Driver
                                        (Native code)             Database
Java Performance
                                                                         14
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 1 JDBC Architecture
  – JDBC-ODBC Bridge Driver

  – JDBC Method Call                       ODBC Function Call



  – JDBC Driver

  – sun.jdbc.odbc.JdbcOdbcDriver class

  – Platform
Java Performance
                                                                         15
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 2 JDBC Architecture

     Java
  Application


                 Type 2 JDBC
                 Driver (Java)


                                Database
                                 Library
                              (Native code)

                                                         Database
Java Performance
                                                                         16
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 2 JDBC Architecture
  – Native API Driver

  – JDBC Method Call                       DB API        Native Call

  – DB API

  – Native binary code                       client

  – Oracle Client
Java Performance
                                                                         17
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 3 JDBC Architecture

     Java
  Application


                Type 3 JDBC
                Driver (Java)
                                    Network Protocol


                                        JDBC
                                     Middleware                   Database
Java Performance
                                                                         18
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
  JDBC Architecture




• Type 3 JDBC Architecture
  – Network Protocol Driver

  – Calling Program                      DB            Middle-tier



  –                     Driver              DB

  – Platform

  –             , Load Balancing, Logging
Java Performance
                                                                          19
                       Java Performance Fundamental | twitter @novathinker
                                    artdb@ex-em.com | performeister.tistory.com
   JDBC Architecture




• Type 4 JDBC Architecture
         Java                     Type 4 JDBC
      Application                 Driver (Java)             Database


  – JDBC Call                  DB Protocol
  –             Java                      Platform
  – Conversion
  – DBMS
  –                    install
Java Performance
          artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Oracle JDBC Driver
Java Performance
                                                                                  21
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
    Oracle JDBC Driver




• Oracle JDBC Architecture
Java Virtual Machine
                                                  Oracle Database
   Java Application                                   (Local)
       Type 4
   JDBC Thin Driver
                                                              Java Engine
     Java Sockets                                                Type4
                                     SQL Engine         Server-side Thin Driver
                                                                 Type2
   Java Application
                                    PL/SQL Engine         Server-side Internal
       Type 2                                                    Driver
   JDBC OCI Driver                                          KPRB C Library
     OCI C Library




                                           Remote Oracle Database
Java Performance
                                                                      22
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Architecture
  –4                   JDBC Driver
        • Client Side
               – Type 4, JDBC Thin Driver

               – Type 2, JDBC OCI Driver

        • Server Side
               – Type 4, Server-side Thin Driver
               – Type 2, Server-side Internal Driver
Java Performance
                                                                           23
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  – Client JDBC Thin Driver
        • TTC(Two-Task Common)                              Oracle Net   Emulate
            Java Net
        • TCP/IP

                                    Java Application, applet

                                         JDBC Thin Driver

                                   Presentation-Java TTC

                                                      Communication

                              Java Net                  Addressing

                                                            Java NS

                                                        Java Sockets
                       TCP/IP Network Protocol
                                                      TCP/IP Protocol
Java Performance
                                                                             24
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  – Client JDBC OCI Driver
        • OCI (Oracle Call Interface)
        •C               OCI Library                            Native API
        •

                                         Java Application

                                         JDBC OCI Driver

                                       Presentation-TTC

                                  Oracle Net Foundation Layer

                                    Oracle Protocol Support

                       Network Protocol TCP/IP, TCP/IP with SSL and Named
Java Performance
                                                                      25
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  – Server-side Internal Driver
        • Oracle DB                Java Code
        • Internal driver          SQL, PL/SQL
        • Java Engine           Oracle DB                          DB

        • Oracle SQL Engine                                     KPRB
          Library
        • Network                             Oracle DB, JVM, KPRB C
          library, SQL Engine
Java Performance
                                                                      26
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  – Server-side Thin Driver
        •              PL/SQL            DB

        • Oracle Instance            Application Server



        •                    DB Link              Remote DB
                                            ,       SQL
            Overhead
Java Performance
                                                                      27
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  –                    Driver

        • Middle Tier Oracle DB       Java code
              Server-side Thin Driver
        • Oracle DB       Local                  Server-side
          Internal Driver
        • JDBC Applet         Client Thin Driver
        • Application           Platform                       Client Thin
          Driver
Java Performance
                                                                      28
                   Java Performance Fundamental | twitter @novathinker
                                artdb@ex-em.com | performeister.tistory.com
  Oracle JDBC Driver




• Oracle JDBC Driver
  –                    Driver

        • TCP/IP

        • OCI connection Pooling

        • RAC           TAF

        •               DB    XA

        • Kerberos

        •                     Client OCI Driver
Java Performance
                                                                     29
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Oracle JDBC Driver
  – Test

       • Oracle             Driver

  – Test Driver
       • Client Oracle Thin Driver (Type 4)

       • Client Oracle OCI Driver (Type 2)
       • Server-side Internal Driver (Type 2)
Java Performance
                                                                     30
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Oracle JDBC Driver
  – Test
        • Connection Test

        • Unique Key                            Query

        • Index Range Scan                                       Fetch

        • Unique Key                            Update
Java Performance
                                                                     31
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Oracle JDBC Driver
  – Test                    (Server)
        • OS
              – Cent OS 5 (64bit)
              – CPU : 4 (Intel(R) Core(TM)2 Quad CPU Q6600 @
                2.40GHz)
              – Memory : 2 GB
        • Oracle Database
              – Oracle Database 10g Enterprise Edition Release
                10.2.0.4.0 - 64bit
              – sga_target : 536 MB
Java Performance
                                                                     32
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Oracle JDBC Driver
  – Test                    (Client)
        • OS
              – Windows XP Service pack 3 (32bit)
              – CPU : 2 (Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz)
              – Memory : 4 GB
        • Java Version
              – Sun Hotspot JVM (1.5.0_17-b04)
              – 32 bit , client VM
        • JDBC Version - ojdbc14.jar
              – Oracle JDBC driver classes for use with JDK14
              – Created-By: 1.4.2_08 (Sun Microsystems Inc.)
              – Oracle JDBC Driver version - "10.2.0.1.0"
Java Performance
                                                                      33
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Test

                            OCI Driver   THIN Driver      Internal Driver


 Connection                   4.808          3.352            0.025


    Query                     9.203          9.75             1.997


     Fetch                    8.093          8.047            0.604


   Update                     9.469          9.156            1.965
Java Performance
                                                                     34
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Test                      - Connection
                        OCI      THIN    Local OCI Local Thin     KPRB
Connection            4.808      3.352     2.672      2.504       0.025


  – Remote vs Local ?
  – Connection Pool ?
  – Internal Driver (kprb) ?
Java Performance
                                                                      35
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Test                      - Query

                                OCI          THIN             KPRB
    Query                      9.203         9.75             1.997




                                OCI          THIN              KPRB

     Parse                       0             0                 0

   Execute                   1.63 / 1.55   1.65 / 1.57      1.30 / 1.11

     Fetch                   0.24 / 0.27   0.30 / 0.28      0.09 / 0.11

      Wait                      6.49          6.87               0
Java Performance
                                                                       36
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Test                      - Fetch

                                  OCI          THIN             KPRB
     Fetch                       8.093        8.047            0.604




                                OCI          THIN              KPRB

     Parse                       0             0                 0

   Execute                       0             0                 0

     Fetch                   0.68 / 0.62   0.67 / 0.64      0.34 / 0.35

      Wait                      6.78          6.72               0
Java Performance
                                                                       37
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  JDBC Driver Performance




• Test                      - Update
                                  OCI          THIN             KPRB
    Update                       8.093        8.047            0.604




                                OCI          THIN              KPRB

     Parse                       0             0                 0

   Execute                   1.96 / 1.90   1.90 / 1.85      1.40 / 1.39

     Fetch                       0             0                 0

      Wait                      6.67          6.31               0
Java Performance
                                                                       38
                    Java Performance Fundamental | twitter @novathinker
                                 artdb@ex-em.com | performeister.tistory.com
    JDBC Driver Performance




•
    – OCI             Thin Driver



    – Internal Driver                       client      Driver
       Network
Java Performance
        artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Cursor & JDBC



                                                                     39
Java Performance
                                                                     40
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle Memory Architecture
Java Performance
                                                                     40
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle Memory Architecture




             SQL Cache Area
Java Performance
                                                                     41
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Flow

            Parse



         Execute



            Fetch
Java Performance
                                                                     41
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Flow

            Parse



         Execute                                               ?



            Fetch
Java Performance
                                                                     42
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Flow
  – Parse
        •            SQL
        • SQL Syntax check , semantic Check, Execution
          Plan
        •      Cache                         (soft Parse)
        •                       (Hard Parse)
        • Cache                       Library Cache
        • Cache
              – Hash Table, Library cache Chain
              – Library Cache Handle
              – Library Cache Object
Java Performance
                                                                     43
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Flow
  – Execute
        • Execution Plan                      SQL
        • Bind
  – Fetch
        •                SQL
        • DML                  Fetch
Java Performance
                                                                            44
                    Java Performance Fundamental | twitter @novathinker
                                 artdb@ex-em.com | performeister.tistory.com
    Oracle SQL Execution




 • Library Cache

                                                                   Hash Chain
                   Hash bucket 1
  SQL



  Hash             Hash bucket 2
Function
                                                   library cache lock
                                                   Parent
                 Hash bucket3
                            latch: library cache
                                                                   library cache pin
                                               child   child

                                                               Library Cache
                                                                   Object
Java Performance
                                                                     45
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – Cursor




  – Oracle Cursor
   : SQL                              Memory
Java Performance
                                                                     46
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – V$OPEN_CURSOR
SELECT inst_id ,
       kgllkuse saddr ,
       kgllksnm sid ,
       user_name ,
       kglhdpar address ,
       kglnahsh hash_value ,
       kgllksqlid sql_id ,
       kglnaobj sql_text
FROM   x$kgllk
WHERE kglhdnsp = 0
AND    kglhdpar != kgllkhdl
Java Performance
                                                                     46
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – V$OPEN_CURSOR
SELECT inst_id ,
       kgllkuse saddr ,
       kgllksnm sid ,
       user_name ,
       kglhdpar address ,
       kglnahsh hash_value ,
       kgllksqlid sql_id ,
       kglnaobj sql_text
FROM   x$kgllk  Library Cache Lock                          dynamic view
WHERE kglhdnsp = 0
AND    kglhdpar != kgllkhdl
Java Performance
                                                                     46
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – V$OPEN_CURSOR
SELECT inst_id ,
       kgllkuse saddr ,
       kgllksnm sid ,
       user_name ,
       kglhdpar address ,
       kglnahsh hash_value ,
       kgllksqlid sql_id ,
       kglnaobj sql_text
FROM   x$kgllk  Library Cache Lock                          dynamic view
WHERE kglhdnsp = 0  Namespace SQL Area
AND    kglhdpar != kgllkhdl
Java Performance
                                                                     46
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – V$OPEN_CURSOR
SELECT inst_id ,
       kgllkuse saddr ,
       kgllksnm sid ,
       user_name ,
       kglhdpar address ,
       kglnahsh hash_value ,
       kgllksqlid sql_id ,
       kglnaobj sql_text
FROM   x$kgllk  Library Cache Lock              dynamic view
WHERE kglhdnsp = 0  Namespace SQL Area
AND    kglhdpar != kgllkhdl  Library Cache handle Child
Java Performance
                                                                     46
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Cursor
  – V$OPEN_CURSOR
SELECT inst_id ,
       kgllkuse saddr ,
       kgllksnm sid ,
       user_name ,
       kglhdpar address ,
       kglnahsh hash_value ,
       kgllksqlid sql_id ,
       kglnaobj sql_text
FROM   x$kgllk  Library Cache Lock              dynamic view
WHERE kglhdnsp = 0  Namespace SQL Area
AND    kglhdpar != kgllkhdl  Library Cache handle Child


   Cursor library cache lock                            sql area
library cache child Handle
Java Performance
                                                                     47
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                     48
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
Java Performance
                                                                      49
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Soft Parse
    Cursor Open

                              library cache lock         library cache pin
          Parse               (mode 1 null)              (mode 2 share)


                              library cache lock         library cache pin
        Execute               (mode 1 null)              (mode 2 share)


                              library cache lock         library cache pin
          Fetch               (mode 1 null)              (mode 2 share)

                              library cache lock
    Cursor Close              (mode 1 null)
Java Performance
                                                                     50
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Hard Parse
Java Performance
                                                                     51
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Hard Parse
                                                  Session 2


         Session 1




                    Blocking!!!
Java Performance
                                                                     52
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Hard Parse
Java Performance
                                                                      53
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Oracle SQL Execution




• Oracle SQL Execution Test – Hard Parse

    Cursor Open                 Lock mode conversion

                              library cache lock         library cache pin
                              Hard Parse : mode 3        Hard Parse : mode 3
          Parse               Soft Parse : mode 1        Soft Parse : mode 2


                              library cache lock         library cache pin
        Execute               (mode 1 null)              (mode 2 share)


                              library cache lock         library cache pin
          Fetch               (mode 1 null)              (mode 2 share)

                              library cache lock
    Cursor Close              (mode 1 null)
Java Performance
                                                                       54
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Flow
Connection Open

                       Statement

                                   Execute

                                                ResultSet

                                                               Fetch

                                             ResultSet Close

                 Statement close

Connection close
Java Performance
                                                                     55
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test
Connection Open

   Statement
                           select s.sid, s.serial#, p.spid from v
    Execute                $session s, v$process p where
                           s.PROGRAM='EXEM JDBC TEST' and s.paddr =
                           p.addr(+)
   ResultSet
                           exec sys.dbms_system.set_ev(156,1475,
                           10046, 12, '');
      Fetch

ResultSet Close
                           select * from sys.exem$liblock where sid
                           = 156 and name like '%JDBC%';
Statement close

Connection close
Java Performance
                                                                     56
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 1
Java Performance
                                                                     57
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 1
Java Performance
                                                                            58
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 1
Connection Open

   Statement             Cursor Open    parse execute         Fetch

                                 library cache lock     library cache pin
 Rs = Execute                    (mode 1 null)          (mode 2 share)
                                         library cache lock     library cache pin
      Fetch                 Fetch        (mode 1 null)          (mode 2 share)

ResultSet Close
                               library cache lock     library cache pin
                               (mode 1 null)
Statement close

Connection close           Cursor close        library cache lock
Java Performance
                                                                     59
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 2
                SQL 1                            SQL 2
        Connection Open                         Statement

              Statement                          Execute

                Execute                         ResultSet

               ResultSet                          Fetch

                  Fetch                      ResultSet Close

          ResultSet Close                    Statement close

         Statement close                    Connection close
Java Performance
                                                                        60
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 2


                                                          SQL 1 Statement

                                                          SQL 1 Execute




                                                          SQL 1 Fetch
Java Performance
                                                                        61
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 2
                                                          SQL 2 Statement


                                                          SQL 2 Execute




                                                          SQL 2 Fetch




                                                         Connection Closed
Java Performance
                                                                     62
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 2




  – Cursor             2
        • JDBC              ? or Oracle           ?
Java Performance
                                                                     62
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 2




  – Cursor             2
        • JDBC              ? or Oracle           ?
Java Performance
                                                                     63
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 3
  – Connection

alter session set session_cached_cursors=0


                                                         SQL 2 Statement



                                                         SQL 2 Execute
Java Performance
                                                                     64
                  Java Performance Fundamental | twitter @novathinker
                               artdb@ex-em.com | performeister.tistory.com
  Java SQL Execution




• Java SQL Execution Test 3
  – session_cached_cursors
        •               session      cache      cursor

        •              SQL                Parse Call      cache
        • Cache                 cursor   reopen
              – Library cache Latch & Lock

        •                     Softer soft Parse
        • JDBC                                    Parse Call
            Cursor           Cache
Java Performance
                                                                    65
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Strategy Point
  – SQL
Java Performance
                                                                    66
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Strategy Point
  – SQL
Java Performance
                                                                    67
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  –
       • Statement
       • PreparedStatement
         Session_cached_cursor = 0
       • PreparedStatement
         Session_cached_cursor = 20
       • JDBC Statement caching
       • PrepareStatement             Loop           1
  – Test
       •             SQL   10000
Java Performance
                                                                    68
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – Statement
Java Performance
                                                                    69
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement
Java Performance
                                                                    70
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                     Session Cached Cursor = 0
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                     Session Cached Cursor = 0
                                     Statement Cache = 0
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                     Session Cached Cursor = 0
                                     Statement Cache = 0


                                         Session Cached Cursor = 20
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                     Session Cached Cursor = 0
                                     Statement Cache = 0


                                         Session Cached Cursor = 20
                                         Statement Cache = 0
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                      Session Cached Cursor = 0
                                      Statement Cache = 0


                                         Session Cached Cursor = 20
                                         Statement Cache = 0

                                     Session Cached Cursor = 0
Java Performance
                                                                    71
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement

                                      Session Cached Cursor = 0
                                      Statement Cache = 0


                                         Session Cached Cursor = 20
                                         Statement Cache = 0

                                     Session Cached Cursor = 0
                                     Statement Cache = 20
Java Performance
                                                                    72
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – PreparedStatement                    Loop
Java Performance
                                                                                 73
                          Java Performance Fundamental | twitter @novathinker
                                       artdb@ex-em.com | performeister.tistory.com
          JDBC Performance




    • Parse Performance
                                         PreparedState   Session      JDBC
                             Statement                   Cached    Statement   Out Loop
                                         ment NoCache
                                                         Cursor      Cache
Total Elapsed                 22.172         17.14        17.14      9.156      9.766
DB Wait_time                  12.485        12.299       12.44       6.318      6.873
DB Time                        0.855         0.395       0.373       0.23       0.254
App Time                       8.832         4.446       4.327       2.608      2.639
parse count                   10027         10008        10008        9           9
hard parse                    10001           1            0          0           0
parse time                     0.624         0.018       0.012        0           0
librarycache latch            271037        100159       60089      30087       30493
library cache lock latch      60415         40047        40048      20038        100
library cache pin latch       90624         40047        20018      10016       20162
RoundTrip                     20002         20002        20002      10003       10006
opened cursors                10027         10008        10008        9           9
Java Performance
                                                                               74
                       Java Performance Fundamental | twitter @novathinker
                                    artdb@ex-em.com | performeister.tistory.com
        JDBC Performance




   • Parse Performance




                                       PreparedState   Session      JDBC
                           Statement                   Cached    Statement   Out Loop
                                       ment NoCache
                                                       Cursor      Cache
Total Elapsed               22.172         17.14        17.14      9.156      9.766
Java Performance
                                                                                 75
                         Java Performance Fundamental | twitter @novathinker
                                      artdb@ex-em.com | performeister.tistory.com
          JDBC Performance




   • Parse Performance




                                         PreparedState   Session      JDBC
                             Statement                   Cached    Statement   Out Loop
                                         ment NoCache
                                                         Cursor      Cache
DB Wait_time                  12.485        12.299        12.44      6.318      6.873
DB Time                        0.855         0.395       0.373       0.23       0.254
App Time                       8.832         4.446       4.327       2.608      2.639
RoundTrip                     20002         20002        20002      10003       10006
Java Performance
                                                                                76
                        Java Performance Fundamental | twitter @novathinker
                                     artdb@ex-em.com | performeister.tistory.com
         JDBC Performance




   • Parse Performance




                                        PreparedState   Session      JDBC
                            Statement                   Cached    Statement   Out Loop
                                        ment NoCache
                                                        Cursor      Cache
librarycache latch           271037        100159        60089      30087      30493
library cache lock latch     60415         40047        40048      20038        100
library cache pin latch      90624         40047        20018      10016       20162
opened cursors               10027         10008        10008        9           9
Java Performance
                                                                    77
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – Statement
       • Hard Parsing                 DB overhead
       • Application
  – PreparedStatement with NoCache
       •                         Parse     Round Trip
  – PreparedStatement with Session Cached
    Cursor
       • Parse        Round Trip, Open          Cursor

       • Library Cache                      Latch     Lock, Pin
                  Overhead
Java Performance
                                                                    78
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  –1          PreparedStatement and Loop
       • Parse     Library Cache Lock
         Library Cache Pin
       •1            Parse                                       Loop

       • Parse Call                Round Trip
       • Oracle                     Overhead
       •                     SQL                           SQL
Java Performance
                                                                    79
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Parse Performance
  – Statement Cache
       • JDBC 3.0
       • JDBC Cursor             Open       Cache
       • Soft Parse                Round Trip
       • Library cache Latch, lock, pin             Overhead
       • Connection                                 SQL            Cache




          (          : http://performeister.tistory.com/20 )
Java Performance
                                                                    80
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance
  –
       •                    Update
       • 1000            Update Batch
       • One SQL          Update
  – Test
       •                   10000               Update
Java Performance
                                                                    81
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance
Java Performance
                                                                    81
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance




                                             Batch   0            Execute
Java Performance
                                                                    81
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance




                                             Batch    0           Execute

                                                         Batch
                                                   Execute batch
Java Performance
                                                                    82
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance
  –                              One Sql        Update
Java Performance
                                                                     83
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance


                               Each           Batch        One Sql
  Total Elapsed                9.437          1.532          2.25
  DB Wait_time                 6.51            0.55          0.55
  DB Time                      0.225          0.154         0.227
  App Time                     2.702          0.828         1.473
  Execute count               10006             18            10
  Logical read                40364           30378         46713
  Round Trip                  10003             13            4
Java Performance
                                                                    84
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance




                              Each           Batch        One Sql
 DB Wait_time                  6.51           0.55          0.55
 DB Time                       0.225          0.154         0.227
 App Time                      2.702          0.828         1.473
 Round Trip                   10003            13            4
Java Performance
                                                                     85
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance




                               Each           Batch        One Sql
 Execute count                10006            18            10
 Logical read                 40364           30378        46713
 Round Trip                   10003            13            4
Java Performance
                                                                    86
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance
  – One SQL
       •                                               Update Batch

       •             Storage                             IO

       • DML                       One SQL
Java Performance
                                                                    87
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Execute Performance
  – Update Batch
       • JDBC 3.0
       • Loop           batch size         Binding

       • Execute Count                          Round Trip

       • Array Processing



          (          : http://performeister.tistory.com/19 )
Java Performance
                                                                    88
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Fetch Performance
  –
       •                         Fetch
       • Prefetch                   Fetch            (fetch size = 100)
  – Test
       •                   100,000                     Query
Java Performance
                                                                    89
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Fetch Performance
Java Performance
                                                                    89
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Fetch Performance




                                             Fetch Size           Prefetch
Java Performance
                                                                    90
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Fetch Performance

                                        Normal           Prefetch
  Total Elapsed                           8.25             1.672
  DB Wait_time                           6.924              1.29
  DB Time                                 0.11             0.046
  App Time                               1.216             0.336
  Execute count                             7                 7
  Logical read                           30808             13794
  Round Trip                             10004              1004
  Client     Network (MB)              4.132952          3.795275
  Server     Network (KB)              68.81348          7.291992
Java Performance
                                                                    91
                 Java Performance Fundamental | twitter @novathinker
                              artdb@ex-em.com | performeister.tistory.com
  JDBC Performance




• Fetch Performance
  – Fetch
       • Query

       •          Fetch Size
       • Default Fetch Size 10
  – Prefetch
       • JDBC 2.0
       • Fetch Size                   Round Trip
       •                           Network
       (             : http://performeister.tistory.com/12 )
Java Performance
                                                   92
Java Performance Fundamental | twitter @novathinker
             artdb@ex-em.com | performeister.tistory.com

Mais conteúdo relacionado

Mais procurados

The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011Arun Gupta
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-landKresten Krab Thorup
 
Moving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterMoving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterDan Allen
 
Jvm performance tuning
Jvm performance tuningJvm performance tuning
Jvm performance tuningIgor Igoroshka
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011Arun Gupta
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the CloudArun Gupta
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SEdogangoko
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksAtlassian
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragonAyushman Jain
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabadrevanthonline
 
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-final2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-finalRohit Kelapure
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaManjula Kollipara
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Building Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGiBuilding Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGiCédric Hüsler
 
Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG sessionMani Sarkar
 
New Catalog 2012
New Catalog 2012New Catalog 2012
New Catalog 2012Noam_Shalem
 

Mais procurados (20)

The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-land
 
L1 basics
L1 basicsL1 basics
L1 basics
 
Moving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutterMoving to Java EE 6 and CDI and away from the clutter
Moving to Java EE 6 and CDI and away from the clutter
 
MJB Technologies
MJB TechnologiesMJB Technologies
MJB Technologies
 
Java J2EE Training in Chennai, Tambaram
Java J2EE  Training in Chennai, TambaramJava J2EE  Training in Chennai, Tambaram
Java J2EE Training in Chennai, Tambaram
 
Jvm performance tuning
Jvm performance tuningJvm performance tuning
Jvm performance tuning
 
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
OSGi-enabled Java EE Applications using GlassFish at JCertif 2011
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the Cloud
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragon
 
Java online training from hyderabad
Java online training from hyderabadJava online training from hyderabad
Java online training from hyderabad
 
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-final2012 04-09-v2-tdp-1167-cdi-bestpractices-final
2012 04-09-v2-tdp-1167-cdi-bestpractices-final
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kollipara
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Building Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGiBuilding Content Applications with JCR and OSGi
Building Content Applications with JCR and OSGi
 
Java 9 / Jigsaw - AJUG/VJUG session
Java 9 / Jigsaw - AJUG/VJUG  sessionJava 9 / Jigsaw - AJUG/VJUG  session
Java 9 / Jigsaw - AJUG/VJUG session
 
New Catalog 2012
New Catalog 2012New Catalog 2012
New Catalog 2012
 

Semelhante a Java Performance Optimization with JDBC

Jsp + My Sql
Jsp + My SqlJsp + My Sql
Jsp + My SqlAshwin K
 
chapter 5 java.pptx
chapter 5  java.pptxchapter 5  java.pptx
chapter 5 java.pptxBekiTube
 
Fundamentals of JDBC
Fundamentals of JDBCFundamentals of JDBC
Fundamentals of JDBCJainul Musani
 
creating jdbc connection
creating jdbc connectioncreating jdbc connection
creating jdbc connectionPaneliya Prince
 
creating jdbc connection
creating jdbc connectioncreating jdbc connection
creating jdbc connectionPaneliya Prince
 
Jdbc session01
Jdbc session01Jdbc session01
Jdbc session01Niit Care
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbcsriram raj
 
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...Juarez Junior
 
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...Juarez Junior
 
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...Juarez Junior
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingAnton Keks
 
High performance database applications with pure query and ibm data studio.ba...
High performance database applications with pure query and ibm data studio.ba...High performance database applications with pure query and ibm data studio.ba...
High performance database applications with pure query and ibm data studio.ba...Vladimir Bacvanski, PhD
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdfArumugam90
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdfArumugam90
 
Java database connectivity with MySql
Java database connectivity with MySqlJava database connectivity with MySql
Java database connectivity with MySqlDhyey Dattani
 
Java database connectivity with MySql
Java database connectivity with MySqlJava database connectivity with MySql
Java database connectivity with MySqlDhyey Dattani
 

Semelhante a Java Performance Optimization with JDBC (20)

Jsp + My Sql
Jsp + My SqlJsp + My Sql
Jsp + My Sql
 
Jdbc connectivity in java
Jdbc connectivity in javaJdbc connectivity in java
Jdbc connectivity in java
 
chapter 5 java.pptx
chapter 5  java.pptxchapter 5  java.pptx
chapter 5 java.pptx
 
Jdbc
JdbcJdbc
Jdbc
 
Fundamentals of JDBC
Fundamentals of JDBCFundamentals of JDBC
Fundamentals of JDBC
 
creating jdbc connection
creating jdbc connectioncreating jdbc connection
creating jdbc connection
 
creating jdbc connection
creating jdbc connectioncreating jdbc connection
creating jdbc connection
 
Jdbc session01
Jdbc session01Jdbc session01
Jdbc session01
 
Java database programming with jdbc
Java database programming with jdbcJava database programming with jdbc
Java database programming with jdbc
 
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
 
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
 
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
High performance database applications with pure query and ibm data studio.ba...
High performance database applications with pure query and ibm data studio.ba...High performance database applications with pure query and ibm data studio.ba...
High performance database applications with pure query and ibm data studio.ba...
 
jdbc
jdbcjdbc
jdbc
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
 
JDBC with MySQL.pdf
JDBC with MySQL.pdfJDBC with MySQL.pdf
JDBC with MySQL.pdf
 
Java database connectivity with MySql
Java database connectivity with MySqlJava database connectivity with MySql
Java database connectivity with MySql
 
Java database connectivity with MySql
Java database connectivity with MySqlJava database connectivity with MySql
Java database connectivity with MySql
 

Último

Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 

Java Performance Optimization with JDBC

  • 1. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Oracle as Datasource
  • 2. Java Performance 2 artdb@ex-em.com | performeister.tistory.com | twitter @novathinker JDBC 1) JDBC Overview 2) JDBC 3) JDBC Architecture Oracle JDBC Driver 1) Oracle JDBC Driver 2) JDBC Driver Performance Test Cursor & JDBC 1) Oracle SQL Execution 2) Java SQL Execution 3) JDBC Performance
  • 3. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker JDBC
  • 4. Java Performance 4 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Overview • JDBC – RDBMS API • RDBMS table spreadsheet flat file – Java Database Connectivity • Trademark name parameter SQL Application JDBC JDBC Driver Interface RDBMS SQL Result return
  • 5. Java Performance 5 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Overview • JDBC History Version JSR Specification JDK Implementation 2006 JDBC 4.0 JSR 221 Java SE 6 2001 JDBC 3.0 JSR 54 JDK 1.4 1999 JDBC 2.1 JDK 1.2 1997 JDBC 1.2 JDK 1.1
  • 6. Java Performance 6 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC API – Database Java Program – Write once Run Anywhere – DB Table Datasource – J2SE, J2EE – java.sql, javax.sql package
  • 7. Java Performance 7 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC API javax.sql.DataSource DriverManager Driver javax.sql.RowSet SavePoint Connection Statement ResultSet Types PrepearedStatemen ResultSetMetetaData CallableStatement DatabaseMetaData SQLData SQLInput SQLOutput Struct Ref Array Blob Clob
  • 8. Java Performance 8 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC API – Package java.sql • DB Core JDBC API – Package javax.sql • JDBC client Server Datasource API – JDK Interface – JDBC Driver
  • 9. Java Performance 9 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC Drive Manager – JDBC Driver Java App. Class – JDBC Architecture – Java Application DB Driver load
  • 10. Java Performance 10 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC Test Suit – Driver Vendor – J2EE Driver – JDBC Version – JDBC Test Suit 1.2.1  JDBC 2.0 API – JDBC Test Suit 1.3.1  JDBC 3.0 API
  • 11. Java Performance 11 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC • JDBC-ODBC Bridge – ODBC JDBC Type 1 Driver – JDBC Method Call ODBC Function Call – sun.jdbc.odbc java package – ODBC native library
  • 12. Java Performance 12 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Layer of the JDBC Architecture Java JDBC Driver JDBC API Application Manager n la tio s T ran JDBC Driver JDBC Driver JDBC Driver ODBC RDBMS Oracle Data Source
  • 13. Java Performance 13 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 1 JDBC Architecture Java Application Type 1 JDBC Driver (Java) JDBC-ODBC Library (Native code) ODBC Driver (Native code) Database
  • 14. Java Performance 14 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 1 JDBC Architecture – JDBC-ODBC Bridge Driver – JDBC Method Call ODBC Function Call – JDBC Driver – sun.jdbc.odbc.JdbcOdbcDriver class – Platform
  • 15. Java Performance 15 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 2 JDBC Architecture Java Application Type 2 JDBC Driver (Java) Database Library (Native code) Database
  • 16. Java Performance 16 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 2 JDBC Architecture – Native API Driver – JDBC Method Call DB API Native Call – DB API – Native binary code client – Oracle Client
  • 17. Java Performance 17 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 3 JDBC Architecture Java Application Type 3 JDBC Driver (Java) Network Protocol JDBC Middleware Database
  • 18. Java Performance 18 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 3 JDBC Architecture – Network Protocol Driver – Calling Program DB Middle-tier – Driver DB – Platform – , Load Balancing, Logging
  • 19. Java Performance 19 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Architecture • Type 4 JDBC Architecture Java Type 4 JDBC Application Driver (Java) Database – JDBC Call DB Protocol – Java  Platform – Conversion – DBMS – install
  • 20. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Oracle JDBC Driver
  • 21. Java Performance 21 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Architecture Java Virtual Machine Oracle Database Java Application (Local) Type 4 JDBC Thin Driver Java Engine Java Sockets Type4 SQL Engine Server-side Thin Driver Type2 Java Application PL/SQL Engine Server-side Internal Type 2 Driver JDBC OCI Driver KPRB C Library OCI C Library Remote Oracle Database
  • 22. Java Performance 22 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Architecture –4 JDBC Driver • Client Side – Type 4, JDBC Thin Driver – Type 2, JDBC OCI Driver • Server Side – Type 4, Server-side Thin Driver – Type 2, Server-side Internal Driver
  • 23. Java Performance 23 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Client JDBC Thin Driver • TTC(Two-Task Common) Oracle Net Emulate Java Net • TCP/IP Java Application, applet JDBC Thin Driver Presentation-Java TTC Communication Java Net Addressing Java NS Java Sockets TCP/IP Network Protocol TCP/IP Protocol
  • 24. Java Performance 24 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Client JDBC OCI Driver • OCI (Oracle Call Interface) •C OCI Library Native API • Java Application JDBC OCI Driver Presentation-TTC Oracle Net Foundation Layer Oracle Protocol Support Network Protocol TCP/IP, TCP/IP with SSL and Named
  • 25. Java Performance 25 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Server-side Internal Driver • Oracle DB Java Code • Internal driver SQL, PL/SQL • Java Engine Oracle DB DB • Oracle SQL Engine KPRB Library • Network Oracle DB, JVM, KPRB C library, SQL Engine
  • 26. Java Performance 26 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Server-side Thin Driver • PL/SQL DB • Oracle Instance Application Server • DB Link Remote DB , SQL Overhead
  • 27. Java Performance 27 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Driver • Middle Tier Oracle DB Java code Server-side Thin Driver • Oracle DB Local Server-side Internal Driver • JDBC Applet Client Thin Driver • Application Platform Client Thin Driver
  • 28. Java Performance 28 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle JDBC Driver • Oracle JDBC Driver – Driver • TCP/IP • OCI connection Pooling • RAC TAF • DB XA • Kerberos • Client OCI Driver
  • 29. Java Performance 29 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Oracle JDBC Driver – Test • Oracle Driver – Test Driver • Client Oracle Thin Driver (Type 4) • Client Oracle OCI Driver (Type 2) • Server-side Internal Driver (Type 2)
  • 30. Java Performance 30 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Oracle JDBC Driver – Test • Connection Test • Unique Key Query • Index Range Scan Fetch • Unique Key Update
  • 31. Java Performance 31 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Oracle JDBC Driver – Test (Server) • OS – Cent OS 5 (64bit) – CPU : 4 (Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz) – Memory : 2 GB • Oracle Database – Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit – sga_target : 536 MB
  • 32. Java Performance 32 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Oracle JDBC Driver – Test (Client) • OS – Windows XP Service pack 3 (32bit) – CPU : 2 (Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz) – Memory : 4 GB • Java Version – Sun Hotspot JVM (1.5.0_17-b04) – 32 bit , client VM • JDBC Version - ojdbc14.jar – Oracle JDBC driver classes for use with JDK14 – Created-By: 1.4.2_08 (Sun Microsystems Inc.) – Oracle JDBC Driver version - "10.2.0.1.0"
  • 33. Java Performance 33 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Test OCI Driver THIN Driver Internal Driver Connection 4.808 3.352 0.025 Query 9.203 9.75 1.997 Fetch 8.093 8.047 0.604 Update 9.469 9.156 1.965
  • 34. Java Performance 34 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Test - Connection OCI THIN Local OCI Local Thin KPRB Connection 4.808 3.352 2.672 2.504 0.025 – Remote vs Local ? – Connection Pool ? – Internal Driver (kprb) ?
  • 35. Java Performance 35 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Test - Query OCI THIN KPRB Query 9.203 9.75 1.997 OCI THIN KPRB Parse 0 0 0 Execute 1.63 / 1.55 1.65 / 1.57 1.30 / 1.11 Fetch 0.24 / 0.27 0.30 / 0.28 0.09 / 0.11 Wait 6.49 6.87 0
  • 36. Java Performance 36 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Test - Fetch OCI THIN KPRB Fetch 8.093 8.047 0.604 OCI THIN KPRB Parse 0 0 0 Execute 0 0 0 Fetch 0.68 / 0.62 0.67 / 0.64 0.34 / 0.35 Wait 6.78 6.72 0
  • 37. Java Performance 37 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • Test - Update OCI THIN KPRB Update 8.093 8.047 0.604 OCI THIN KPRB Parse 0 0 0 Execute 1.96 / 1.90 1.90 / 1.85 1.40 / 1.39 Fetch 0 0 0 Wait 6.67 6.31 0
  • 38. Java Performance 38 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Driver Performance • – OCI Thin Driver – Internal Driver client Driver Network
  • 39. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Cursor & JDBC 39
  • 40. Java Performance 40 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle Memory Architecture
  • 41. Java Performance 40 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle Memory Architecture SQL Cache Area
  • 42. Java Performance 41 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Flow Parse Execute Fetch
  • 43. Java Performance 41 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Flow Parse Execute ? Fetch
  • 44. Java Performance 42 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Flow – Parse • SQL • SQL Syntax check , semantic Check, Execution Plan • Cache (soft Parse) • (Hard Parse) • Cache  Library Cache • Cache – Hash Table, Library cache Chain – Library Cache Handle – Library Cache Object
  • 45. Java Performance 43 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Flow – Execute • Execution Plan SQL • Bind – Fetch • SQL • DML Fetch
  • 46. Java Performance 44 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Library Cache Hash Chain Hash bucket 1 SQL Hash Hash bucket 2 Function library cache lock Parent Hash bucket3 latch: library cache library cache pin child child Library Cache Object
  • 47. Java Performance 45 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – Cursor – Oracle Cursor : SQL Memory
  • 48. Java Performance 46 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – V$OPEN_CURSOR SELECT inst_id , kgllkuse saddr , kgllksnm sid , user_name , kglhdpar address , kglnahsh hash_value , kgllksqlid sql_id , kglnaobj sql_text FROM x$kgllk WHERE kglhdnsp = 0 AND kglhdpar != kgllkhdl
  • 49. Java Performance 46 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – V$OPEN_CURSOR SELECT inst_id , kgllkuse saddr , kgllksnm sid , user_name , kglhdpar address , kglnahsh hash_value , kgllksqlid sql_id , kglnaobj sql_text FROM x$kgllk  Library Cache Lock dynamic view WHERE kglhdnsp = 0 AND kglhdpar != kgllkhdl
  • 50. Java Performance 46 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – V$OPEN_CURSOR SELECT inst_id , kgllkuse saddr , kgllksnm sid , user_name , kglhdpar address , kglnahsh hash_value , kgllksqlid sql_id , kglnaobj sql_text FROM x$kgllk  Library Cache Lock dynamic view WHERE kglhdnsp = 0  Namespace SQL Area AND kglhdpar != kgllkhdl
  • 51. Java Performance 46 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – V$OPEN_CURSOR SELECT inst_id , kgllkuse saddr , kgllksnm sid , user_name , kglhdpar address , kglnahsh hash_value , kgllksqlid sql_id , kglnaobj sql_text FROM x$kgllk  Library Cache Lock dynamic view WHERE kglhdnsp = 0  Namespace SQL Area AND kglhdpar != kgllkhdl  Library Cache handle Child
  • 52. Java Performance 46 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Cursor – V$OPEN_CURSOR SELECT inst_id , kgllkuse saddr , kgllksnm sid , user_name , kglhdpar address , kglnahsh hash_value , kgllksqlid sql_id , kglnaobj sql_text FROM x$kgllk  Library Cache Lock dynamic view WHERE kglhdnsp = 0  Namespace SQL Area AND kglhdpar != kgllkhdl  Library Cache handle Child Cursor library cache lock sql area library cache child Handle
  • 53. Java Performance 47 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 54. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 55. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 56. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 57. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 58. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 59. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 60. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 61. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 62. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 63. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 64. Java Performance 48 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse
  • 65. Java Performance 49 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Soft Parse Cursor Open library cache lock library cache pin Parse (mode 1 null) (mode 2 share) library cache lock library cache pin Execute (mode 1 null) (mode 2 share) library cache lock library cache pin Fetch (mode 1 null) (mode 2 share) library cache lock Cursor Close (mode 1 null)
  • 66. Java Performance 50 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Hard Parse
  • 67. Java Performance 51 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Hard Parse Session 2 Session 1 Blocking!!!
  • 68. Java Performance 52 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Hard Parse
  • 69. Java Performance 53 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Oracle SQL Execution • Oracle SQL Execution Test – Hard Parse Cursor Open Lock mode conversion library cache lock library cache pin Hard Parse : mode 3 Hard Parse : mode 3 Parse Soft Parse : mode 1 Soft Parse : mode 2 library cache lock library cache pin Execute (mode 1 null) (mode 2 share) library cache lock library cache pin Fetch (mode 1 null) (mode 2 share) library cache lock Cursor Close (mode 1 null)
  • 70. Java Performance 54 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Flow Connection Open Statement Execute ResultSet Fetch ResultSet Close Statement close Connection close
  • 71. Java Performance 55 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test Connection Open Statement select s.sid, s.serial#, p.spid from v Execute $session s, v$process p where s.PROGRAM='EXEM JDBC TEST' and s.paddr = p.addr(+) ResultSet exec sys.dbms_system.set_ev(156,1475, 10046, 12, ''); Fetch ResultSet Close select * from sys.exem$liblock where sid = 156 and name like '%JDBC%'; Statement close Connection close
  • 72. Java Performance 56 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 1
  • 73. Java Performance 57 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 1
  • 74. Java Performance 58 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 1 Connection Open Statement Cursor Open parse execute Fetch library cache lock library cache pin Rs = Execute (mode 1 null) (mode 2 share) library cache lock library cache pin Fetch Fetch (mode 1 null) (mode 2 share) ResultSet Close library cache lock library cache pin (mode 1 null) Statement close Connection close Cursor close library cache lock
  • 75. Java Performance 59 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 2 SQL 1 SQL 2 Connection Open Statement Statement Execute Execute ResultSet ResultSet Fetch Fetch ResultSet Close ResultSet Close Statement close Statement close Connection close
  • 76. Java Performance 60 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 2 SQL 1 Statement SQL 1 Execute SQL 1 Fetch
  • 77. Java Performance 61 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 2 SQL 2 Statement SQL 2 Execute SQL 2 Fetch Connection Closed
  • 78. Java Performance 62 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 2 – Cursor 2 • JDBC ? or Oracle ?
  • 79. Java Performance 62 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 2 – Cursor 2 • JDBC ? or Oracle ?
  • 80. Java Performance 63 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 3 – Connection alter session set session_cached_cursors=0 SQL 2 Statement SQL 2 Execute
  • 81. Java Performance 64 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Java SQL Execution • Java SQL Execution Test 3 – session_cached_cursors • session cache cursor • SQL Parse Call cache • Cache cursor reopen – Library cache Latch & Lock • Softer soft Parse • JDBC Parse Call Cursor Cache
  • 82. Java Performance 65 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Strategy Point – SQL
  • 83. Java Performance 66 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Strategy Point – SQL
  • 84. Java Performance 67 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – • Statement • PreparedStatement Session_cached_cursor = 0 • PreparedStatement Session_cached_cursor = 20 • JDBC Statement caching • PrepareStatement Loop 1 – Test • SQL 10000
  • 85. Java Performance 68 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – Statement
  • 86. Java Performance 69 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement
  • 87. Java Performance 70 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement
  • 88. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement
  • 89. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0
  • 90. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0  Statement Cache = 0
  • 91. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0  Statement Cache = 0  Session Cached Cursor = 20
  • 92. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0  Statement Cache = 0  Session Cached Cursor = 20  Statement Cache = 0
  • 93. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0  Statement Cache = 0  Session Cached Cursor = 20  Statement Cache = 0  Session Cached Cursor = 0
  • 94. Java Performance 71 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement  Session Cached Cursor = 0  Statement Cache = 0  Session Cached Cursor = 20  Statement Cache = 0  Session Cached Cursor = 0  Statement Cache = 20
  • 95. Java Performance 72 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – PreparedStatement Loop
  • 96. Java Performance 73 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance PreparedState Session JDBC Statement Cached Statement Out Loop ment NoCache Cursor Cache Total Elapsed 22.172 17.14 17.14 9.156 9.766 DB Wait_time 12.485 12.299 12.44 6.318 6.873 DB Time 0.855 0.395 0.373 0.23 0.254 App Time 8.832 4.446 4.327 2.608 2.639 parse count 10027 10008 10008 9 9 hard parse 10001 1 0 0 0 parse time 0.624 0.018 0.012 0 0 librarycache latch 271037 100159 60089 30087 30493 library cache lock latch 60415 40047 40048 20038 100 library cache pin latch 90624 40047 20018 10016 20162 RoundTrip 20002 20002 20002 10003 10006 opened cursors 10027 10008 10008 9 9
  • 97. Java Performance 74 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance PreparedState Session JDBC Statement Cached Statement Out Loop ment NoCache Cursor Cache Total Elapsed 22.172 17.14 17.14 9.156 9.766
  • 98. Java Performance 75 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance PreparedState Session JDBC Statement Cached Statement Out Loop ment NoCache Cursor Cache DB Wait_time 12.485 12.299 12.44 6.318 6.873 DB Time 0.855 0.395 0.373 0.23 0.254 App Time 8.832 4.446 4.327 2.608 2.639 RoundTrip 20002 20002 20002 10003 10006
  • 99. Java Performance 76 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance PreparedState Session JDBC Statement Cached Statement Out Loop ment NoCache Cursor Cache librarycache latch 271037 100159 60089 30087 30493 library cache lock latch 60415 40047 40048 20038 100 library cache pin latch 90624 40047 20018 10016 20162 opened cursors 10027 10008 10008 9 9
  • 100. Java Performance 77 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – Statement • Hard Parsing DB overhead • Application – PreparedStatement with NoCache • Parse Round Trip – PreparedStatement with Session Cached Cursor • Parse Round Trip, Open Cursor • Library Cache Latch Lock, Pin Overhead
  • 101. Java Performance 78 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance –1 PreparedStatement and Loop • Parse Library Cache Lock Library Cache Pin •1 Parse Loop • Parse Call Round Trip • Oracle Overhead • SQL SQL
  • 102. Java Performance 79 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Parse Performance – Statement Cache • JDBC 3.0 • JDBC Cursor Open Cache • Soft Parse Round Trip • Library cache Latch, lock, pin Overhead • Connection SQL Cache ( : http://performeister.tistory.com/20 )
  • 103. Java Performance 80 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance – • Update • 1000 Update Batch • One SQL Update – Test • 10000 Update
  • 104. Java Performance 81 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance
  • 105. Java Performance 81 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance  Batch 0 Execute
  • 106. Java Performance 81 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance  Batch 0 Execute  Batch Execute batch
  • 107. Java Performance 82 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance – One Sql Update
  • 108. Java Performance 83 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance Each Batch One Sql Total Elapsed 9.437 1.532 2.25 DB Wait_time 6.51 0.55 0.55 DB Time 0.225 0.154 0.227 App Time 2.702 0.828 1.473 Execute count 10006 18 10 Logical read 40364 30378 46713 Round Trip 10003 13 4
  • 109. Java Performance 84 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance Each Batch One Sql DB Wait_time 6.51 0.55 0.55 DB Time 0.225 0.154 0.227 App Time 2.702 0.828 1.473 Round Trip 10003 13 4
  • 110. Java Performance 85 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance Each Batch One Sql Execute count 10006 18 10 Logical read 40364 30378 46713 Round Trip 10003 13 4
  • 111. Java Performance 86 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance – One SQL • Update Batch • Storage IO • DML One SQL
  • 112. Java Performance 87 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Execute Performance – Update Batch • JDBC 3.0 • Loop batch size Binding • Execute Count Round Trip • Array Processing ( : http://performeister.tistory.com/19 )
  • 113. Java Performance 88 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Fetch Performance – • Fetch • Prefetch Fetch (fetch size = 100) – Test • 100,000 Query
  • 114. Java Performance 89 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Fetch Performance
  • 115. Java Performance 89 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Fetch Performance  Fetch Size Prefetch
  • 116. Java Performance 90 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Fetch Performance Normal Prefetch Total Elapsed 8.25 1.672 DB Wait_time 6.924 1.29 DB Time 0.11 0.046 App Time 1.216 0.336 Execute count 7 7 Logical read 30808 13794 Round Trip 10004 1004 Client Network (MB) 4.132952 3.795275 Server Network (KB) 68.81348 7.291992
  • 117. Java Performance 91 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com JDBC Performance • Fetch Performance – Fetch • Query • Fetch Size • Default Fetch Size 10 – Prefetch • JDBC 2.0 • Fetch Size Round Trip • Network ( : http://performeister.tistory.com/12 )
  • 118. Java Performance 92 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com