You're right, it's 1 query per request more (2 if session is updated), but 
it's a pkey lookup (and eventually an update) vs scan a dir, open file, 
lock it, read it, (eventually save) and close it. 

Without available perftest I tend to agree that file-based session in 
separate folders is better for environment where web2py is launched on 
multiple machines against a single database server (as I intended your 
setup actually is), but for single instances with the application server 
being the same of the database server, I'd rather not place my bet.

BTW: I'm using postgres

PS: remember to trash expired session in any case

On Monday, July 16, 2012 8:52:13 PM UTC+2, Bruce Wade wrote:
>
> Storing them in the database will slow down your website depending on 
> which database, how many users and how many sessions you create. On a heavy 
> hit site the DB is going to slow down a lot.
>
> I am trying to figure out a way how to handle sessions on the client site 
> as secure as possible so the servers don't get hit hard
>
> On Mon, Jul 16, 2012 at 11:44 AM, Niphlod <niph...@gmail.com> wrote:
>
>> I'm storing sessions on database for my app with no apparent problems 
>> (1.99.7 stable).... for storing them in redis, currently there is no way 
>> (sorry). 
>> When I implemented cache in redis it seemed that I was the only one using 
>> a redis stack along web2py...generally redis adoption is quite sparse in 
>> web2py world, and the only implemented thing is the cache backend.
>> Anyway if there are demands in this sense, I could write something up, 
>> but some changes to how sessions are handled in web2py (namely in 
>> gluon.main.wsgibase) are needed.
>>
>>
>>
>>
>> On Monday, July 16, 2012 6:58:54 PM UTC+2, rochacbruno wrote:
>>>
>>>
>>> I tested putting sessions in database, but for some strange reason, when 
>>> sessions are in db, user are not redirect to login._next after the login, 
>>> and other issues. Also I think sessions in db gets a bit slower.
>>>
>>> I am planning to test sessions in redis.
>>>
>>>
>>> On Mon, Jul 16, 2012 at 1:01 PM, Bruce Wade <bruce.w...@gmail.com>wrote:
>>>
>>>> That I/o warning shouldn't take down your site I have the same issue 
>>>> with linode. I think sessions need to be done differently especially on 
>>>> high load sites with a load balancer sometimes I find over 400,000 files 
>>>> in 
>>>> the session folder on each server × 4
>>>>  On Jul 16, 2012 8:14 AM, "Bruno Rocha" <rochacbr...@gmail.com> wrote:
>>>>
>>>>> I am having a related problem.
>>>>>
>>>>> "Your Linode, blouserver, has exceeded the notification threshold 
>>>>> (1000) for disk io rate by averaging 1382.77 for the last 2 hours: 
>>>>>
>>>>> I receive this message every 2 hour, so my nginx get bas gateway and I 
>>>>> need to do "rm sessions/* " and also  "/etc/init.d/uwsgi restart" to get 
>>>>> the site running again.
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Jul 16, 2012 at 12:07 PM, Massimo Di Pierro <
>>>>> massimo.dipie...@gmail.com> wrote:
>>>>>
>>>>>> This may be related to a bug in rocket that was not catching 
>>>>>> timouterror and occasionally sending/receiving incomplete requests.
>>>>>>
>>>>>> Try upgrade rocket.py yo trunk. You can leave everything unchanged. 
>>>>>> Let us know if the error go away.
>>>>>>
>>>>>> It is also possible that the request is actually invalid (the browser 
>>>>>> declares a different size than it sends). Perhaps because of network 
>>>>>> issues. Perhaps web2py could report a better (clearer error). Do you 
>>>>>> think 
>>>>>> it should be logged or silently ignore and the request dropped?
>>>>>>
>>>>>> Massimo
>>>>>>
>>>>>>
>>>>>> On Monday, 16 July 2012 10:00:14 UTC-5, Bruce Wade wrote:
>>>>>>>
>>>>>>> I am using the latest stable still.
>>>>>>>
>>>>>>> On Mon, Jul 16, 2012 at 7:58 AM, Massimo Di Pierro <
>>>>>>> massimo.dipie...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Which web2py version? The error is from copying the request body 
>>>>>>>> into a tmp object in web2py. Looks like the request declares a size in 
>>>>>>>> the 
>>>>>>>> header but it is shorter (truncated).
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Friday, 13 July 2012 16:27:51 UTC-5, Brian M wrote:
>>>>>>>>>
>>>>>>>>> I'm having ongoing problems with IOErrors from one of my web2py 
>>>>>>>>> apps deployed on Windows with Apache & mod_wsgi.  Looks to me like 
>>>>>>>>> the 
>>>>>>>>> error maybe happening at a lower level before it even gets to my app 
>>>>>>>>> code?
>>>>>>>>>
>>>>>>>>> Traceback (most recent call last):
>>>>>>>>> File "C:\\dashboard\\web2py\\gluon\******\main.py", line 447, in 
>>>>>>>>> wsgibase
>>>>>>>>> parse_get_post_vars(request, environ)
>>>>>>>>> File "C:\\dashboard\\web2py\\gluon\******\main.py", line 275, in 
>>>>>>>>> parse_get_post_vars
>>>>>>>>> request.body = copystream_progress(request) ### stores request body
>>>>>>>>> File "C:\\dashboard\\web2py\\gluon\******\main.py", line 143, in 
>>>>>>>>> copystream_progress
>>>>>>>>> copystream(source, dest, size, chunk_size)
>>>>>>>>> File "C:\\dashboard\\web2py\\gluon\******\fileutils.py", line 
>>>>>>>>> 374, in copystream
>>>>>>>>> data = src.read(size)
>>>>>>>>> IOError: request data read error
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> -- 
>>>>>>> Regards,
>>>>>>> Bruce Wade
>>>>>>> http://ca.linkedin.com/in/**bruc**elwade<http://ca.linkedin.com/in/brucelwade>
>>>>>>> http://www.wadecybertech.com
>>>>>>> http://www.fittraineronline.**co**m<http://www.fittraineronline.com>- 
>>>>>>> Fitness Personal Trainers Online
>>>>>>> http://www.warplydesigned.com
>>>>>>>
>>>>>>>
>>>>>  
>>>  -- 
>>  
>>  
>>  
>>
>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

-- 



Reply via email to