[fpc-pascal] Patch/Test BlobSegmentSize was: IBConnection blobsegmentsize irrelevant & performance

Reinier Olislagers reinierolislagers at gmail.com
Sat Nov 19 21:24:37 CET 2011


On 19-11-2011 13:28, Reinier Olislagers wrote:
> Hi list,
> 
> The Firebird/Interbase ibconnection.pp code has this code in its
> SetParameters procedure to upload blobs in segments (BlobSegmentSize
> property is set to 80 on object creation):
>       while BlobBytesWritten < (BlobSize-BlobSegmentSize) do
>         begin
>         isc_put_segment(@FStatus[0], @blobHandle, BlobSegmentSize,
> @s[(i*BlobSegmentSize)+1]);
>         inc(BlobBytesWritten,BlobSegmentSize);
>         inc(i);
>         end;
>       if BlobBytesWritten <> BlobSize then
>         isc_put_segment(@FStatus[0], @blobHandle,
> BlobSize-BlobBytesWritten, @s[(i*BlobSegmentSize)+1]);
> 
> I've asked the Firebird list whether we need to upload in segments and
> the answer is no, you can upload in chunks of up to 65535 bytes (see below).
> 
> Would getting rid of the BlobSegmentSize property and replacing it by a
> BlobSegmentSize const set at 65535 make sense (e.g. for performance)?

Did a small performance test:
- once with 80, once with 65535
- 10MB blobs
- Firebird 2.5 server
- on a virtual machine (just restored from snapshot before each run)
The difference seems fairly big: 395 seconds versus 260 seconds

Hope I'm testing correctly.

Test code is attached; I'd appreciate confirmation.

Also attached is a patch for ibconnection.pp against FPC fixes_2_6.
I set the BlobSegmentSize property to deprecated and basically ignored
the underlying variable when writing blobs.

I wonder whether/what changes are required for reading blobs...

Thanks,
Reinier


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: firebirdsegment.pas
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111119/de4f5383/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ibconnection_segmentsize.diff
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111119/de4f5383/attachment-0001.ksh>


More information about the fpc-pascal mailing list