>
> As a follow up,
>
 
I unit tested mutli-threaded inserts, reads and updates up to 100000 
entries and have seen awesome performance, lets say under 8 msecs average 
while on a taxed VM - I did a simple unit test with a loop that drops 
runnables into the thread executor. But, when I mix inserts and reads... it 
falls apart quickly.

I've read the performance tuning page - not much about multi-threading.... 
 can someone comment on some experiences with doing high concurrency with 
H2? My application reads from multiple JMS queues/topics - each on its own 
thread, then dumps it to the H2 DB. Other threads grab the messages and 
"process" them - we are seeing 1+ second read times when under "light" 
loads. I am using connection pooling with the apache BasicDataSource - 
using the default - Im concerned because I see threads in the BLOCKED state 
from inside the H2 DB Drivers. 

Example code:

@GET 
@Path("/flood") 
@Produces("text/plain") 
public String flood(@Context UriInfo info) 
{ 
String s = info.getQueryParameters().getFirst("count"); 
int count = Integer.parseInt(s); 
ExecutorService executor = Executors.newFixedThreadPool(25); 
final Map<String,String> p = new HashMap<String,String>(); 
p.put("A", "value1"); 
p.put("B", "value2"); 

for (int i=0; i<count; i++) 
{ 
final int idx = i; 
Runnable r1 = new Runnable() { 
@Override 
public void run() { 

long start = System.currentTimeMillis(); 
WebServices.this.incoming.storeMessage("MESSAGE-" + idx, "SOURCE-" + (idx % 
5), 84600000, p); 
long diff = System.currentTimeMillis() - start; 
calc(idx, diff); 

} 

}; 

executor.execute(r1); 

Runnable r2 = new Runnable() { 
@Override 
public void run() { 
//long start = System.currentTimeMillis(); 
Object o = WebServices.this.incoming.getMessage("SOURCE-" + (idx % 5), -1); 
//System.out.println(o); 
//long diff = System.currentTimeMillis() - start; 
//calc(idx, diff); 
} 

}; 
executor.execute(r2); 
} 

return "D0NE"; 
}
 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to