[Mongrel] Recommentation: Sessions and PStore
joeat303 at yahoo.com
Sat Sep 9 13:58:25 EDT 2006
Uh oh! I'm sort of guilty of both #1 and #2! I'm not
having any performance problems, but...
I've been using the file store for sessions -- how
much faster is using the database or memcached? I
always thought files were quicker than the db
(especially since each session gets its own file).
I've been sticking the member object in a session when
they login, and only updating it if they change their
info. I was using the same assumption that files were
quicker than the db.
1) DON'T USE PSTORE AS A SESSION STORE!
All of the people who had Mongrel processes going
locking, or just generally doing bad things had a
pstore as their
session storage option. What happens is the pstore
isn't that great
when multiple processes access it, and if one Mongrel
pulling an object from the pstore then it'll explode.
Use the file
store when you develop, and use the database or
memcached store in
You should also be looking for other ways processes
resources when they lock up or do weird things. Try
running with just
one process, and if you don't have any problems then
it's a resource
locking problem (most likely).
2) DON'T STORE COMPLEX OBJECTS IN THE SESSION!
This especially goes for you Java people who think the
session store is
a temporary database. The session really only works
for simple types
like integers, strings, etc. You *must* follow the
mantra of "Share
Nothing" and either store everything in the database
or use form fields
and GET parameters to make it stateless. As I've said
rails-core don't do it, you don't do it." Rails-core
does not do this.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Mongrel-users