Thanks Niphlod, and Paolo too. With your last comments I understand a
little better. Sorry about the web2py / nginx confusion. I know I'm going
way beyond my limits, but for now there's no budget for more :(
I understand a bit more about the problem of caching in memory when there
are multiple processes. Niphlod, based on your last sentence, I did a quick
test (a test that I've sould done previously) and changed cache.ram to
cache.disk, and it started working, as it would be expected.
So, instead of memcache, I read a little about redis, and I decided to give
it a try.
The installation was easy:
sudo apt-get install redis-server
sudo apt-get install python-redis
Then, somewhere in model file:
from gluon.contrib.redis_cache import RedisCache
cache.redis = RedisCache('localhost:6379',db=None, debug=True,
with_lock=True)
cache.ram = cache.disk = cache.redis
This was the first quick test and it worked ok.
I've used with_lock=True because of the comment of the book:
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Caching-with-Redis
I'll try on production and see what happens with performance and resource
usage.
Thank you both for the help!
https://groups.google.com/forum/#!searchin/web2py/share$20processes/web2py/6B3d_M0z9yQ/mJvr5qMNDhkJ
El miércoles, 20 de mayo de 2015, 12:03:30 (UTC-3), Niphlod escribió:
>
> haaaaalt!. Either you use web2py (and we can help with that) OR nginx (and
> you'll need to cfr THEIR support for a proper config).
> There's no facility whatsoever for web2py to cache the object and for
> nginx to fetch it from the same memcached instance.
>
> That being said, using cache.ram in multiprocess environment is OF COURSE
> pitfalled because each process would be need to be hit the first time, so
> what you're observing with cache.ram is entirely expected.
>
> Once you choose to store the cached object in some external backend (disk,
> redis, memcache), the "pitfall" is closed, but you don't need any
> additional nginx configuration.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.