Hi, Take a look at the BannerAd ZClass: (http://www.zope.org/Members/lalo/BannerFolder) Updating the "hits"-property when the banner is loaded, has the effect, that the Banner-Object is backuped by the Zope magic, which is quite annyoing when having a high-traffic site. So, how can one generate volatile properties, which do not get backuped (I tried it whith _hits, but ZClasses do not likte them ;-) --> Zope Error). Is there a reason for not allowing _Variables in ZClasses and how does one solve the Problem in this case (seems like a generael problem) -- Tom Schwaller http://www.linux-magazin.de
On Tue, 2 Nov 1999, Tom Schwaller wrote:
Hi,
Take a look at the BannerAd ZClass: (http://www.zope.org/Members/lalo/BannerFolder)
Updating the "hits"-property when the banner is loaded, has the effect, that the Banner-Object is backuped by the Zope magic, which is quite annyoing when having a high-traffic site. So, how can one generate volatile properties, which do not get backuped (I tried it whith _hits,
At this point my suggestion would be to store them in an external file. I hope soon there would be a solution in terms of incorporating different ZODB stores into ZODB that do not keep version info. If someone has a better (and easy) alternative, I would like to know about it too. Pavlos
It's worse than that. Try hitting your banner ad more than once at the same time. You'll get requests failing due to Zope trying to update a single object with overlapping transactions. If you run the server in debug mode, you'll see the Z2 Conflict errors. Warning: don't trust Zope's error messages if you suspect you're getting conflicts. There's an open bug for Zope's apparently randomly chosen error messages to the browser when conflicts occur. Should be fixed in 2.1. Jim Fulton at Digicool might have some suggestions as to how to re-architect the product so that it doesn't suffer from conflicts. All I can think of is abandoning the ZODB for the hit counting functionality. Regards, Garth. -- <gtk@well.com>
On Tue, 2 Nov 1999, Tom Schwaller wrote:
Updating the "hits"-property when the banner is loaded, has the effect, that the Banner-Object is backuped by the Zope magic, which is quite annyoing when having a high-traffic site. So, how can one generate volatile properties, which do not get backuped (I tried it whith _hits, but ZClasses do not likte them ;-) --> Zope Error).
Is there a reason for not allowing _Variables in ZClasses and how does one solve the Problem in this case (seems like a generael problem)
_v_name volatile variables wouldn't work in this case anyway, as they are not shared between threads. What you want to do cannot be done with just ZClasses. Possible options are: Create an external method or product that has a global dictionary to store the results in. Note that code like '_hit{page} = _hit{page} + 1' is not atomic and it is theoretically possible for you to drop hits. Do it with a backend RDBMS via ZSQL Yes, Zope really needs volatile variables that are shared between threads (and ZEO processes). ___ // Zen (alias Stuart Bishop) Work: zen@cs.rmit.edu.au // E N Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au //__ Computer Science, RMIT WWW: http://www.cs.rmit.edu.au/~zen
Stuart 'Zen' Bishop wrote:
_v_name volatile variables wouldn't work in this case anyway, as they are not shared between threads.
What you want to do cannot be done with just ZClasses. Possible options are: Create an external method or product that has a global dictionary to store the results in. Note that code like '_hit{page} = _hit{page} + 1' is not atomic and it is theoretically possible for you to drop hits.
Do it with a backend RDBMS via ZSQL
That's what I do right now in my own setup, but for such a simple situtation I would prefer a pure Zope solution... :-) Remakr: I did some benchmarks (with "ab" from apache) to see how ZClasses and Zope/MYSQL pageviews compare (our newsflash in an old version and in a new ZClass version (some kmnn-ZClasse hack) to be precise, but both with the same content) and the Zope-Version was 3 times faster, which persuaded me to use the Zope ODB (and not a classical SQL-Database) in medium sized object-collections projects.
Yes, Zope really needs volatile variables that are shared between threads (and ZEO processes).
would be really nice... Maybe writing a small Python-class with _v_variables and deriving a Banner-ZClass from it would give a nice example. Playing with ZPickle could also be nice to here...... -- Tom
participants (4)
-
gtk -
Pavlos Christoforou -
Stuart 'Zen' Bishop -
Tom Schwaller