This content has been marked as final.
Show 4 replies
-
1. Re: Tracking total requests to servlet deployed in multiple jboss clusters
f_marchioni Feb 1, 2010 6:19 AM (in response to mnenchev)Hello,
if I understand your requirements you can add a persistence layer to your web application ( Hibernate if you don't want/cannot use an EJB container)
and store the amount of purchases there, which will be shared by the cluster.
Alternatively, if you want to set up a timer cluster-aware to monitor the sales, this can be done as well:
http://community.jboss.org/wiki/DeployingEJB3TimersInCluster
Hope this helps
Francesco
-
2. Re: Tracking total requests to servlet deployed in multiple jboss clusters
mnenchev Feb 1, 2010 12:15 PM (in response to f_marchioni)Hi, i do have persistence layer using JPA and i use ejbs for my business&persistence logic. The problem is that my client wants every purchase request to be under 100ms and i can't afford to hit the data base. -
3. Re: Tracking total requests to servlet deployed in multiple jboss clusters
f_marchioni Feb 1, 2010 12:41 PM (in response to mnenchev)Hello,
if you cannot afford hitting the DB, then you could use the HTTP Session to share the data across the cluster or, as an alternative, use an HA Singleton.
Hope it helps.
Francesco
-
4. Re: Tracking total requests to servlet deployed in multiple jboss clusters
mnenchev Feb 23, 2010 10:19 AM (in response to f_marchioni)Hi, i can't use HA singleton. And the data is not only per user - i can't keep the trucking count in the user's session. I will try to explain more what i want to do: The app has a collection of assets that may be from 1 to n; A user can place a purchase over an asset. My client wants "the purchase" to become manual (manual means the purchase must be confirmed by the admin who i watching a screen of manual purchase and process them) if for the current period(this must be scheduled by single timer in the cluster and on expire all counts will be reinitialized to 0): 1) the purchases for this asset are more than MAX_ASSET_PURCHASE_COUNT or if the sum of the purchases prices for the asset is more than MAX_ASSET_PURCHASES_PRICE. 2) the purchases for the user are more than MAX_USER_PURCHASE_COUNT(user specific) or if the sum of the purchases prices for the user is more than MAX_USER_PURCHASES_PRICE(user specific) 3) like 1) but not per asset and for all assets together. 4) like 2) but not per user and for all users together. The idea for one timer that is scheduled only by one of the jboss instances is great, but i can't make it to work, every thing is fine but when i kill the first jboss instance the second does not start the timer bean and does not schedule the timer(but i can see that it is deployed).So assuming i can make this to work in some way. I will make a service method that starts this timer from the jmx-console. I have external memcache that is visible from all instances. The purchases will be frequent like about 1000+ per minute. So i cant afford to update the memcache for every purchase. I was thinking about in memory cache for every jboss instance that tracks the counts and when the timer expires i get the counts from every inmemory cache and update the memcache and reinitialize the inmemory cache. The purchase servlet reads the memcache before purchase is done and decides over the above thresholds if the purchase has to go manual or not. So, any ideas? :) Regards.