Designing JDBC applications for performance optimization
- Last Updated: June 17, 2019
- 1 minute read
- DataDirect Connectors
- JDBC
- Aha! 6.0
- Amazon Redshift 6.0
- Apache Cassandra 6.0
- Apache Hive 6.0
- Apache Spark SQL 6.0
- Atlassian Jira 6.0
- Autonomous REST Connector 6.0
- Cloudera Impala 5.1
- + 24
Developing performance-oriented JDBC applications is not easy. JDBC drivers do not throw exceptions to tell you when your code is running too slow. This section presents some general guidelines for improving JDBC application performance that have been compiled by examining the JDBC implementations of numerous shipping JDBC applications. These guidelines include:
- Use DatabaseMetaData methods appropriately
- Return only required data
- Select functions that optimize performance
- Manage connections and updates
Following these general guidelines can help you solve some common JDBC system performance problems, such as those listed in the following table.
| Problem | Solution | See guidelines in… |
|---|---|---|
| Network communication is slow. | Reduce network traffic. | Using database metadata methods |
| Evaluation of complex SQL queries on the database server is slow and can reduce concurrency. | Simplify queries. | Using database metadata methods |
| Excessive calls from the application to the driver slow performance. | Optimize application-to-driver interaction. | Returning data |
| Disk I/O is slow. | Limit disk I/O. | Managing connections and updates |
In addition, most JDBC drivers provide options that improve performance,
often with a trade-off in functionality. If your application is not affected by functionality
that is modified by setting a particular option, significant performance improvements can be
realized.
Note: The section describes functionality across a spectrum of data
stores. In some cases, the functionality described may not apply to the driver or data store
you are using. In addition, examples are drawn from a variety of drivers and data
stores.