• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clarifications on session attribute

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

For Pagination, I am supposed to follow this approach:

Client requests page 1
Execute query
Cache complete result set
Return rows for page 1
Client requests page 2
Get rows from the cache and return rows for page 2

For caching the result set i am planning to use session attribute.
I need some clarifications:
1. If i store 20000 records in the session attribute, will it degrade the performance?
2. Is there any way to cache result set with out using session attribute.

Thanks
Sudha

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excess memory usage is pointless. Only fetch the number of rows that you are actually going to show. Fetching all 20000 in oder to show 16 is not a goof approach.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently i am using pagination on the DB side using rownum getting the desired number of records.
The new requirement is that I am supposed to get the entire information only once from the database and cache, when ever client requests it get the information from the cache. I am really not happy to use sessions but i dont know what to do.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Fetching all 20000 in oder to show 16 is not a goof approach.


Your Freudian slip is showing.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right! It is a "goof" approach! ;)

Seriously, that's a poor requirement -- I'd push back on it from a technical standpoint.

How many users are going to use the app? 10? 100? 1000? 1000000? Do the math.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
20.. Each record has 2 clobs.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, do the math. Multiply how many simultaneous users you will have, times the size of the data held in the session.

Does it make sense to hold that much data in memory, most of which will never be viewed?
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Again, do the math. Multiply how many simultaneous users you will have, times the size of the data held in the session.



You could also do a load test to try to figure out how this will affect the app. That should answer your performance question.

2. Is there any way to cache result set with out using session attribute.



The easiest way to do it would be to use the session attribute. There are other ways that might reduce the cost of RAM usage but reduce performance also.

I am really not happy to use sessions but i dont know what to do.



Why do you have this concern ?

We have a couple of links here related to pagination

Javaranch tips on pagination
Pagination article

Hope that helps
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic