• Post Reply Bookmark Topic Watch Topic
  • New Topic

MDB overloaded causing unexpected PK errors on the DB  RSS feed

 
Sean Doherty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a strange problem. We use JBoss Application Server. We have our MDBs configured to have upto five instances to be running as per the load. The MDBs in general, all it does is read the JMS messages sent across by remote servers, read the object messages and insert into the database.

The messages which is sent by the remote servers are packaged into chunks of 4000 rows of data and sent. Recently someone changed the parameter to send around 20000. After this change we see lots of Primary Key exceptions from the DB. As part of the debugging process, i changed the parameter back to 4000, and voila! it stopped throwing exceptions.

Interesting thing is the PK is basically an hour stamp with some ID. And i assume that the same JMS message sent by the server will not be received by 2 or more MDBs. Then the question is how these PK exceptions. Also if the load is reduced (20000 -> 4000) why it works fine?

Any comments here will be greatly appreciated.
 
Sean Doherty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any comments guys!
 
Mateus Lucio
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Would you mind explain better how the PKs are been generated and used?

is there any processing code on that data? If there is, then I'd start looking for concurrency problems on PK generation, can your code generate a PK and take so long to insert the data that another mdb have enough time to get the same PK?
 
Sean Doherty
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, the system i am trying to debug is basically our simulator system. The PK (composite) comprises of two columns. First column is an ID and the second column column is a timestamp.

All the ids are stored in a table (basically devices registered have an id). For the simulator during initialization, we basically read the ID from the DB and write them into a text file.

The simulator system then periodically (Once every hour) reads the text file for the Ids and gets the current timestamp and sends them across as JMS messages.
 
Mateus Lucio
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the precision you're using when getting the timestamp? minutes, seconds, milliseconds?

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!