Skip to content

Commit 3b5ae11

Browse files
Merge pull request #1116 from percona/PSMDB-1947-8.0-LDAP-User-Cache-Refresh-options
PSMDB-1947-8.0-LDAP-User-Cache-Refresh-options
2 parents b012dfb + 53a1133 commit 3b5ae11

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

docs/authorization.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,79 @@ setParameter:
102102
ldapFollowReferrals: true
103103
```
104104
105+
### LDAP cache refresh parameters
106+
107+
As of version 8.0.20-8, Percona Server for MongoDB introduced parameters to optimize authentication performance and reduce unnecessary load on the LDAP server. These settings control how cached user information is refreshed, allowing administrators to fine-tune the balance between maintaining up-to-date user data and minimizing LDAP query overhead—especially in high-scale environments with many concurrent users.
108+
109+
- `ldapUserCacheRefreshInterval` defines how often (in seconds) the server refreshes cached user information from LDAP **when interval-based refresh is enabled** (see `ldapShouldRefreshUserCacheEntries` below).
110+
111+
- `ldapUserCacheInvalidationInterval` controls how long (in seconds) cached LDAP user entries remain valid before they expire and are evicted from the cache. If you do not set this parameter explicitly, Percona Server for MongoDB uses the built-in default for your version. This parameter applies when `ldapShouldRefreshUserCacheEntries` is set to `false`.
112+
113+
- `ldapShouldRefreshUserCacheEntries` selects the refresh strategy and has the following semantics:
114+
115+
- When set to `true`, each cached `$external` user is periodically re-fetched from the LDAP server at the interval defined by `ldapUserCacheRefreshInterval`. The cache is updated only if the user’s roles have changed; otherwise, existing entries remain untouched, ensuring no disruption. If a user no longer exists in LDAP, their cache entry is invalidated individually.
116+
117+
- When set to `false`, all `$external` users are evicted from the cache at intervals defined by `ldapUserCacheInvalidationInterval`. This preserves the behavior that existed prior to the introduction of `ldapUserCacheRefreshInterval` and `ldapShouldRefreshUserCacheEntries`.
118+
119+
The default value is `false` (expiration-based invalidation using `ldapUserCacheInvalidationInterval`), to maintain backward-compatible behavior unless interval-based refreshing is explicitly enabled.
120+
121+
`ldapShouldRefreshUserCacheEntries` can only be set at startup. Interval parameters may be configured both at startup and during runtime.
122+
123+
!!! warning
124+
The default value will be changed to **true** in all major versions released after March 1, 2026.
125+
126+
**Interval-based refresh** (`ldapShouldRefreshUserCacheEntries: true`):
127+
128+
=== "Runtime (setParameter)"
129+
130+
```{.javascript data-prompt=">"}
131+
> db.adminCommand({
132+
... setParameter: 1,
133+
... ldapUserCacheRefreshInterval: 300
134+
... })
135+
```
136+
137+
=== "Command line"
138+
139+
```bash
140+
mongod --setParameter "ldapUserCacheRefreshInterval=300" \
141+
--setParameter "ldapShouldRefreshUserCacheEntries=true"
142+
```
143+
144+
=== "Configuration file"
145+
146+
```yaml
147+
setParameter:
148+
ldapUserCacheRefreshInterval: 300
149+
ldapShouldRefreshUserCacheEntries: true
150+
```
151+
152+
**Expiration-based invalidation** (`ldapShouldRefreshUserCacheEntries: false`):
153+
154+
=== "Runtime (setParameter)"
155+
156+
```{.javascript data-prompt=">"}
157+
> db.adminCommand({
158+
... setParameter: 1,
159+
... ldapUserCacheInvalidationInterval: 30
160+
... })
161+
```
162+
163+
=== "Command line"
164+
165+
```bash
166+
mongod --setParameter "ldapUserCacheInvalidationInterval=30" \
167+
--setParameter "ldapShouldRefreshUserCacheEntries=false"
168+
```
169+
170+
=== "Configuration file"
171+
172+
```yaml
173+
setParameter:
174+
ldapUserCacheInvalidationInterval: 30
175+
ldapShouldRefreshUserCacheEntries: false
176+
```
177+
105178
### Connection pool
106179

107180
As of version 6.0.2-1, Percona Server for MongoDB always uses a connection pool to LDAP server to process bind requests. The connection pool is enabled by default. The default connection pool size is 2 connections.

0 commit comments

Comments
 (0)