Tomcat 5
Hi All.
I'm using Tomcat5
I've a class like this :
-
public class User_Books
{
private String USER_ID;
private String Xxx;
....
void Add_Book( String book_id);
void RemoveBook(String book_id);
void ActionXxx();
....
}
-
Every time user enter the site ... I'm creating instance of this class and
store it in a session.
-
User_Books usr_books = new User_Books();
session.SetAttribute("User_Class",usr_books);
-
But we have 400.000 online user's . And the performance is slow.
-
What if I set all methods "STATIC" ? I heard that static methods loads into memory once.
Any idea ?
Thanks for response.
[761 byte] By [
USSRa] at [2007-10-3 0:53:56]

If you use a static object, this object exists only one time in memory, but then you can't store user_books so many times. Instead you have to a Collection of user_books! And then the problem is the same.
If you has 400000 Sessions you should have a good server(s) and then the server has some Gigs of Memory and then this is no problem :-)
Or you can try to store the user_books in a database instead use the sessionstore!
regard Dietmar
Thanx for all , for response.
But owner of the site is a little mean:)))
--
I've a little different approach .
Any idea ?
-
public class User_class
{
String USER_ID;
String Xxx;
...
}
-
public class User_Book_Action
{
static void AddBook( User_class,String book_id);
static void RemoveBook( User_class,String book_id);
}
-
I'll store just User_class in a session and just use USer_Book_Action class as a action maker.
Any idea ?
Thanx
USSRa at 2007-7-14 17:49:11 >
