# Excessive sessions

**URL:** <https://www.ruby-forum.com/t/excessive-sessions/136084>\
**Category:** Deployment\
**Created:** [April 28, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/excessive-sessions/136084 "2008-04-28T20:23:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 28, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/excessive-sessions/136084/1 "2008-04-28T20:23:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 29, 2008, 12:22am UTC](https://www.ruby-forum.com/t/excessive-sessions/136084/2 "2008-04-29T00:22:17Z")

</div>

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](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: removed\_email\_address@domain.invalid || m: 0413 273 337  
w: [http://freelancing-gods.com](http://freelancing-gods.com) || p: 03 9386 0928  
discworld: [http://ausdwcon.org](http://ausdwcon.org) || skype: patallan

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 29, 2008, 12:35am UTC](https://www.ruby-forum.com/t/excessive-sessions/136084/3 "2008-04-29T00:35:05Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [May 2, 2008, 8:07pm UTC](https://www.ruby-forum.com/t/excessive-sessions/136084/4 "2008-05-02T20:07:21Z")

</div>

Greg W. 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](http://rails.lighthouseapp.com/projects/8994/tickets/92-feature-more-efficient-session-handling)  
and [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/rails-fast-sessions/).

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [April 30, 2008, 12:46pm UTC](https://www.ruby-forum.com/t/excessive-sessions/136084/5 "2008-04-30T12:46:58Z")

</div>

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/](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

> **[Home - Has Many Developers](https://hasmanydevelopers.com/)**
>
> We are the best choice for your building design and development

> **[RUBYCORNER.COM](https://www.rubycorner.com/)**
>
> RUBYCORNER.COM - Contact us for any business inquiries

[http://anibal.rojas.com](http://anibal.rojas.com)

On Apr 29, 5:35 pm, Greg W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
