-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Updating counter value
PostPosted: Mon May 02, 2005 8:08 am 
Newbie

Joined: Mon May 02, 2005 7:50 am
Posts: 1
Location: Gurgaon
I have requirement of maintaining counter in an application. I need to update a counter value approx. at rate of 50 updates per second. Are there any figures available about how many updates on a single row are possible in one second?

_________________
Pankaj Arora


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 02, 2005 11:15 am 
Regular
Regular

Joined: Mon Jul 26, 2004 2:28 pm
Posts: 86
Location: Pensacola, Florida
It depends largely on your topology (Is the web-server on the same machine as the database? If not, how fast is the network? What is the distance between the machines?); the machine (I/O configuration? Disk speed? Processor speed? Memory?); the database (Vendor? Version? Load? Transaction log enabled? Replicating?); the driver (JDBC level? Thin?) and the efficiency of your code. I don't think it's something you can calculate beforehand...you have to implement a test case and benchmark it under a load to see how much wiggle room you have.

You would be loading a POJO, updating a property, and flushing the session 50 times per second. If you had to load the POJO each time (new session for each count) then that's a 100 transactions per second (SELECT + UPDATE). If you load the POJO once, and cache it as a detached object in some kind of singleton instance then you only have the updates. It's probably in the realm of possibility, but it would be more efficient to flush periodically (once every 50 counts, or once per second, for example). The trade-off there would be that if a transaction were to fail (the DB crashes or you get a StaleObjectException, for example) you would lose about 50 counts. If that's not acceptable, then a periodic flush may not be feasible.

- Jesse


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.