Re: Concurrent operations on LOBs

2012-11-13 Thread Nick99
hi,

I think I bumped into a similar bug. I have a multithreaded app; an 
instance of some class is updated; then it is loaded and an NPE is thrown 
by H2. I use #169, Windows 7, NTFS.

I cannot provide a test case at the moment; nor can I reproduce it again.

Could you please look what can be wrong?

Thank you.


Appendix 1
database.driverclass=org.h2.Driver
database.url=jdbc\:h2\:userdata/db/product01;MVCC\=TRUE;MULTI_THREADED\=0;LOCK_MODE\=3;LOCK_TIMEOUT\=2
database.dialect=org.hibernate.dialect.H2Dialect
database.usr=
database.pass=


Appendix 2
2012-11-12 13:01:53,412 [err] org.hibernate.exception.GenericJDBCException: 
could not load an entity: [com.company.product.Instance#1]
[...]
2012-11-12 13:01:53,412 [err] Caused by: org.h2.jdbc.JdbcSQLException: 
General error: "java.lang.NullPointerException" [5-169]
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.get(DbException.java:158)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.convert(DbException.java:281)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.toSQLException(DbException.java:254)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
2012-11-12 13:01:53,412 [err] at 
org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:293)
2012-11-12 13:01:53,412 [err] at 
com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.getRow(Loader.java:1355)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.doQuery(Loader.java:829)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
2012-11-12 13:01:53,412 [err] ... 54 more
2012-11-12 13:01:53,412 [err] Caused by: java.lang.NullPointerException
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getInputStream(ValueLobDb.java:291)
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getReader(ValueLobDb.java:277)
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getString(ValueLobDb.java:198)
2012-11-12 13:01:53,412 [err] at 
org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:291)
2012-11-12 13:01:53,412 [err] ... 69 more


-- 
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/-/SUnfsf55Dk0J.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Concurrent operations on LOBs

2012-11-13 Thread Thomas Mueller
Hi,

It seems the CLOB is closed, but I'm not sure why that would be, because
the result set is still open it seems. I'm afraid I don't know what could
be the problem in this case.

Regards,
Thomas


On Tue, Nov 13, 2012 at 4:50 PM, Nick99  wrote:

> hi,
>
> I think I bumped into a similar bug. I have a multithreaded app; an
> instance of some class is updated; then it is loaded and an NPE is thrown
> by H2. I use #169, Windows 7, NTFS.
>
> I cannot provide a test case at the moment; nor can I reproduce it again.
>
> Could you please look what can be wrong?
>
> Thank you.
>
>
> Appendix 1
> database.driverclass=org.h2.Driver
>
> database.url=jdbc\:h2\:userdata/db/product01;MVCC\=TRUE;MULTI_THREADED\=0;LOCK_MODE\=3;LOCK_TIMEOUT\=2
> database.dialect=org.hibernate.dialect.H2Dialect
> database.usr=
> database.pass=
>
>
> Appendix 2
> 2012-11-12 13:01:53,412 [err]
> org.hibernate.exception.GenericJDBCException: could not load an entity:
> [com.company.product.Instance#1]
> [...]
> 2012-11-12 13:01:53,412 [err] Caused by: org.h2.jdbc.JdbcSQLException:
> General error: "java.lang.NullPointerException" [5-169]
> 2012-11-12 13:01:53,412 [err] at
> org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.message.DbException.get(DbException.java:158)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.message.DbException.convert(DbException.java:281)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.message.DbException.toSQLException(DbException.java:254)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:293)
> 2012-11-12 13:01:53,412 [err] at
> com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.getRow(Loader.java:1355)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.doQuery(Loader.java:829)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
> 2012-11-12 13:01:53,412 [err] at
> org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
> 2012-11-12 13:01:53,412 [err] ... 54 more
> 2012-11-12 13:01:53,412 [err] Caused by: java.lang.NullPointerException
> 2012-11-12 13:01:53,412 [err] at
> org.h2.value.ValueLobDb.getInputStream(ValueLobDb.java:291)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.value.ValueLobDb.getReader(ValueLobDb.java:277)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.value.ValueLobDb.getString(ValueLobDb.java:198)
> 2012-11-12 13:01:53,412 [err] at
> org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:291)
> 2012-11-12 13:01:53,412 [err] ... 69 more
>
>
>  --
> 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/-/SUnfsf55Dk0J.
>
> To post to this group, send email to h2-database@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: H2 Concurrency performace issue...Please help

2012-11-13 Thread Sri
Sorry I was looking into some other things...now I got back to this..

How do we determine if disk io is capped?

I do see disk io is varying (up and down from 40kb- 200kb and occasionally 
shoots up to 950kb) all the time when I observed windows resource monitor.

-Sri

On Friday, November 2, 2012 2:23:03 PM UTC-7, Kartweel wrote:
>
>  Hi,
>
> Makes sense to me. If cpu isn't the issue (which I doubt it would be in a 
> database, but maybe the encryption adds a lot of overhead?) then adding 
> more threads would increase the time proportionally + synchronisation 
> overhead. Also there would be more work for the disk seeking between all 
> the different locations.
>
> So are you saying that disk io is increasing with each thread you add? or 
> is it capped? both bandwidth and iops ?
>
> On 3/11/2012 4:44 AM, Sri wrote:
>  
> Disk IO looks good too...can't seem to find what is the issue...
>
> On Thursday, November 1, 2012 2:36:21 PM UTC-7, Kartweel wrote: 
>>
>> How about disk io?, usually the disk is the bottleneck. 
>>
>> On 2/11/2012 3:44 AM, Sri wrote: 
>> > Hi, 
>> > 
>> > I am running H2 DB in server mode and using it for read only. It's 
>> > been performing very good with single user/thread and the performance 
>> > is getting degraded as I add more concurrent users/threads. 
>> > 
>> > Single user/thread --> about 100ms 
>> > 10 users/threads  --> about  230ms 
>> > 15 users/threads  --> about  320ms 
>> > 20 users/threads  --> about  440ms 
>> > 25 users/threads  --> about  550ms 
>> > 40 users/threads  --> about  900-1000ms 
>> > 50 users/threads  --> about  1300-1400ms 
>> > 
>> > Please see the attached screenshot for CPU, heap and thread 
>> > monitoring. I do not see the problem of CPU being max out or not 
>> > enough memory or not scaling threads as I add more users. 
>> > 
>> > H2 Version:h2-1.3.166 
>> > Url: 
>> > jdbc:h2:tcp://localhost:9092/<> > 
>> path>>;MULTI_THREADED=1;CACHE_SIZE=<>;CIPHER=AES;IFEXISTS=TRUE 
>> > 
>> > <> ==> tried different values, defualt-16mb, 128mb, 256mb, 
>> > 512mb and 1024mb (supplied in KB though) 
>> > 
>> > FYI, 
>> > Each thread is executing lot of queries (around 15-20) and some of 
>> > them are recursive queries (to fetch heirachy data). 
>> > 
>> > 
>> > Please let me know if anybody run into the same problem and how did 
>> > you resolve. 
>> > 
>> > Thanks in advance. 
>> > -Sri 
>> > -- 
>> > 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/-/hbZ9WV8cFWEJ. 
>> > 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. 
>>
>>
>>  -- 
> 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/-/njQ5VJHkPvEJ.
> 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.
>
>
>  

-- 
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/-/YscoajbGnT4J.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: H2 Concurrency performace issue...Please help

2012-11-13 Thread Ryan How
Other people might have some suggestions, but I guess if you try it on a 
solid state disk or just trial as an in memory database and see if it 
performs faster.


Or you could also try it on a ram disk and see if it improves 
performance. That way you don't need to try any other hardware.


At least then you'll know the disk was the bottleneck.

Ryan

On 14/11/2012 7:03 AM, Sri wrote:

Sorry I was looking into some other things...now I got back to this..

How do we determine if disk io is capped?

I do see disk io is varying (up and down from 40kb- 200kb and 
occasionally shoots up to 950kb) all the time when I observed windows 
resource monitor.


-Sri

On Friday, November 2, 2012 2:23:03 PM UTC-7, Kartweel wrote:

Hi,

Makes sense to me. If cpu isn't the issue (which I doubt it would
be in a database, but maybe the encryption adds a lot of
overhead?) then adding more threads would increase the time
proportionally + synchronisation overhead. Also there would be
more work for the disk seeking between all the different locations.

So are you saying that disk io is increasing with each thread you
add? or is it capped? both bandwidth and iops ?

On 3/11/2012 4:44 AM, Sri wrote:

Disk IO looks good too...can't seem to find what is the issue...

On Thursday, November 1, 2012 2:36:21 PM UTC-7, Kartweel wrote:

How about disk io?, usually the disk is the bottleneck.

On 2/11/2012 3:44 AM, Sri wrote:
> Hi,
>
> I am running H2 DB in server mode and using it for read
only. It's
> been performing very good with single user/thread and the
performance
> is getting degraded as I add more concurrent users/threads.
>
> Single user/thread --> about 100ms
> 10 users/threads  --> about  230ms
> 15 users/threads  --> about  320ms
> 20 users/threads  --> about  440ms
> 25 users/threads  --> about  550ms
> 40 users/threads  --> about  900-1000ms
> 50 users/threads  --> about  1300-1400ms
>
> Please see the attached screenshot for CPU, heap and thread
> monitoring. I do not see the problem of CPU being max out
or not
> enough memory or not scaling threads as I add more users.
>
> H2 Version:h2-1.3.166
> Url:
> jdbc:h2:tcp://localhost:9092/<

path>>;MULTI_THREADED=1;CACHE_SIZE=<>;CIPHER=AES;IFEXISTS=TRUE

>
> <> ==> tried different values, defualt-16mb,
128mb, 256mb,
> 512mb and 1024mb (supplied in KB though)
>
> FYI,
> Each thread is executing lot of queries (around 15-20) and
some of
> them are recursive queries (to fetch heirachy data).
>
>
> Please let me know if anybody run into the same problem and
how did
> you resolve.
>
> Thanks in advance.
> -Sri
> --
> 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/-/hbZ9WV8cFWEJ
.
> 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
.


-- 
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/-/njQ5VJHkPvEJ
.
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
.


--
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/-/YscoajbGnT4J.

To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.


--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http