I am switching a Pyramid application's session configuration from cookie
to ext:memcached
. My application is hosted on Heroku and I have configured their memcache addon as per their documentation.
I understand from the Beaker documentation that specifying a session.lock_dir
is essential to preventing the dog pile effect. To be explicit: I must provide a file path to a directory. Beaker then uses this as some kind of lock to prevent multiple clients all trying to set the same value at the same time.
To me, this sounds like bad architecture. One of the primary advantages of memcache is that it works as a shared external service. Binding my application processes to a disk bound lock seems like the wrong approach.
Equally, on Heroku, I have one ephemeral filesystem per "dyno" (which I understand to mean per process). So whilst I can provide a lock_dir
directory path, if each process uses a different directory, then would this protect me from the dog pile effect?
I'm not sure whether I should:
- specify a lock_dir and not worry about it
- attempt to fork Beaker and patch this somehow
Plus I'd love to know what pattern other languages / frameworks use here. Is this just a Beaker problem or do other non-file-bound setups suffer from the dog pile effect?
Thanks in advance,
James.
lock_dir
, have you tried it without? – Augustinbeaker.ext.memcached
requires a lock_dir, when using any of the backends apart frommemory
orcookie
. My traceback here. – Sherelock_dir
. The traceback I posted is triggered by this code. I've come across this discussion of the same issue. Looks like the answer is: "specify a lock_dir and not worry about it". – Shere