Blob threadpool

20 views
Skip to first unread message

Mark Addleman

unread,
Aug 29, 2011, 1:13:50 AM8/29/11
to h2-da...@googlegroups.com
I'm writing an application which may write tens of thousands of blobs simultaneously.  Each blob will be around 1k. 

In initial testing, it appears that H2 writes each blob using a separate thread.  I doubt that approach will scale in my use case.  While I could adjust the design of my app to accommodate this behavior, I'd prefer some direct control over it such as providing my own thread pool or something else.

Does BINARY / VARBINARY have this same behavior?  Maybe that would map better to my use case.

Noel Grandin

unread,
Aug 29, 2011, 5:44:26 AM8/29/11
to h2-da...@googlegroups.com, Mark Addleman
With a BLOB that small, you'd be better off using a larger PAGE_SIZE, and a VARBINARY column.


Mark Addleman wrote:
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/2oJVTsrQglYJ.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.


Thomas Mueller

unread,
Aug 31, 2011, 1:07:03 PM8/31/11
to h2-database, Mark Addleman
Hi,

> separate thread

The separate thread is only created when calling
Connection.createBlob(), and then Blob.setBinaryStream().

For H2, PreparedStatement.setBytes is a lot more efficient. Or
PreparedStatement.setBinaryStream (if you don't know the length, use
-1, or the method without the length when using Java 6).

> With a BLOB that small, you'd be better off using a larger PAGE_SIZE, and a
> VARBINARY column.

I agree. 1 KB isn't large, and the BLOB overhead is most likely larger
than the benefit.

Regards,
Thomas

Mark Addleman

unread,
Aug 31, 2011, 1:35:34 PM8/31/11
to h2-da...@googlegroups.com, Mark Addleman
That's very useful to know.  Thanks
Reply all
Reply to author
Forward
0 new messages