Eagar loading behavior of BLOBs in Teiid 8.4
anilallewar Apr 3, 2014 4:32 PMI am trying to compare Teiid 8.4 performance against native JDBC for Oracle. For most part we found that Teiid performance is comparable with SQL access through JDBC driver when we have tables that don't have BLOB data. We found that with tables having BLOB data, as the number of records increases Teiid performance drops to about 5x-6x times that of direct JDBC access. Please see numbers in the table below that have the Blob column value as "TRUE"
| TEIID-JDBC | |||||||
---|---|---|---|---|---|---|---|---|
Transactions: | No of Records | Blob | Iteration (ms) | Iteration (ms) | ||||
Table Size | Average - 1st Iteration | Average - Remaining 4 Iteration | Average - 1st Iteration | Average - Remaining 4 Iterations | ||||
Table Name | (from old run) | |||||||
******* | 42 | 4,351,139 | TRUE | 142 | 7 | 100 | 14 | |
******* | 13 | 1,302 | FALSE | 137 | 3 | 93 | 15 | |
******* | 720,850 | 94,687,298 | FALSE | 4,348 | 3,511 | 4,522 | 3,880 | |
******* | 21,804 | 3,220,420 | TRUE | 551 | 213 | 1,519 | 1,620 | |
******* | 0 | 0 | TRUE | 136 | 1 | 60 | 14 | |
******* | 8,652 | 2,013,954 | FALSE | 633 | 146 | 539 | 205 | |
******* | 2 | 270,566 | TRUE | 144 | 2 | 92 | 10 | |
******* | 32,531 | 0 | TRUE | 992 | 623 | 5,049 | 5,098 | |
******* | 0 | 0 | FALSE | 135 | 2 | 67 | 16 | |
******* | 0 | 0 | FALSE | 136 | 1 | 62 | 12 | |
******* | 693 | 89,770 | FALSE | 228 | 41 | 183 | 58 | |
******* | 0 | 0 | TRUE | 137 | 1 | 60 | 15 | |
******* | 1 | 74 | FALSE | 134 | 1 | 92 | 7 | |
******* | 1,103,918 | 119,609,996 | FALSE | 6,120 | 5,157 | 6,442 | 5,793 | |
******* | 185,454 | 541,726,992 | TRUE | 3,761 | 3,303 | 25,139 | 25,518 | |
******* | 1,003,798 | 142,704,688 | FALSE | 5,379 | 4,424 | 5,719 | 4,939 | |
******* | 505,007 | 230,497,476 | FALSE | 6,876 | 5,966 | 7,538 | 7,068 | |
******* | 505,005 | 405,861,672 | FALSE | 16,150 | 15,090 | 19,399 | 19,080 | |
******* | 0 | 0 | FALSE | 133 | 2 | 70 | 12 | |
******* | 859,457 | 136,837,530 | FALSE | 5,355 | 4,589 | 5,630 | 4,979 |
For the BLOB columns we are just retrieving the object using getObject() and then typecast based on whether the object is an instance of Blob; but not really reading the contents using either getBytes() or getInputStream() on the Blob object. When I debugged through the Teiid client code, I found that the object received in the org.teiid.netty.handler.codec.serialization.CompactObjectInputStream class contains a javax.sql.rowset.serial.SerialBlob object which might mean that the Blob was serialized on the server itself. I also put the read in a transaction and noticed same behavior.
I am confused as to how Teiid handles LOBs; the documentation states that "Source LOB values (LOBs from physical sources) are typically accessed by reference, rather than having the value copied to a temporary location." but that doesn't seem to happening when I look at the behavior. Debugging through the code indicates that the Teiid JDBC client is actually reading the data in the stream and creating a new "javax.sql.rowset.serial.SerialBlob.SerialBlob" object.
BlobType.readReference(ObjectInput) line: 145 | |
BlobType(Streamable).readExternal(ObjectInput) line: 125 | |
BatchSerializer$BlobColumnSerializer1.readObject(ObjectInput) line: 333 |