Subject | Re: [Firebird-Java] FBBlobField.java.patch |
---|---|
Author | Roman Rokytskyy |
Post date | 2005-12-29T19:52:30Z |
> I think single roundtrip to the server to query the length is nothingBut when we talk about small BLOBs, we decrease the performance...
> against at least 125 to read the 2M BLOB (with default 16kb chunk
> size).
> And it allows to exclude memory reallocations - ByteArrayOutputStreamYes, this is the issue. I will think about possible improvement.
> reallocates new byte array with double size each time the buffer size is
> exceeded. And finally the whole 2Mb buffer is copied inside toByteArray().
> Also all ByteArrayOutputStream methods are synchronized.
> Yes, in test application with 1..2 Mb BLOBs it is about 1.5 timesThis is also true. We had a "new byte[32768]" in one place in driver, that
> faster. In real application it is difficult to measure as it depends
> on number of concurrent users, memory load, etc. Extra memory
> reallocations can trigger the GC, with additional slowdown.
slowed down the driver almost twice.
> I think it will be better to have getBytes() with predictableThere is one issue here - there are applications that use getBytes() for
> performance for all cases, and getInputStream() allowing developer to
> exclude additional roundtrip.
small BLOBs, changing this behavior to include one roudtrip will change its
behavior. Also, personally I would expect that applications fetching big
BLOBs would use getBinaryStream(), since I want to control the memory
allocation in my application.
So, currently I see only one possibility - to add one more property that
would allow memory allocation in the driver - something like
"fetchBlobsAtOnce" or something similar...
Roman