How to configure MongoDB to store sessions accross server

71 views
Skip to first unread message

Khapare Joshi

unread,
Feb 8, 2016, 6:02:54 AM2/8/16
to mongodb-user
I am just a newbiew with Mongodb. We have been using memcache for long time to store user session. since we have a for application server i.e www but we only use one server to store users session (memcache).

I would like to use mongodb to store session in multiple server, in my case I have six web server and would like to store session accross these server. In other word, share / replicate users session accross the server. How Can I configure this with mongodb ?

K Joshi

Kevin Adistambha

unread,
Mar 1, 2016, 9:59:56 PM3/1/16
to mongodb-user

Hi Joshi,

Could you elaborate on a few things:

  • What is the goal of sharing the user sessions across 6 web servers; i.e., are you planning to give each web server a “local cache” of currently active sessions?
  • Are the 6 web servers located in geographically different site?
  • What is the expected read/write load of the user session database (e.g. read-heavy but light writes, equal read & write loads, or much more writes compared to reads)?
  • Are you planning to run the mongod process in each of the machine, i.e. will mongod and the application code run together within a single machine?

Best regards,
Kevin

Tim Hawkins

unread,
Mar 1, 2016, 10:07:14 PM3/1/16
to mongodb-user

What technology are you using to build your sites, for example there are several session store plug-ins for zend_framework  on php, ruby on rails and I belive for django on python.

Check out this Google search for many examples

https://www.google.com.ph/search?q=mongodb+session+store&oq=mongodb+session+store&aqs=chrome..69i57j0l3.4787j0j4&client=tablet-android-samsung&sourceid=chrome-mobile&ie=UTF-8

For those that ask, there reason for having shared session stores between multiple webserver is to support  random  request assignment between servers,  ie using a session Id in the url or a cookie, you can effectively shift sessions on the fly between machines. It's a common best practice for load distribution.

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/17e53eba-dc3d-4e33-a1c1-7b067174c1c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages