Thanks Bernd for giving detailed answer and suggestions.

>  it is the case ... there are two workarounds imho
>
>  1.
>  don't write to the session if it does not change, so if you do an
>  apache bench without sending the client id cookie, a write is done on
>  each request
>
>  additionally every anonymous visit writes to zodb, you should avoid
>  this by using default values if no session data is available
>
>  in earlier versions of zope the __getitem__ method created a btree at
>  first access, but this should be fixed now, so it depends on the
>  version of zope u use, if you have an older version then you can't
>  even look if data is there without writing to zodb
>

Yes. I looked into the zope.session code. The __getitem__ method will
create new session data if the session package key is not found. On
the other hand, the get method does not create session data. So
changing my code from

ISession(request)['myapplication']

to

ISession(request).get('myapplication')

avoids the problem of new session data being created at each anonymous request.

>  2.
>  my recommendation is to use memcached for session data ... take a look
>  at http://svn.zope.org/repos/main/lovely.memcached/trunk
>

Yes, I think this would be the more decent solution for server side
session data storage for zope3.

-- 
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to