Subject RE: [Firebird-Java] Blobs and Streams
Author Steffen Heil
Hi

> There is almost no difference between InputStream and byte[],
> the main difference is memory usage - InputStream is a direct
> stream to blob and no internal memory allocation happens
> within the driver (not the case in auto-commit mode).

What is different in auto-commit mode?

Memory is a problem here, since not all images are for the web site itself;
some contain landscape images which have several megabyte...

> Most likely the speed is not the issue here, but a
> scalability. Browsers do not ask images one by one, but many
> at once. Since that are separate http requests, you will need
> separate connection per request with separate transactions,
> otherwise you will have to introduce some very complex
> synchronization based on the HttpSession to serve image at
> once and even more complex transaction management.

This should not be a problem either using a connection pool with a high
maximum number of connections?
I am not planing on synchronizing, because every thread has it's own
Connection and since none of them writes to the database, no locking should
occur. (Here my question about autocommit, which I think the pooled
connections are by default...)

> So you have to create tests anyway (my tests show me
> something ~48 Mbit/s for reas and ~32 Mbit/s for writes on
> Pentium M 1,6 MHz laptop, Windows XP, locally running FB 1.5 SS).

Are you sure about MBit or did you mean MByte? 48 MBit read spead seems less
than I expected, exspecially since the harddrives here on my dev system do
about 60 mbyte / sec and the productive system is striped... I assume the
FileImputStream will have way better troughput...

Anyway, my concerns are not about throughput. My concers are about latency.
I assume settings up a FileInputStream is way faster than getting an
InputStream from a database query. This is my biggest concern. I think the
throuput (of several threads) will be limited by the nic card, but latency
is always problem.

Regards,
Steffen


[Non-text portions of this message have been removed]