[fpc-pascal] IBConnection blobsegmentsize irrelevant & performance

Reinier Olislagers reinierolislagers at gmail.com
Sat Nov 19 13:28:51 CET 2011


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)?

Thanks,
Reinier

http://tech.groups.yahoo.com/group/firebird-support/message/115826
Posted by: "Ann Harrison"
Fri Nov 18, 2011 9:10 am (PST)

Reinier Olislagers wrote:
>
> I came across BLOB segment size and understand that, when writing BLOBs,
> you need to write in chunks smaller than or equal to the segment size.

Your understanding is wrong. The segment size was a suggestion for
some higher-level tools that wanted a hint as to the size chunks of
blob that would be convenient to handle. To the best of my knowledge,
nothing uses it now. Even when it was used, it did not limit the size
segment that could be passed in and out.

That interface was designed in 1982 - think about the increase in
available RAM since then.

> Presumably having a larger segment size might improve performance for
> reading/writing large BLOBs, but might lead to bigger storage
> requirements per BLOB?

Pass the largest chunks that are convenient to handle, remembering
that at various places there are 16 bit integers that describe the
length of things. Passing larger chunks has no effect on the storage
size.



More information about the fpc-pascal mailing list