On 15 Feb 2011, at 03:03, Jimmy wrote:

 config.action_controller.session_store = :active_record_store

However, when hitting our system with say 10,000 API requests, we get
10,000 session objects in the database. Which seems like a big waste
of resources.

Is there a way to prevent this?

Basically we want API requests to start with an empty in-memory-only
session hash which is dropped after the request finishes. Somewhat
related, we also don't want to return an HTTP Header Set-Cookie:
_session_id=...etc.

Seems to me like you have no need for sessions at all, since you don't want the session cookie set.

In your API controller, just put "session :disabled => true" on top.

If you do need sessions, I would suggest just skipping the active record store sessions completely and either moving on to the cookiebased store or a memcache store (which will automatically drop sessions once it hits the memory treshold iirc).


Best regards

Peter De Berdt

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to