[Zope-dev] New Counter Product

Shaw, Howard ShawH@STHS.org
Wed, 24 Mar 1999 16:06:53 -0600


Read Paul's message in the Zope list. He pointed out that because the
ZODB uses a logfile structure (i.e. an append based mechanism where
changes are appended rather than overwritten) something such as a
counter which changes with each access will write to the database
(appending, not overwriting) with every access. On a site with enough
traffic to really warrant a counter, this could cause the database to
grow significantly in a short amount of time. Can you imagine the amount
of writing if the server got Slashdotted? Since my code uses Longs,
which are (I assume) stored as strings (since no binary format exists to
handle arbitrary lengths) wherefore a base count of 4000 hit by a
Slashdot effect resulting in a 1000 hits results in a minium addition to
the database of 4K. I am not sure that this is a significant amount, but
Paul seems to think it would be better if the hits were accumulated
before being written. This requires some place to temporarily store
data... persistently as far as memory is concerned, but not persistent
with regard to disk storage. The only way I can think to do this at the
moment is to create a persistent Product, and force some of its
attributes to fail to be seen by the persistence mechanism.

At this point, my primary question is how do I, within my own
__setstate__, call the original __setstate__? My guess is
Persistent.__setstate__ and pass self in manually, but I would welcome
advice.

Thanks again.

Howard C. Shaw III
Programmer/SysAdmin
St. Thomas High School


> ----------
> From: 	Mike Pelletier[SMTP:mike@compar.com]
> Sent: 	Wednesday, March 24, 1999 3:48 PM
> To: 	Shaw, Howard
> Subject: 	Re: [Zope-dev] New Counter Product
> 
> 
>     I don't understand...  Why does the underlying persitance
> mechanism matter
> at all?  And why do you want to not pickle certain instance
> attributes?  If I
> knew that, it would be much clearer to me.
> 
> Mike.
> 
> 
> -- 
>        ---              | Mike Pelletier             Work:
> 519-746-1607
>         /opeware!       | Software Developer         Home:
> 519-725-7710
>        ---              | mike@zopeware.com           Fax:
> 519-746-7566
> http://www.zopeware.com | Zopeware is not endorsed by Digital
> Creations
>