• 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

Stupid question - Request scope vs Session scope

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

Stupid question. Am I right in assuming that there is little difference in the amount of data transfered over the network for objects stored in request scope, accessed in a JSP, vs objects stored in Session scope accessed the same way?

The objects are just stored in the same way right? The reference client side to a request attribute and a session attribute is the same?

The reason for asking is that someone at work today stated they were moving a map of objects to session scope instead of accessing them through request attributes to reduce network traffic - am I missing something that I should know here?

Thanks
 
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

Originally posted by Rick Beaver:
Am I right in assuming that there is little difference in the amount of data transfered over the network for objects stored in request scope, accessed in a JSP, vs objects stored in Session scope accessed the same way?



There is no difference because there is no data transferred over the network in either case. And zero is pertty close to zero. The variable scopes are completely server-side mechanisms.


The objects are just stored in the same way right? The reference client side to a request attribute and a session attribute is the same?



There is no client-side reference to either.


The reason for asking is that someone at work today stated they were moving a map of objects to session scope instead of accessing them through request attributes to reduce network traffic - am I missing something that I should know here?



He's confused and making a major blunder if he's moving data to session scope for any reason other than making it available across multiple requests. He's probably just creating a memory leak.
[ April 13, 2006: Message edited by: Bear Bibeault ]
 
Rick Beaver
Ranch Hand
Posts: 464
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear, I didn't want to correct the chap because I started to doubt myself when he said that...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it's possible that if you put an object into session scope, the container might serialize it to a database (if you configured persistent sessions into the container). And your database might well be on a different machine. So that would actually INCREASE the network traffic, rather than decreasing it.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
Actually it's possible that if you put an object into session scope, the container might serialize it to a database (if you configured persistent sessions into the container). And your database might well be on a different machine. So that would actually INCREASE the network traffic, rather than decreasing it.



In addition, if you're clustering your app servers with session replication.
Every change to the session object will result in it being serialized and synced with the sessions in the other nodes.
 
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic