Ruby Forum Rails deployment > Excessive sessions

Posted by Greg Willits (-gw-)
on 28.04.2008 20:23
One of the negative side effects of using the classic monit /
mongrel_cluster stack with a URL poll by monit is that Rails generates a
session for every connection. This session is pretty much useless, and
in my case is detrimental to data mining of session activity.

At this point I am likely to look into the new mod_rails, but I am
wondering if there's any possible way to have external monitors (be it
monit, load balancers, etc) ping a Rails page to verify service, and yet
_not_ create a session? Due to number of apps & Rails instances, I end
up with 10's of thousands of dummy sessions per day.

I can provide config setup details, if that's necessary to determine
options, but essentially I have monit call upon a
/public/monit_check.txt file that has no content. this is apparently
enough to still trigger a session via application.rb ?

Rails 1.2.6, OS X Server 10.5.

Thanks.

-- gw
Posted by Pat Allan (Guest)
on 29.04.2008 00:22
(Received via mailing list)
Hi Greg

My approach with Monit and sessions was to create a specific
controller & action to poll, and turn sessions off for it.

http://pastie.textmate.org/188359

It does feel like overkill, mind you, and I'm a little surprised that
calling a static file (which is a more elegant solution) creates a
session.

--
Pat
e: pat@freelancing-gods.com    || m: 0413 273 337
w: http://freelancing-gods.com || p: 03 9386 0928
discworld: http://ausdwcon.org || skype: patallan
Posted by Greg Willits (-gw-)
on 29.04.2008 00:35
Pat Allan wrote:
> My approach with Monit and sessions was to create a specific
> controller & action to poll, and turn sessions off for it.
> http://pastie.textmate.org/188359
> It does feel like overkill, mind you, and I'm a little surprised that
> calling a static file (which is a more elegant solution) creates a
> session.

I figured something like that but wasn't sure of the details to pare it 
down to the bare essentials. Your code will help. Thanks, I'll see if 
that cures it.

-- gw

Posted by Aníbal Rojas (Guest)
on 30.04.2008 12:46
(Received via mailing list)
Greg, Pat,

Most people just use a cron job to clean up old sessions, we usually
set it up to run every 15 minutes, how long will you let your sessions
live is up to your business needs.

Take a look at:

http://railsexpress.de/svn/plugins/sql_session_store/trunk/

And remember that Rails 2 default session store is cookie.

I would recommend changing your front end (Apache, Lighttpd, Nginx)
configuration to serve directly the stuff under public/ without
passing the request to the backend rails processes (mongrels, thins,
etc).

--
Aníbal Rojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com

On Apr 29, 5:35 pm, Greg Willits <ruby-forum-incom...@andreas-s.net>
Posted by Andreas S. (andreas)
on 02.05.2008 20:07
Greg Willits wrote:
> One of the negative side effects of using the classic monit /
> mongrel_cluster stack with a URL poll by monit is that Rails generates a
> session for every connection. This session is pretty much useless, and
> in my case is detrimental to data mining of session activity.

Take a look at 
http://rails.lighthouseapp.com/projects/8994/tickets/92-feature-more-efficient-session-handling 
and http://code.google.com/p/rails-fast-sessions/.