Skip to content

Commit 657bf2a

Browse files
Merge pull request #1115 from percona/PSMDB-1947-LDAP-User-Cache-Refresh-options
PSMDB-1947 LDAP User Cache Refresh options
2 parents 2a5bfa9 + abd4e0b commit 657bf2a

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

docs/authorization.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,51 @@ For example, to set the number of connections in the pool to 5, use the [setPara
120120
ldapConnectionPoolSizePerHost: 5
121121
```
122122

123+
124+
### LDAP cache refresh parameters
125+
126+
As of version 7.0.17-31, Percona Server for MongoDB introduces 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.
127+
128+
- `ldapUserCacheRefreshInterval` defines how often (in seconds) the server refreshes cached user information from LDAP **when interval-based refresh is enabled** (see `ldapShouldRefreshUserCacheEntries` below).
129+
130+
- `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`.
131+
132+
- `ldapShouldRefreshUserCacheEntries` selects the refresh strategy and has the following semantics:
133+
134+
- 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.
135+
136+
- 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`.
137+
138+
The default value is `false` (expiration-based invalidation using `ldapUserCacheInvalidationInterval`), to maintain backward-compatible behavior unless interval-based refreshing is explicitly enabled.
139+
140+
`ldapShouldRefreshUserCacheEntries` can only be set at startup. Interval parameters may be configured both at startup and during runtime.
141+
142+
!!! warning
143+
The default value will be changed to **true** in all major versions released after March 1, 2026.
144+
145+
=== "Runtime (setParameter)"
146+
147+
```{.javascript data-prompt=">"}
148+
> db.adminCommand({
149+
... setParameter: 1,
150+
... ldapUserCacheRefreshInterval: 300
151+
... })
152+
```
153+
154+
=== "Command line"
155+
156+
```bash
157+
mongod --setParameter "ldapUserCacheRefreshInterval=300" \
158+
--setParameter "ldapShouldRefreshUserCacheEntries=true"
159+
```
160+
161+
=== "Configuration file"
162+
163+
```yaml
164+
setParameter:
165+
ldapUserCacheRefreshInterval: 300
166+
ldapShouldRefreshUserCacheEntries: true
167+
```
123168
### Support for multiple LDAP servers
124169

125170
As of version 6.0.2-1, you can specify multiple LDAP servers for failover. Percona Server for MongoDB sends bind requests to the first server defined in the list. When this server is down or unavailable, it sends requests to the next server and so on. Note that Percona Server for MongoDB keeps sending requests to this server even after the unavailable server recovers.

0 commit comments

Comments
 (0)