Hardik
Hardik

Reputation: 3895

Is there a limit in Rails for maximum number of sessions?

I am using Rails 4.2.7.1, and MySQL to store the sessions.

One of my colleagues told me that there is a limitation on the maximum number of sessions that can be supported by Rails, but I couldn't find a reference to this subject.

Is there a maximum number of sessions supported by Rails?

Upvotes: 0

Views: 871

Answers (1)

ehoffmann
ehoffmann

Reputation: 798

If you are using MySQL as a session store, all your session data exists in serialized form in the database:

mysql> desc sessions;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | int(11)      |      | PRI | NULL    | auto_increment |
| session_id | varchar(255) | YES  | MUL | NULL    |                |
| data       | text         | YES  |     | NULL    |                |
| updated_at | datetime     | YES  |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)

The maximum number of sessions, not the individual session size, is actually limited by the number of rows per table in the MySQL database -- which is quite huge -- or by your disk space but not by Rails itself.

See "Maximum number of records in a MySQL database table" for more information.

Upvotes: 2

Related Questions