• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ValueListHandler - large data set problem

 
Ajaz A
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on an application which, like many, displays a subset of a large data set with Next Page/Previous Page links. This seemed like a perfect application of the Value List Handler pattern.

My question, however, is this. It mentions that the Value List Handler is cached on the server side. Where is a good place to cache this list? One of the requirements of the application I'm working on is that the amount of "stuff" placed in the user's session should be minimized. Also, the number of user working concurrently is huge. So I cannot use a session bean strategy of VLH.

Is the user's session the only place that makes sense for this? Or is there somewhere else it can be cached and tied to that particular user?

If I dont keep the data in a cache then I need to re execute the query for next subset of data. So I have to keep it as statefull. This again creates a overhead since there will be lot of users.

Thanks in advance for your help...
 
Ajaz A
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any comments..please.
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome.
[ November 28, 2007: Message edited by: Khaled Mahmoud ]
 
Juan Pablo Crossley
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Khaled Mahmoud:
You can store the cache on whatever place you see suitable. For example you can store it in the user session or you can store the data in an XML file on the server. Any solution that makes the best performance is welcome.

[ November 28, 2007: Message edited by: Khaled Mahmoud ]


WoooooooooooooW .... the file store is not a good practice remember... the design of your application must consider the cluster situation, in that case you can't use the disk as session storage. btw, the specification forbids that, if you use the java.io to store files you could lead to a non compliant application.

about your answer, use the http session because it will be forwarded to other servers if you are in a cluster environment, avoid the static variable solution due to the same problem.
 
David Sheth
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mentioned
If I dont keep the data in a cache then I need to re execute the query for next subset of data.


However, if your dataset is large, and you have a large number of users, you may run out of memory if you store a large dataset for each user. Instead, you may want to take advantage of the built in pagination features of EJB3/JPA--in particular, the setMaxResults and setFirstResults methods. You would need to run a new query for each page that a user sees, but your memory consumption would be much less. This is a tradeoff that we make in our applications for large lists.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11866
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with the Sun Certified Enterprise Architect exam or assignments. This may be one of the reasons you got no responses last time you posted this, and it took so long to get a response this time - you were asking the question to people who were coming to this forum for another reason.

I am therefore moving this topic.

Regards, Andrew
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...the Value List Handler pattern...

Seems to me that if you look at the Figure 8.30, all the participants except for the Client are EJBs managed by a container in the persistence layer and in a process separate form the Client.

The ValueList is an entity bean.

The DataAccessObject is a stateless session bean.

The ValueListHandler is a stateful session bean returned from the DataAccessObject.

I haven't tried to parse the code in that example because I assume that it's pre JavaEE 5.0.
[ November 28, 2007: Message edited by: Bill Shirley ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic