SlideShare a Scribd company logo
1 of 26
Download to read offline
Developing High Performance
    Database Applications with
    pureQuery and IBM Data
    Studio
    Dr. Vladimir Bacvanski, SciSpike
    vladimir.bacvanski@scispike.com




0                                      1801
Show of Hands: What Data Access
    Technology Have You Used?

                                              Hibernate
            EJB Entity
              Beans
                                                          JDBC


                                                 iBatis/MyBatis
                  JPA

                                       SQLJ

                                                EJB: Enterprise Java Beans
    •  What’s most important to you?            JPA: Java Persistence API
       o  Productivity
       o  Performance
       o  Security
       o  Portability
1
                                                                  1801
Java Data Access – Two Views of the World
Writing Java code is so                  JSP
easy with this eclipse                        Spring         QoS goals Runstats               Another runaway
environment.                          XML         http                                        query! Where are
I wish it was that easy to                                  Partition Stored                  these coming from?
                                  mashup                    strategy Procedures               JDBC? Hmmm…
get the SQL right.                             SQL
                                               JSON         Response REORG
                                       JDBC                    Time!

This ORM doesn’t
allow me to leverage
all my database’s                                                                             Inconsistent response
SQL.                                                                                          time? How long will it
                                                                                              take me to find the
                               JDBC                                                           offending application
                                                                                              sending bad SQL this
                                                                                              time?
I can’t believe I got called
out last week.
I wish I could see how
these queries will run in                                                              SQLJ
production.                    JPA

                                                                                              These ad-hoc queries
                                                                                              are dangerous. We
                                        Application      Database Developer                   need a library of tested
Why does this query              Spring Developer          & Administrator                    SQL interfaces.
take so long?
                                      MyBatis, . . .


Static SQL? Sounds like          Sometimes I need           Another GRANT                     Can I examine the
another delay to getting         POJOs, sometime JSON,      request? This security            SQL “before” the
my program deployed              sometimes XML, what        administration is out of          application is
                                 should I use?              control.                          deployed?



                                                                                                     1801
Data Mapping Approaches
    •  Application-Centric
        o    Top-Down
                                                                      Top
        o    Object Domain Model                                     Down
        o    Object Relational Mapping
        o    Well supported in dynamic
             languages and frameworks


    •  Hybrid
                                                                   Meet in the
        o  Meet in the middle                  Persistence Layer
                                                                    Middle
        o  Can be challenging w/o comprising

    •  Data-Centric
        o  Bottom-UP
        o  Start with Relational Data Model
                                                                    Bottom
        o  Not well supported in dynamic                              Up
           languages and frameworks


3
                                                                    1801
JPA, Hibernate, EJB vs. The Database

!  DBA and SQL developer chasm
   Where is the SQL coming from?
   What is it?
   Where is it?
   How do we tune it?
   How de we manage it?
!  Performance Concerns:
   Some vendors claim (unsurprisingly) that
    Managed objects performs fine.
   There are many user claims of bad
    Managed object performance is bad on
    the web.
!  As always, the truth is in the middle.
   And will depend on your app server,
    application, database, etc ..


                                                      4
                                               1801
Introducing pureQuery

    A high-performance, data access platform to simplify
    developing, managing, securing, and optimizing data
    access.


pureQuery Components:
•  Simple and intuitive API
   o  Enables SQL access to databases or in-memory Java objects
   o  Facilitates best practices
•  IBM Data Studio (integrates with Rational Application Developer /
   Rational Software Architect)
   o  Integrated development environment with Java and SQL support
   o  Improve problem isolation and impact analysis
•  Optim pureQuery Runtime
   o  Flexible static SQL deployment for DB2

                                                                  1801
pureQuery Balances Productivity and Control


     Full SQL control         Object-relational mapping           Managed objects

       Code all your SQL


 JDBC / SQLJ
               Use SQL templates, inline only
    Spring
  templates

  MyBATIS
               Add basic OR mapping and annotated-method style
 pureQuery
                              Complex OR mapping and persistence management, but loss of controls
  Hibernate
                                                 Adds container management option
 OpenJPA


                                                                                 1801
Design Phase pureQuery close-up

                                                                      Jump Start Application Design
                                                                      •  Generate SQL and Code from Database Objects
                                                                      •  Setup basic DAO Pattern

    Existing JDBC to Static
    •  Reroute Dynamic Queries to Static                                          Code Development Productivity
                                                                                  •  Code Generation, Content Assist
                                                                                  •  Database aware, Java SQL Editor
SQL Replacement
•  Replace Query w/o changing source

                                                                                         SQL Performance
                                                                                          Metrics
                                                                                         •  Find and sort query elapsed time
Oracle Support                                                                              from Java
•  Replace Query w/o changing
   source
                                                                                      Java to SQL Integration
                                                                                      •  Categorize by Java, SQL, Database ,
                                                                                         Packages, track back to line of code
    Problem Determination
    •  Monitor WebSphere Connection
       Pool, JDBC Driver, Network                                             Static SQL
    •  Track back to SQL and line of                                          •  Lock in Access plans, Improve Security,
       code in the application                                                   Consistent Performance


                                       SQL Injection Prevention
                                       •  Lock down SQL for Dynamic

                                                                                                            1801
Code Example: JDBC
Tabl   Column      Type          class%Employee%{%
                                 %%%%public%String%name;%
e                                %%%%public%String%homeAddress;%
EMP    NAME        CHAR(64)      %%%%public%String%homePhone;%
EMP    ADDRESS     CHAR(128)
                                 %%%%…%
                                 }%
EMP    PHONE_NUM   CHAR(10)

                        java.sql.PreparedStatement%ps%=%
                        con.prepareStatement(%
                        %%%%%%%%"SELECT%NAME,%ADDRESS,%
                        %%%%%%%%%PHONE_NUM%FROM%EMP%%
                        %%%%%%%%%WHERE%NAME=?");%
                        ps.setString(1,%name);%
                        java.sql.ResultSet%rs=%ps.executeQuery();%
                        names.next();%
                        Employee%myEmp%=%new%Employee();%
                        myEmp%.setName(rs.getString(1));%
                        myEmp%.setHomeAddress(rs.getString(2));%
                        myEmp%.setHomePhone(rs.getString(3));%
                        names.close();%

                                                                   1801
Code Example: pureQuery

       Employee%myEmp%=%db.queryFirst(%
       %%%%%"SELECT%NAME,%ADDRESS,%PHONE_NUM%FROM%EMP%
       %%%%%%WHERE%NAME=?",%Employee.class,%name);%
       %


       Even simpler, if we have a method getEmployee with a Java
       annotation or XML file with SQL for the query:


       Employee%myEmp%=%getEmployee(name);%




9
                                                                   1801
IBM Optim pureQuery
                                                                                   Developer
•  Reduce costs
     o  Increase system throughput
                                                             Design
     o  Improve developer productivity
                                                                                 Develop
     o  Move workload to zIIP and zAAP                                            Code
                                                                                  Debug
•  Improve quality of service                Optimize                        Develop
                                                                                   Test
   for new and existing Java applications                                     Tune, Package
                                                              Models
     o  Improve performance                                  Policies
                                                             Metadata
     o  Lock in access plans
     o  Speed up problem resolution
                                                   Operate              Deploy          Tester
•  Reduce development time for new Java
   applications
     o  Bridge Java and data
     o  Balance productivity and control
     o  Enhance developer and DBA collaboration
•  Enhance security
     o  Limit user access
     o  Minimize SQL injection risk
     o  Improve audit readiness

                                                                                 1801
Why should DBAs care ?
•  DBAs have little to no visibility of application SQL before deployment,
   no opportunity for review and optimization


•  Problem isolation takes days with contemporary environments such
   as Java, PHP, .NET, etc. due to inability to trace SQL to Java
   application and source code


•  Constantly increasing Java application workload taxes existing
   systems – need to fit more work into existing systems


•  SQL injection represents an increasing risk to data security




                                                                    1801
Why should Developers care ?

•  Get data access right the first time!


•  Get it done faster - Improved productivity


•  Single environment that spans Java application and database
   development


•  Improved problem isolation and resolution




                                                                 1801
How well does it work? – Java applications
     •  In-house testing shows significant performance improvements
         Normalized Throughput by API for JDBC Type 4 Driver                                                                     % increase/reduction in CPU per transaction compared
                                                                                                                                              to JDBC using Type 4 driver

                                         500




                                                                                                                                 % increase/reduction in CPU per
                                         400
                                                                                                                                                                                                                            25%
           Normalized Throughput (ITR)




                                                                                                                                    transn compared to JDBC
                                                                                                                                                                                                                15%
                                         300
                                                                                                                           524                                                                     6%
                                                                                                            485
                                                                                           446
                                                                              420
                                         200                     360
                                                     274
                                                                                                                                                                                    -14%
                                         100

                                                                                                                                                                            -35%
                                          0                                                                                                                        -50%




                                                                                                                                                                            B2




                                                                                                                                                                                                           ic



                                                                                                                                                                                                                          ic
                                                                                                                                                                                              ic
                                                2




                                                                         C




                                                                                                                                                                                     A
                                                             A




                                                                                                                          ic
                                                                                         ic



                                                                                                         ic




                                                                                                                                                                                                            t
                                                                          B




                                                                                                                                                                                   JP




                                                                                                                                                                                                                      ta t
                                                 B




                                                                                                                                                                                           am
                                                           JP




                                                                                                                                                                                                         Sta
                                                                                                                      ta t
                                                                                      am



                                                                                                       at




                                                                                                                                                                          EJ
                                                                       JD
                                               EJ




                                                                                                                                                                                                                     dS
                                                                                                    St




                                                                                                                                                                                         yn
                                                                                                                  dS
                                                                                    yn




                                                                                                                                                                                                      t.
                                                                                                  iz n




                                                                                                                                                                                         dD



                                                                                                                                                                                                   Op



                                                                                                                                                                                                                   tho
                                                                               dD




                                                                                                                tho
                                                                                                im




                                                                                                                                                                                       tho




                                                                                                                                                                                                                 Me
                                                                                                                                                                                                     t
                                                                            tho




                                                                                                              Me




                                                                                                                                                                                                  en
                                                                                             t
                                                                                          Op




                                                                                                                                                                                     Me
                                                                          Me




                                                                                                                                                                                               Cli



                                                                                                                                                                                                                pQ
                                                                                                          pQ
                                                                                            t
                                                                                        ien




                                                                                                                                                                                    pQ
                                                                        pQ



                                                                                      Cl




     •  IRWW – an OLTP workload, Type 4 driver
     •  Cache hit ratio between 70 and 85%
     •  23 % improvement in throughput using pureQuery over dynamic JDBC
     •  15% - 25% reduction on CPU per transaction over dynamic JDBC


13
                                                                                                                                                                                                                     1801
How well does it work? - .Net applications

                                                                                                       !  IRWW – OLTP application
                                                                                                       !  Application accesses DB2 for z/OS




      •  Throughput during static execution increased by 159% over dynamic SQL
         execution assuming a 79% statement cache hit ratio
*Any performance data contained in this document were determined in various controlled laboratory environments and are for reference purposes only. Customers should not adapt these
performance numbers to their own environments as system performance standards. The results that may be obtained in other operating environments may vary significantly. Users of this
document should verify the applicable data for their specific environment.


 14
                                                                                                                                                                  1801
Optim pureQuery Runtime
     •  Control performance
         o  Decide at deployment time how the SQL is executed
         o  Understand and lock down the access plan for SQL
         o  Replace suboptimal SQL without changing the application


     •  Control security
         o  Prevent SQL injection
         o  Prevent execution of unauthorized SQL
         o  Better manage database security


     •  See inside applications that are driving your database
         o  Understand where SQL comes from
         o  Understand when frameworks and ORM’s are getting in the way


     •  Simplify problem determination and troubleshooting
         o  Correlate problem SQL with applications, ORM’s and frameworks


15
                                                                            1801
How do I start with pureQuery?
     •  Existing applications
         o  Optimize existing JDBC (and .NET) applications
         o  No code changes needed
         o  Have to go through the client optimization process to get to static
            SQL
     •  New applications
         o  Use the pureQuery API
         o  Development codes using one API regardless of whether it is
            deployed dynamically or statically
         o  DBA deploys statically
         o  No need to go through client optimization process
     •  Other
         o  JPA, MyBatis, Hibernate


16
                                                                         1801
pureQuery Facilitates Best Practices
     •  Supports both inline SQL and Java annotations (method)
     •  Intuitive interfaces for common data retrieval and manipulation
        scenarios hides JDBC complexity
         o  Query First
         o  Homogeneous Batch
     •  Reduce network trips to the database
         o  Query Over Java Collections
         o  Heterogeneous Batch
     •  Use custom result handlers to map results to POJO’s, XML, JSON, …




17
                                                                          1801
Data Studio SQL Capture
     !  Capture
       –  Determine SQL coming from application         Capture
     !  Review
       –  Review SQL to identify issues
       –  Optimize                                       Review     Optimize      Restrict
          •    Replace SQL with enhanced to SQL
       –  Restrict
         •     SQL approved list

     !  Configure
       –  Flag SQL to be in a package and configure
          driver properties                             Configure        Bind
       –  Bind
         •     Create packages according to configure

     !  Execute
       –  Switch to run with new configuration
                                                        Execute




18
                                                                                1801
A Typical Application Architecture with
     pureQuery


        Implements the U/I or       Presentation Layer
        network protocols using
         the business services
                                  Business Service Layer
       Never use the pureQuery
        API directly. Gets data
        from the Data Access
                Layer               Data Access Layer


                                       pureQuery            pureQuery makes this
         Using the pure-query
                                                               layer easy, fast,
           API to access the
                                                           consistent and traceable
               database.
         Provides a technology          Database
        neutral API to the data
         used by the business
                services



19
                                                                          1801
RAD or RSA / IBM Data Studio
Data Centric Development Scenario



           Write in Java                       Write in Java with pureQuery
      Using RAD/RSA/Eclipse                      Using Data Studio in RAD




   Presentation         Application           Objects                   Tables

 •  JSF2, Ajax …     •  Business Logic   •  Access to data        •  Data


                                                             Access generated
                                                             Java data objects
                                                             from code developed
                                                             in RAD


                                                                            1801
21   1801
How to get pureQuery?

•  Bundled Offerings
    o  Part of DB2 LUW Advanced Enterprise Server Edition 10.1 and higher
        •  Can be deployed on any number of applications connecting to that DB2
          server
    o  In DB2 Connect Application Server Advanced Edition
    o  Comes with DB2 Connect Unlimited Advanced Edition for System z


•  Stand-alone Offerings
    o  InfoSphere Optim pureQuery Runtime for LUW
    o  InfoSphere Optim pureQuery Runtime for z/OS




                                                                            1801
Conclusion: pureQuery Advantages
     •  Excellent performance
         o  Static and dynamic SQL is captured during test and optimized
            before deployment
         o  Enables lock-in of access path
     •  Great productivity
         o  Excellent tool support through IBM Data Studio
             •  Shell share with Rational tools
         o  Mapping from SQL to Java captured and traceable
         o  Facilitates collaboration between DBA’s and developers
             •  Performance tuning, impact analysis
     •  Better security
         o  Limits SQL injection
         o  Controlled database access

23
                                                                     1801
Questions?




24                1801
Getting in Touch

•  Dr. Vladimir Bacvanski
   o  Email: vladimir.bacvanski@scispike.com
   o  Blog: http://www.OnBuildingSoftware.com/
   o  Twitter: http://twitter.com/OnSoftware
   o  LinkedIn: http://www.linkedin.com/in/VladimirBacvanski




                                                               1801

More Related Content

What's hot

JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...
JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...
JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...Danival Calegari
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05Ankit Dubey
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architectureSuman Behara
 
Brian Oliver Pimp My Data Grid
Brian Oliver  Pimp My Data GridBrian Oliver  Pimp My Data Grid
Brian Oliver Pimp My Data Griddeimos
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EECalance
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperJeff Smith
 
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
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guidePankaj Singh
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)Fred Rowe
 
Dave Carroll Application Services Salesforce
Dave Carroll Application Services SalesforceDave Carroll Application Services Salesforce
Dave Carroll Application Services Salesforcedeimos
 
Resume joseph gregory java
Resume   joseph gregory javaResume   joseph gregory java
Resume joseph gregory javaJoseph Gregory
 
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
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityPaul Withers
 
Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patternsdeimos
 
Three key concepts for java batch
Three key concepts for java batchThree key concepts for java batch
Three key concepts for java batchtimfanelli
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 DemystifiedAnkara JUG
 
Complete java syllabus 7448062045 Yesdo Sddd
Complete java syllabus 7448062045 Yesdo SdddComplete java syllabus 7448062045 Yesdo Sddd
Complete java syllabus 7448062045 Yesdo SdddYesdo Softindia Pvt Ltd
 

What's hot (20)

JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...
JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...
JavaOne 2012 - BOF7955 ­ Avoiding Java EE Application Design Traps to Achieve...
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05
 
J2EE and layered architecture
J2EE and layered architectureJ2EE and layered architecture
J2EE and layered architecture
 
Brian Oliver Pimp My Data Grid
Brian Oliver  Pimp My Data GridBrian Oliver  Pimp My Data Grid
Brian Oliver Pimp My Data Grid
 
Building Enterprise Application with J2EE
Building Enterprise Application with J2EEBuilding Enterprise Application with J2EE
Building Enterprise Application with J2EE
 
Ronald van Luttikhuizen - Effective fault handling in SOA Suite and OSB 11g
Ronald van Luttikhuizen - Effective fault handling in SOA Suite and OSB 11gRonald van Luttikhuizen - Effective fault handling in SOA Suite and OSB 11g
Ronald van Luttikhuizen - Effective fault handling in SOA Suite and OSB 11g
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL Developer
 
JDBC
JDBC JDBC
JDBC
 
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
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
 
Rajesh jdbc
Rajesh   jdbcRajesh   jdbc
Rajesh jdbc
 
Dave Carroll Application Services Salesforce
Dave Carroll Application Services SalesforceDave Carroll Application Services Salesforce
Dave Carroll Application Services Salesforce
 
Resume joseph gregory java
Resume   joseph gregory javaResume   joseph gregory java
Resume joseph gregory java
 
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
 
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and ScalabilityIBM ConnectED 2015 - MAS103 XPages Performance and Scalability
IBM ConnectED 2015 - MAS103 XPages Performance and Scalability
 
Ari Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture PatternsAri Zilka Cluster Architecture Patterns
Ari Zilka Cluster Architecture Patterns
 
Three key concepts for java batch
Three key concepts for java batchThree key concepts for java batch
Three key concepts for java batch
 
Java EE7 Demystified
Java EE7 DemystifiedJava EE7 Demystified
Java EE7 Demystified
 
Complete java syllabus 7448062045 Yesdo Sddd
Complete java syllabus 7448062045 Yesdo SdddComplete java syllabus 7448062045 Yesdo Sddd
Complete java syllabus 7448062045 Yesdo Sddd
 

Viewers also liked

DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stabilitydmcmichael
 
Win Friends and Influence People... with DSLs
Win Friends and Influence People... with DSLsWin Friends and Influence People... with DSLs
Win Friends and Influence People... with DSLsVladimir Bacvanski, PhD
 
Introduction to Hadoop at Data-360 Conference
Introduction to Hadoop at Data-360 ConferenceIntroduction to Hadoop at Data-360 Conference
Introduction to Hadoop at Data-360 ConferenceAvkash Chauhan
 
Introduction to Apache Pig
Introduction to Apache PigIntroduction to Apache Pig
Introduction to Apache PigAvkash Chauhan
 

Viewers also liked (6)

DB2 LUW Access Plan Stability
DB2 LUW Access Plan StabilityDB2 LUW Access Plan Stability
DB2 LUW Access Plan Stability
 
Win Friends and Influence People... with DSLs
Win Friends and Influence People... with DSLsWin Friends and Influence People... with DSLs
Win Friends and Influence People... with DSLs
 
Introduction to pig
Introduction to pigIntroduction to pig
Introduction to pig
 
Introduction to Hadoop at Data-360 Conference
Introduction to Hadoop at Data-360 ConferenceIntroduction to Hadoop at Data-360 Conference
Introduction to Hadoop at Data-360 Conference
 
UML for Data Architects
UML for Data ArchitectsUML for Data Architects
UML for Data Architects
 
Introduction to Apache Pig
Introduction to Apache PigIntroduction to Apache Pig
Introduction to Apache Pig
 

Similar to High performance database applications with pure query and ibm data studio.bacvanski

SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisWill Iverson
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3Oracle
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-finalRohit Kelapure
 
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
 
DAT101 Understanding AWS Database Options - AWS re: Invent 2012
DAT101 Understanding AWS Database Options - AWS re: Invent 2012DAT101 Understanding AWS Database Options - AWS re: Invent 2012
DAT101 Understanding AWS Database Options - AWS re: Invent 2012Amazon Web Services
 
What is persistence in java
What is persistence in javaWhat is persistence in java
What is persistence in javaBenjamin Kim
 
Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)blahap
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote presoArtur Alves
 
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"Anna Shymchenko
 
My sql 5.6_replwebinar_may12
My sql 5.6_replwebinar_may12My sql 5.6_replwebinar_may12
My sql 5.6_replwebinar_may12Mat Keep
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationIMC Institute
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Serveracsvianabr
 
Performance Engineering Case Study V1.0
Performance Engineering Case Study    V1.0Performance Engineering Case Study    V1.0
Performance Engineering Case Study V1.0sambitgarnaik
 
Nine Neins - where Java EE will never take you
Nine Neins - where Java EE will never take youNine Neins - where Java EE will never take you
Nine Neins - where Java EE will never take youMarkus Eisele
 

Similar to High performance database applications with pure query and ibm data studio.bacvanski (20)

Db trends final
Db trends   finalDb trends   final
Db trends final
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
 
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
2012 04-06-v2-tdp-1163-java e-evsspringshootout-final
 
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
 
DAT101 Understanding AWS Database Options - AWS re: Invent 2012
DAT101 Understanding AWS Database Options - AWS re: Invent 2012DAT101 Understanding AWS Database Options - AWS re: Invent 2012
DAT101 Understanding AWS Database Options - AWS re: Invent 2012
 
What is persistence in java
What is persistence in javaWhat is persistence in java
What is persistence in java
 
Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)Intro in JavaEE world (TU Olomouc)
Intro in JavaEE world (TU Olomouc)
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote preso
 
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"
Евгений Варфоломеев "Hibernate vs my batis vs jdbc: is there a silver bullet?"
 
My sql 5.6_replwebinar_may12
My sql 5.6_replwebinar_may12My sql 5.6_replwebinar_may12
My sql 5.6_replwebinar_may12
 
Java J2EE Training in Chennai, Tambaram
Java J2EE  Training in Chennai, TambaramJava J2EE  Training in Chennai, Tambaram
Java J2EE Training in Chennai, Tambaram
 
Confio presentation
Confio presentationConfio presentation
Confio presentation
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Java Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web ApplicationJava Web Programming [1/9] : Introduction to Web Application
Java Web Programming [1/9] : Introduction to Web Application
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Server
 
Virtual classroom
Virtual classroomVirtual classroom
Virtual classroom
 
Performance Engineering Case Study V1.0
Performance Engineering Case Study    V1.0Performance Engineering Case Study    V1.0
Performance Engineering Case Study V1.0
 
Nine Neins - where Java EE will never take you
Nine Neins - where Java EE will never take youNine Neins - where Java EE will never take you
Nine Neins - where Java EE will never take you
 
Sql no sql
Sql no sqlSql no sql
Sql no sql
 

High performance database applications with pure query and ibm data studio.bacvanski

  • 1. Developing High Performance Database Applications with pureQuery and IBM Data Studio Dr. Vladimir Bacvanski, SciSpike vladimir.bacvanski@scispike.com 0 1801
  • 2. Show of Hands: What Data Access Technology Have You Used? Hibernate EJB Entity Beans JDBC iBatis/MyBatis JPA SQLJ EJB: Enterprise Java Beans •  What’s most important to you? JPA: Java Persistence API o  Productivity o  Performance o  Security o  Portability 1 1801
  • 3. Java Data Access – Two Views of the World Writing Java code is so JSP easy with this eclipse Spring QoS goals Runstats Another runaway environment. XML http query! Where are I wish it was that easy to Partition Stored these coming from? mashup strategy Procedures JDBC? Hmmm… get the SQL right. SQL JSON Response REORG JDBC Time! This ORM doesn’t allow me to leverage all my database’s Inconsistent response SQL. time? How long will it take me to find the JDBC offending application sending bad SQL this time? I can’t believe I got called out last week. I wish I could see how these queries will run in SQLJ production. JPA These ad-hoc queries are dangerous. We Application Database Developer need a library of tested Why does this query Spring Developer & Administrator SQL interfaces. take so long? MyBatis, . . . Static SQL? Sounds like Sometimes I need Another GRANT Can I examine the another delay to getting POJOs, sometime JSON, request? This security SQL “before” the my program deployed sometimes XML, what administration is out of application is should I use? control. deployed? 1801
  • 4. Data Mapping Approaches •  Application-Centric o  Top-Down Top o  Object Domain Model Down o  Object Relational Mapping o  Well supported in dynamic languages and frameworks •  Hybrid Meet in the o  Meet in the middle Persistence Layer Middle o  Can be challenging w/o comprising •  Data-Centric o  Bottom-UP o  Start with Relational Data Model Bottom o  Not well supported in dynamic Up languages and frameworks 3 1801
  • 5. JPA, Hibernate, EJB vs. The Database !  DBA and SQL developer chasm  Where is the SQL coming from?  What is it?  Where is it?  How do we tune it?  How de we manage it? !  Performance Concerns:  Some vendors claim (unsurprisingly) that Managed objects performs fine.  There are many user claims of bad Managed object performance is bad on the web. !  As always, the truth is in the middle.  And will depend on your app server, application, database, etc .. 4 1801
  • 6. Introducing pureQuery A high-performance, data access platform to simplify developing, managing, securing, and optimizing data access. pureQuery Components: •  Simple and intuitive API o  Enables SQL access to databases or in-memory Java objects o  Facilitates best practices •  IBM Data Studio (integrates with Rational Application Developer / Rational Software Architect) o  Integrated development environment with Java and SQL support o  Improve problem isolation and impact analysis •  Optim pureQuery Runtime o  Flexible static SQL deployment for DB2 1801
  • 7. pureQuery Balances Productivity and Control Full SQL control Object-relational mapping Managed objects Code all your SQL JDBC / SQLJ Use SQL templates, inline only Spring templates MyBATIS Add basic OR mapping and annotated-method style pureQuery Complex OR mapping and persistence management, but loss of controls Hibernate Adds container management option OpenJPA 1801
  • 8. Design Phase pureQuery close-up Jump Start Application Design •  Generate SQL and Code from Database Objects •  Setup basic DAO Pattern Existing JDBC to Static •  Reroute Dynamic Queries to Static Code Development Productivity •  Code Generation, Content Assist •  Database aware, Java SQL Editor SQL Replacement •  Replace Query w/o changing source SQL Performance Metrics •  Find and sort query elapsed time Oracle Support from Java •  Replace Query w/o changing source Java to SQL Integration •  Categorize by Java, SQL, Database , Packages, track back to line of code Problem Determination •  Monitor WebSphere Connection Pool, JDBC Driver, Network Static SQL •  Track back to SQL and line of •  Lock in Access plans, Improve Security, code in the application Consistent Performance SQL Injection Prevention •  Lock down SQL for Dynamic 1801
  • 9. Code Example: JDBC Tabl Column Type class%Employee%{% %%%%public%String%name;% e %%%%public%String%homeAddress;% EMP NAME CHAR(64) %%%%public%String%homePhone;% EMP ADDRESS CHAR(128) %%%%…% }% EMP PHONE_NUM CHAR(10) java.sql.PreparedStatement%ps%=% con.prepareStatement(% %%%%%%%%"SELECT%NAME,%ADDRESS,% %%%%%%%%%PHONE_NUM%FROM%EMP%% %%%%%%%%%WHERE%NAME=?");% ps.setString(1,%name);% java.sql.ResultSet%rs=%ps.executeQuery();% names.next();% Employee%myEmp%=%new%Employee();% myEmp%.setName(rs.getString(1));% myEmp%.setHomeAddress(rs.getString(2));% myEmp%.setHomePhone(rs.getString(3));% names.close();% 1801
  • 10. Code Example: pureQuery Employee%myEmp%=%db.queryFirst(% %%%%%"SELECT%NAME,%ADDRESS,%PHONE_NUM%FROM%EMP% %%%%%%WHERE%NAME=?",%Employee.class,%name);% % Even simpler, if we have a method getEmployee with a Java annotation or XML file with SQL for the query: Employee%myEmp%=%getEmployee(name);% 9 1801
  • 11. IBM Optim pureQuery Developer •  Reduce costs o  Increase system throughput Design o  Improve developer productivity Develop o  Move workload to zIIP and zAAP Code Debug •  Improve quality of service Optimize Develop Test for new and existing Java applications Tune, Package Models o  Improve performance Policies Metadata o  Lock in access plans o  Speed up problem resolution Operate Deploy Tester •  Reduce development time for new Java applications o  Bridge Java and data o  Balance productivity and control o  Enhance developer and DBA collaboration •  Enhance security o  Limit user access o  Minimize SQL injection risk o  Improve audit readiness 1801
  • 12. Why should DBAs care ? •  DBAs have little to no visibility of application SQL before deployment, no opportunity for review and optimization •  Problem isolation takes days with contemporary environments such as Java, PHP, .NET, etc. due to inability to trace SQL to Java application and source code •  Constantly increasing Java application workload taxes existing systems – need to fit more work into existing systems •  SQL injection represents an increasing risk to data security 1801
  • 13. Why should Developers care ? •  Get data access right the first time! •  Get it done faster - Improved productivity •  Single environment that spans Java application and database development •  Improved problem isolation and resolution 1801
  • 14. How well does it work? – Java applications •  In-house testing shows significant performance improvements Normalized Throughput by API for JDBC Type 4 Driver % increase/reduction in CPU per transaction compared to JDBC using Type 4 driver 500 % increase/reduction in CPU per 400 25% Normalized Throughput (ITR) transn compared to JDBC 15% 300 524 6% 485 446 420 200 360 274 -14% 100 -35% 0 -50% B2 ic ic ic 2 C A A ic ic ic t B JP ta t B am JP Sta ta t am at EJ JD EJ dS St yn dS yn t. iz n dD Op tho dD tho im tho Me t tho Me en t Op Me Me Cli pQ pQ t ien pQ pQ Cl •  IRWW – an OLTP workload, Type 4 driver •  Cache hit ratio between 70 and 85% •  23 % improvement in throughput using pureQuery over dynamic JDBC •  15% - 25% reduction on CPU per transaction over dynamic JDBC 13 1801
  • 15. How well does it work? - .Net applications !  IRWW – OLTP application !  Application accesses DB2 for z/OS •  Throughput during static execution increased by 159% over dynamic SQL execution assuming a 79% statement cache hit ratio *Any performance data contained in this document were determined in various controlled laboratory environments and are for reference purposes only. Customers should not adapt these performance numbers to their own environments as system performance standards. The results that may be obtained in other operating environments may vary significantly. Users of this document should verify the applicable data for their specific environment. 14 1801
  • 16. Optim pureQuery Runtime •  Control performance o  Decide at deployment time how the SQL is executed o  Understand and lock down the access plan for SQL o  Replace suboptimal SQL without changing the application •  Control security o  Prevent SQL injection o  Prevent execution of unauthorized SQL o  Better manage database security •  See inside applications that are driving your database o  Understand where SQL comes from o  Understand when frameworks and ORM’s are getting in the way •  Simplify problem determination and troubleshooting o  Correlate problem SQL with applications, ORM’s and frameworks 15 1801
  • 17. How do I start with pureQuery? •  Existing applications o  Optimize existing JDBC (and .NET) applications o  No code changes needed o  Have to go through the client optimization process to get to static SQL •  New applications o  Use the pureQuery API o  Development codes using one API regardless of whether it is deployed dynamically or statically o  DBA deploys statically o  No need to go through client optimization process •  Other o  JPA, MyBatis, Hibernate 16 1801
  • 18. pureQuery Facilitates Best Practices •  Supports both inline SQL and Java annotations (method) •  Intuitive interfaces for common data retrieval and manipulation scenarios hides JDBC complexity o  Query First o  Homogeneous Batch •  Reduce network trips to the database o  Query Over Java Collections o  Heterogeneous Batch •  Use custom result handlers to map results to POJO’s, XML, JSON, … 17 1801
  • 19. Data Studio SQL Capture !  Capture –  Determine SQL coming from application Capture !  Review –  Review SQL to identify issues –  Optimize Review Optimize Restrict •  Replace SQL with enhanced to SQL –  Restrict •  SQL approved list !  Configure –  Flag SQL to be in a package and configure driver properties Configure Bind –  Bind •  Create packages according to configure !  Execute –  Switch to run with new configuration Execute 18 1801
  • 20. A Typical Application Architecture with pureQuery Implements the U/I or Presentation Layer network protocols using the business services Business Service Layer Never use the pureQuery API directly. Gets data from the Data Access Layer Data Access Layer pureQuery pureQuery makes this Using the pure-query layer easy, fast, API to access the consistent and traceable database. Provides a technology Database neutral API to the data used by the business services 19 1801
  • 21. RAD or RSA / IBM Data Studio Data Centric Development Scenario Write in Java Write in Java with pureQuery Using RAD/RSA/Eclipse Using Data Studio in RAD Presentation Application Objects Tables •  JSF2, Ajax … •  Business Logic •  Access to data •  Data Access generated Java data objects from code developed in RAD 1801
  • 22. 21 1801
  • 23. How to get pureQuery? •  Bundled Offerings o  Part of DB2 LUW Advanced Enterprise Server Edition 10.1 and higher •  Can be deployed on any number of applications connecting to that DB2 server o  In DB2 Connect Application Server Advanced Edition o  Comes with DB2 Connect Unlimited Advanced Edition for System z •  Stand-alone Offerings o  InfoSphere Optim pureQuery Runtime for LUW o  InfoSphere Optim pureQuery Runtime for z/OS 1801
  • 24. Conclusion: pureQuery Advantages •  Excellent performance o  Static and dynamic SQL is captured during test and optimized before deployment o  Enables lock-in of access path •  Great productivity o  Excellent tool support through IBM Data Studio •  Shell share with Rational tools o  Mapping from SQL to Java captured and traceable o  Facilitates collaboration between DBA’s and developers •  Performance tuning, impact analysis •  Better security o  Limits SQL injection o  Controlled database access 23 1801
  • 26. Getting in Touch •  Dr. Vladimir Bacvanski o  Email: vladimir.bacvanski@scispike.com o  Blog: http://www.OnBuildingSoftware.com/ o  Twitter: http://twitter.com/OnSoftware o  LinkedIn: http://www.linkedin.com/in/VladimirBacvanski 1801