File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes application scope or/vs database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "application scope or/vs database" Watch "application scope or/vs database" New topic
Author

application scope or/vs database

Alan Yap
Ranch Hand

Joined: Feb 24, 2006
Posts: 32
I've posted similar question but it was deemed unsuitable for this category but I still think the chances of it getting answered here is higher.

Each logged in user in my application will have his few info updated constantly (roughly at about 1 time each second). This will be done via a hidden iframe.

Method A) use application scope
store the updated info into application scope bean. Eg.

<jsp:useBean id="GLOBAL" scope="application" class="myVeryOwn.global"/>
GLOBAL.save("[username].INFO_1",INFO_1);
...
GLOBAL.save("[username].INFO_n",INFO_n);

*save is a function that puts the value into a hashtable inside global.

When he logs out, those info will be moved/transfered into the DB

Method B) use DB
directly store the info into the DB as soon as it change.

I know method B will put a heavy load on the sql connection, but I am just wondering whether things will get any more better/effecient if I employ method A.

Or are there MUCH better alternative?

Notes:
1) the info to be recorded constantly are actually user/player map location. Must be updated as soon as he move.
2) Expected total number of user online at the same time to be around 20,000-50,000.


When I'm not coding.. I do THIS
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: application scope or/vs database
 
Similar Threads
Storing information in session
working with drop down menus
jsp session scope List values
Global notification method
Session HashMap