db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3769) Make LOBStoredProcedure on the server side smarter about the read buffer size
Date Wed, 09 Jul 2008 13:27:32 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612094#action_12612094
] 

Kristian Waagan commented on DERBY-3769:
----------------------------------------

This issue can be fixed in the client, in the server or on both sides by adjusting the amount
of requested data.
There are advantages to doing it on both sides, for instance that new clients will behave
better with older servers, but I think it is the server that knows best how much data can
be sent so I plan to implement the fix there.

Opinions?

> Make LOBStoredProcedure on the server side smarter about the read buffer size
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-3769
>                 URL: https://issues.apache.org/jira/browse/DERBY-3769
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>    Affects Versions: 10.3.3.0, 10.4.1.3, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>
> Derby has a max length for VARBINARY and VARCHAR, which is 32'672 bytes or characters
(see Limits.DB2_VARCHAR_MAXWIDTH).
> When working with LOBs represented by locators, using a read buffer larger than the max
value causes the server to process far more data than necessary.
> Say the read buffer is 33'000 bytes, and these bytes are requested by the client. This
requests ends up in LOBStoredProcedure.BLOBGETBYTES.
> Assume the stream position is 64'000, and this is where we want to read from. The following
happens:
>  a) BLOBGETBYTES instructs EmbedBlob to read 33'000 bytes, advancing the stream position
to 97'000.
>  b) Derby fetches/receives the 33'000 bytes, but can only send 32'672. The rest of the
data (328 bytes) is discarded.
>  c) The client receives the 32'672 bytes, recalculates the position and length arguments
and sends another request.
>  d) BLOBGETBYTES(locator, 96672, 328) is executed. EmbedBlob detects that the stream
position has advanced too far, so it resets the stream to position zero and skips/reads until
position 96'672 has been reached.
>  e) The remaining 328 bytes are sent to the client.
> This issue deals with points b) and d), by avoiding the need to reset the stream.
> Points a) and e) are also problematic if a large number of bytes are going to be read,
say hundreds of megabytes, but that's another issue.
> It is unfortunate that using 32 K (32 * 1024) as the buffer size is almost the worst
case; 32'768 - 32'672 = 96 bytes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message