• 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

Cookies compression & decompression at client side

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I would like to compress and decompress the cookies at client side may be using Javascript.

Kindly let me know you thoughts on the above requirement.

Thanks in advance

 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a rather unusual questions. What is the actual problem you're wanting to solve? Are you trying to store too much in cookies? If so, have you considered server-side storage?
 
Ranch Hand
Posts: 129
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just check this performance related articles ..

performance

generic tutorial
 
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
Why would you want to compress just the cookies? This requirement makes no sense. gzip the entire response.
 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to everyone.

Why i need this?

Because i have a search page, to pre-populate the values which users selected(last 10 selection).

Am storing these data in cookie, so that my cookie size is very large. This leads that the request header size is very large size.

hope this will explain my problem.

Regards,

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
10 user-entered search terms doesn't sound like much - not more than a few hundred bytes for sure - hardly "very large".

You can move the search page into its own path (".../search/..." or something like that), and then use the cookie's path setting to restrict the cookie to just pages in that directory.
 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just gave the example, but we have more data, so that the header size is large.

Any suggestion???
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lester Burnham wrote:have you considered server-side storage?

 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lester,

Can you please explain about the server side storage?

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpSession
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not just have the server keep an object containing all this information and use a cookie with a unique ID to point to it?

Thats what HttpSessions do but you could roll-your-own version if you don't want to keep sessions.

Bill
 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,

As the user hits will be more to the page. we cant keep it in a server. This will lead to performance issue.

 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As the user hits will be more to the page. we cant keep it in a server. This will lead to performance issue.



OH REALLY! - from your vast experience with servlets you have deduced this?

You have made actual measurements?

The experience of countless web sites using the sessions mechanism counts for nothing?

If this data (too large to keep on the server) has to be transmitted with every request, you think it will give better performance than having the server side grab an object from memory or from disk? Better do the numbers before you assert that.

Bill






 
David Newton
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
My original question/solution still hasn't really been addressed: why compress *just* the cookie when you can just compress the entire response?
 
Rancher
Posts: 4803
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More fundamentally, big cookies are usually a sign of poor design. Cookies are designed to hold a small amount of data. If you want to keep a lot of state, its much better to set the cookie to a random nonce, and use that nonce as the key into a server side hashmap.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic