Feature Wiki
Tabs
Using redis as an in Memory database for User Sessions
Page Overview
[Hide]1 Initial Problem
ILIAS currently stores all user sessions in the central ILIAS database. While this approach allows the php backends to be scaled horizontally to run ILIAS, it creates unnecessary load on the central database, which cannot simply be scaled horizontally. Above all, the procedure generates unnecessary update requests, which in the case of a redundant database must be replicated across all database nodes, which generates additional load due to its INSERT and UPDATE requests. To avoid the load problem, an alternative to the central database should be used as a storage location that is better suited for this type of data.
2 Conceptual Summary
In order to avoid unnecessary load on the ILIAS database we would like to introduce an in-memory database which holds the sessions more efficiently than the existing MYSQL ILIAS database. There are some in-memory databases which are well-suited for this type of scenario and better suited than a mysql database. One of them is redis. Our proposal is to set redis as an alternative database where sessions are stored.
The database which is used for session storage is defined in the client.ini.php. That means in order to change the saving-method of sessions a cli-update step is necessary.
client.ini.php:
[session]
expire = ${ILIAS_SESSION_LIFETIME}
redis_enabled = 1
redis_auth = 0
redis_host = ${REDIS_HOST}
redis_port = ${REDIS_PORT}
redis_password = ${REDIS_PASSWORD}
redis_database = ${REDIS_DATABASE}
Disadvantage: A central redis server is needed which is available from all php-backends of the ILIAS installation.
3 User Interface Modifications
3.1 List of Affected Views
- A new key-value pair in the ILIAS-administration is introduced which shows if redis or MYSQL is used for session management. This is a new key-value pair directly next to the central session administration (in user administration). Better place to show: In the general administration -> Server info.
3.2 User Interface Details
- see 3.1
3.3 New User Interface Concepts
- see 3.1
3.4 Accessibility Implications
- No accessibility implications
4 Technical Information
{ The maintainer has to provide necessary technical information, e.g. dependencies on other ILIAS components, necessary modifications in general services/architecture, potential security or performance issues. }
- If you want to use this feature you will have to (if you don't want to use this feature nothing of the following is necessary):
- Install a redis-server and open its 6379 port for your php-workers
- Adapt your client.ini.php
- Install the php-extension "php-redis" (https://github.com/phpredis/phpredis). Is usually included in the official repos
5 Privacy
There is no new data saved but the old session data is "migrated" from mysql to redis.
- Session ID
- Expires
- Data field
- ctime
- User-ID
- Last_reminds_ts
- type
- createtime
- remote_addr
- context
6 Security
{ Does the feature include any special security relevant changes, e.g. the introducion of new endpoints or other new possible attack vectors. If yes, please explain these implications and include a commitment to deliver a written security concept as part of the feature development. This concept will need an additional approvement by the JourFixe. }
- In order to use the redis database port 6379 on the redis host machine needs to ONLY be open for the ILIAS php workers.
7 Contact
- Author of the Request: Ulf Bischoff
- Maintainer: Per Pascal Seeland
- Implementation of the feature is done by: Ulf Bischoff
8 Funding
If you are interest in funding this feature, please add your name and institution to this list.
- …
9 Discussion
10 Implementation
{ The maintainer has to give a description of the final implementation and add screenshots if possible. }
Test Cases
Test cases completed at {date} by {user}
- {Test case number linked to Testrail} : {test case title}
Privacy
Information in privacy.md of component: updated on {date} by {user} | no change required
Approval
Approved at {date} by {user}.
Last edited: 9. Jul 2024, 16:03, Falkenstein, Rob [rob]