I watched a very slow SQL query (from a Java application using Hibernate deployed in JBoss 5.1). This particular query returned about 10 thousand records, but still took 40 or more.
I ended up sniffing traffic using a database (wirehark has a dissector for TNS) and found something unexpected. When the data came from the server, each row of results was in its own TNS package. In addition, each TNS packet was confirmed by the client (i.e. the application server) before the next was sent from the database. For 10K entries, there are 10K roundtrips to receive the packet and confirm it. The performance impact is huge.
This is terribly inefficient. TCP allows larger packets and has a number of mechanisms (sliding windows, delayed ACKs) to reduce latency and increase throughput. However, in this case, the TNS protocol from above adds its own negotiations.
If I run the same query from Oracle SQL Developer, I do not see this template. The request completes approximately 1/10 time, without thousands of rounds.
Short version : Oracle wired protocol (TNS) seems to send data in one TNS packet packet for each request and requires that each packet be acknowledged by the client before the server sends the next one.
I found information about this [here] [1] (scroll down to the section "SDU and TDU parameters in the tnsnames.ora file").
And so my question is: is it possible to control the behavior of the Oracle driver (I use 10.2.0.4.0) so that the TNS protocol is more efficient? Again, this is a pretty standard J2EE application deployed to JBoss.
Thank you so much!
performance oracle tns
wishihadabettername
source share