I'm trying to understand better some of the tips for session optimisation. 
I've read the book and explored this group. Any improvements and 
corrections would be appreciated.

* It seems that web2py needs sessions most of them when users are logged 
in, if we're following recommendations for signed URLs etc. Also, disabled 
sessions means no CRUD according to the book, which presumably also rules 
out SQLFORM & family. 

So session.forget is a specific circumstance which is perhaps not so common.

* if a session is not changed, there is no write penalty, but this is only 
relevant whenever session.forget could have been used anyway. 

* Sessions can be stored on the filesystem (default) or in a database. 
the file system imposes locking which can block web2py if a user is doing 
several session-altering requests at the same time, most likely because of 
ajax use.
database sessions don't lock, which is an advantage. Or the ajax calls 
could do session.forget (but I suppose this wouldn't work if the ajax calls 
involved signed URLs)

On the pure comparison of filesystem vs database, I couldn't come to a 
conclusive answer from googling. I imagine an in memory DB will be faster, 
but a traditional database is going to end up as cached writes to the 
filesystem, I wonder if it can be faster (thinking of SQLSERVER Express 
edition, for example)

Also, using the filesystem for sessions can lead to a lot of files in a 
given directory which on some filesystems can be a problem (NTFS probably); 
web2py includes a session clean script to help with this.The script cleans 
up both filesystem and databaes sessions. It's possible to avoid all 
session files ending up in the same directory with the separate=True 
option, which distributes sessions between folders.

The ajax situation (avoiding locks) seems the biggest advantage to database 
sessions, unless you have access to a database which strongly outperforms 
the filesystem.



-- 
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/groups/opt_out.

Reply via email to