[Zope] Core Session Tracking questions
sam gendler
sgendler@akamai.com
Fri, 16 Mar 2001 18:42:29 -0800
This is a multi-part message in MIME format.
--------------C6CF158DC1345AFAE558E54D
Content-Type: multipart/alternative;
boundary="------------3E99B56399324616CE5095E0"
--------------3E99B56399324616CE5095E0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
> That's an interesing idea. Except that cookies are usually limited to ~
> 4000 characters on the client. You can't stuff much data into 4000
> characters. It'd be pretty neat, however. Care to try to implement it?
> ;-) If not Jerome, anyone else?
>
I just created a simple class with 20 integers, 20 floats, and 20 strings of 48
characters each. Pickled, the object was 1358 characters long, and run through
zlib.compress, it was all of 382 bytes long. That is an awful lot of data for
only taking up less than 10% (compressed) of the available storage in a
cookie. Fill a file with 4000 characters and see just how much stuff that is.
You could also potentially work out a mechanism so that the object gets split
across multiple cookies if it is too large. I don't think any browser has a
limit on the number of cookies settable by one site. I have attached my goofy
test class, just so you can see what it looked like.
It probably isn't the cleanest solution, but it can certainly be made to work.
I think most applications wouldn't even need the compression step. I've never
actually used the CSM, just codeit's Session product, so perhaps I am barking
up the wrong tree...
--sam
--
---------------------------------------------------------
A lot of things wrong with society today are directly
attributable to the fact that the people who make the
laws are sexually maladjusted.
--
from "I Seem To Be a Verb" by R. Buckminster Fuller, 1970.
--------------3E99B56399324616CE5095E0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<blockquote TYPE=CITE>That's an interesing idea. Except that cookies
are usually limited to ~
<br>4000 characters on the client. You can't stuff much data into
4000
<br>characters. It'd be pretty neat, however. Care to try to
implement it?
<br>;-) If not Jerome, anyone else?
<br> </blockquote>
I just created a simple class with 20 integers, 20 floats, and 20 strings
of 48 characters each. Pickled, the object was 1358 characters long,
and run through zlib.compress, it was all of 382 bytes long. That
is an awful lot of data for only taking up less than 10% (compressed) of
the available storage in a cookie. Fill a file with 4000 characters
and see just how much stuff that is. You could also potentially work
out a mechanism so that the object gets split across multiple cookies if
it is too large. I don't think any browser has a limit on the number
of cookies settable by one site. I have attached my goofy test class,
just so you can see what it looked like.
<p>It probably isn't the cleanest solution, but it can certainly be made
to work. I think most applications wouldn't even need the compression
step. I've never actually used the CSM, just codeit's Session product,
so perhaps I am barking up the wrong tree...
<p>--sam
<pre>--
---------------------------------------------------------
A lot of things wrong with society today are directly
attributable to the fact that the people who make the
laws are sexually maladjusted.
--
from "I Seem To Be a Verb" by R. Buckminster Fuller, 1970.</pre>
</html>
--------------3E99B56399324616CE5095E0--
--------------C6CF158DC1345AFAE558E54D
Content-Type: text/plain; charset=us-ascii;
name="test.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="test.py"
class Test:
def __init__(self):
self.int0 = 34567
self.int1 = 12345
self.int2 = 34567
self.int3 = 34567
self.int4 = 34567
self.int5 = 34567
self.int6 = 34567
self.int7 = 34567
self.int8 = 34567
self.int9 = 34567
self.int10 = 34567
self.int11 = 12345
self.int12 = 34567
self.int13 = 34567
self.int14 = 34567
self.int15 = 34567
self.int16 = 34567
self.int17 = 34567
self.int18 = 34567
self.int19 = 34567
self.float0 = 34567.123
self.float1 = 34567.123
self.float2 = 34567.123
self.float3 = 34567.123
self.float4 = 34567.123
self.float5 = 34567.123
self.float6 = 34567.123
self.float7 = 34567.123
self.float8 = 34567.123
self.float9 = 34567.123
self.float10 = 34567.123
self.float11 = 34567.123
self.float12 = 34567.123
self.float13 = 34567.123
self.float14 = 34567.123
self.float15 = 34567.123
self.float16 = 34567.123
self.float17 = 34567.123
self.float18 = 34567.123
self.float19 = 34567.123
self.blah0 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah1 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah2 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah3 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah4 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah5 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah6 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah7 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah8 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah9 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah10 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah11 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah12 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah13 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah14 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah15 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah16 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah17 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah18 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
self.blah19 = "lksj lskj fdslkj lfdkj ldskj sfdlkj dslkj sfdlkj"
Python 1.5.2 (#1, Dec 8 1999, 21:20:51) [GCC 2.95.2 19991024 (release)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from test import Test
>>> blah = Test()
>>> import cPickle
>>> pkl = cPickle.dumps(blah)
>>> len(pkl)
1358
>>> import zlib
>>> item = zlib.compress(pkl)
>>> len(item)
382
>>> len(blah.blah0)
48
--------------C6CF158DC1345AFAE558E54D--