The Network
The network, which is a component of the database middleware, has many factors that affect performance: database protocol packets, network packets, network hops, network contention, and packet fragmentation. See “Network,” in Chapter 4 (page 86) for details on how to understand the performance implications of the network and guidelines for dealing with them.
In this section, let’s look at one important fact about performance and the network: database application performance improves when communication between the database driver and the database is optimized.
With this in mind, you should always ask yourself: How can I reduce the information that is communicated between the driver and the database? One important factor in this optimization is the size of database protocol packets.
The size of database protocol packets sent by the database driver to the database server must be equal to or less than the maximum database protocol packet size allowed by the database server. If the database server accepts a maximum packet size of 64KB, the database driver must send packets of 64KB or less. Typically, the larger the packet size, the better the performance, because fewer packets are needed to communicate between the driver and the database. Fewer packets means fewer network round trips to and from the database.
For example, if the database driver uses a packet size of 32KB and the database server’s packet size is configured for 64KB, the database server must limit its packet size to the smaller 32KB packet size used by the driver—increasing the number of packets sent over the network to return the same amount of data to the client (as shown in Figure 2-14).
Figure 2-14 Using different packet sizes
This increase in the number of packets also means an increase in packet overhead. High packet overhead reduces throughput, or the amount of data that is transferred from sender to receiver over a period of time.
You might be thinking, “But how can I do anything about the size of database protocol packets?” You can use a database driver that allows you to configure their size. See “Runtime Performance Tuning Options,” page 62, for more information about which performance tuning options to look for in a database driver.