Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cookies compression & decompression at client side

 
Nalini Nagarathinam
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • 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?
 
vijin das
Ranch Hand
Posts: 129
Firefox Browser Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just check this performance related articles ..

performance

generic tutorial
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
HttpSession
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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?
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic