I forgot to mention that the next ticket number bean should also implement the "Singleton EJB" pattern as you should enforce a rule that only one component issues next numbers.
I suggest that you persist the last number used. You should then get a uniformly fast response to each query, at the expense of an additional write for each ticket. An alternative is not to persist, but to get the initial number by a SQL statement :- | select max(ID) from tickets | This is slow for the first operation only - unless you can find a way to initialize as the server starts before the first user logs on. Tickets will normally be issued sequentially, and all the low numbers will be cleared before the maximum number is reached and the number rolls round. But the solution does cope with an unusually long lived record, where the table looks like :- | 5 | | 996 | 997 | 998 | 999 | The EJB specification mandates that an EJB is locked by each method call. So a second user will wait until the first user completes the call. This is why you don't get duplicate numbers. Potentially, issuing the next number is a performance bottleneck. Assume that users take a minute on average to enter a ticket. 50 milliseconds is required to issue the next number. Then 400 concurrent users will require 50*400 milliseconds, or 20 seconds of each minute to issue numbers. So the next number EJB is busy for 33% of the time, and I would expect short queues of users to appear and disappear at that level of utilisation. When you consider that the server must also write out tickets, which will also take about 50 milliseconds per write, the server will be 70% utilised which will be close to the practical limit. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840741#3840741 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840741 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user