Implement chunked cookie storage with client storage service
Basics
Logistics
Basics
Logistics
Description
I think I’ve tried this before and not found it viable, but since I forget why I’ll try again…
Most browsers implement an odd rule that tightly limits cookie size individually to about 4k, but allows a large number of actual cookies per domain, usually over 100. This is…dumb, but that’s par for the course with browsers.
It seems like it should be possible to implement a chunking design that spreads the encoded data out across multiple cookies by adding a numeric counter to the name of the cookie.
I suspect the biggest challenge with that is cleanup, not knowing in some cases how many to unset.
It would probably help to implement this somehow at a lower layer in the CookieManager class and hide it all by treating the cookie name on input as the basis of computing the other names. It might even be sensible to make the “primary” cookie a sort of index of what cookies will be used and then use that to know how to manage them.
Environment
None
Activity
Scott Cantor
March 12, 2024 at 7:19 PM
Admittedly this may not be ideal to do anyway since this bloats traffic. The justification to keep individual cookies small is basically because of that.
The major reason I’m considering it is for the SP for session recovery to make that more reliable universally and potentially offload sessions from the Java service entirely, but that does come at a cost of passing that data up on every request to an app.
The last thing I really want to do is figure out a way to “interrupt” requests that cross between agents and use POST preservation to save state, send the client to a special URL, and confine the cookie/storage to that path in order to address that problem, but that may be the only practical solution in the bigger picture.
I think I’ve tried this before and not found it viable, but since I forget why I’ll try again…
Most browsers implement an odd rule that tightly limits cookie size individually to about 4k, but allows a large number of actual cookies per domain, usually over 100. This is…dumb, but that’s par for the course with browsers.
It seems like it should be possible to implement a chunking design that spreads the encoded data out across multiple cookies by adding a numeric counter to the name of the cookie.
I suspect the biggest challenge with that is cleanup, not knowing in some cases how many to unset.
It would probably help to implement this somehow at a lower layer in the CookieManager class and hide it all by treating the cookie name on input as the basis of computing the other names. It might even be sensible to make the “primary” cookie a sort of index of what cookies will be used and then use that to know how to manage them.