Sessions are stored on the db.
I'm using postgresql, and this is part of my code on db.py model:

db = DAL('postgres://%s:%s@%s/%s' %(DB_USER, DB_USER_PASSWORD, DB_HOST, 
DB_NAME), lazy_tables=True)
session.connect(request, response, db=db, masterapp='init')

As you can see, I'm using masterapp parameter of the session.connect() 
method, because every one of my sites have two web2py applications that 
share sessions.
Having noticed that, I'm not shure if I have to run the sessions2trash.py 
script for both applications or just one of them. However I **think** this 
isn't relevant to the preformance problem. 



El viernes, 20 de marzo de 2015, 19:44:57 (UTC-3), Niphlod escribió:
>
> are sessions stored on files, db, memcache or redis ?
>
> On Friday, March 20, 2015 at 11:33:15 PM UTC+1, Lisandro wrote:
>>
>> I'm using we2py in production to serve about 15 websites, each one of 
>> them is served by it's own web2py installation.
>>
>> I want to clean up expired sessions every certain amount of time. To do 
>> that, I create a file under /etc/cron.d/ for every website. The file has 
>> the following content:
>>
>> MAILTO=root
>> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S init   -M 
>> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>> */60 * * * www-data nohup python /var/www/mywebsite/web2py.py -S panel  -M 
>> -R /var/www/mywebsite/scripts/sessions2trash.py -A -o
>>
>> As you can see, the cleaning is executed one per hour. I'm using two 
>> lines for each websites, because each website has two web2py applications 
>> running: "init" and "panel", so I clean up sessions of both of them. 
>>
>> The problem is that, if I activate those lines in cron configuration, 
>> every time they are executed I can see that memory usage of my sever goes 
>> "to the sky" (memory is all used and the server starts to swap), also the 
>> CPU load increases considerably, and during about 5 o 10 minutes, all the 
>> websites throw errors.
>>
>> If I execute those lines manually, they execute and finish instantly. I 
>> mean, there aren't too much sessions to cleanup, so the cleaning takes no 
>> more than a few seconds.  So I don't understand why the same process isn't 
>> working when called from cron. Any tip on this? Thanks in advance!
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to