Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session garbage collection configuration #8053

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/_includes/config/locate-session.md
Expand Up @@ -27,3 +27,24 @@ The preceding example stores session files in `/var/www/session`
### `php.ini` example {#session-where-phpini}

As a user with `root` privileges, open your `php.ini` file and search for the value of `session.save_path`. This identifies where sessions are stored.

## Garbage collection configuration {#session-gc}

To clean up expired sessions Magento application calls `gc` (_garbage collection_) handler randomly according to probability which is calculated by `gc_probability / gc_divisor`. For example, if we set these directives to `1/100` respectively, it means a probability of `1%` (_probability of one call of garbage collection per 100 requests_).
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

The garbage collection handler uses the `gc_maxlifetime` directive - the number of seconds after which the sessions will be seen as _garbage_ and potentially cleaned up.
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

On some operating systems (Debian/Ubuntu) `session.gc_probability` set to `0` by default, and the garbage collection handler will never be executed.
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

`session.gc_` directives from the `php.ini` file can be overwritten in `<magento_root>/app/etc/env.php`:
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved

```php
'session' =>
array (
'save' => 'db',
'gc_probability' => 1,
'gc_divisor' => 1000,
'gc_maxlifetime' => 1440
),
```
The configuration depends on the traffic and specific needs of a certain Magento application.
jeff-matthews marked this conversation as resolved.
Show resolved Hide resolved