nodetool setauthcacheconfig
Cassandra 4.1+
This command is available in Cassandra 4.1 and later.
Modifies authentication cache configuration settings.
Synopsis
Section titled “Synopsis”nodetool [connection_options] setauthcacheconfig --cache-name <cache> [options]See connection options for connection options.
Description
Section titled “Description”nodetool setauthcacheconfig modifies the configuration of a specific authentication or authorization cache at runtime. This allows tuning cache behavior without restarting the node.
Non-Persistent Setting
Settings modified with this command are not persisted to configuration files. Changes will be lost on node restart. Update cassandra.yaml to make changes permanent.
Options
Section titled “Options”| Option | Description |
|---|---|
--cache-name <name> | Required. Cache to configure: CredentialsCache, PermissionsCache, RolesCache, or NetworkPermissionsCache |
--validity-period <ms> | Set cache validity period in milliseconds |
--update-interval <ms> | Set cache update interval in milliseconds |
--max-entries <n> | Set maximum cache entries |
--enable-active-update | Enable active update for the cache |
--disable-active-update | Disable active update for the cache |
Examples
Section titled “Examples”Increase Permissions Cache Validity
Section titled “Increase Permissions Cache Validity”nodetool setauthcacheconfig --cache-name PermissionsCache --validity-period 5000Set Larger Credentials Cache
Section titled “Set Larger Credentials Cache”nodetool setauthcacheconfig --cache-name CredentialsCache --max-entries 5000Tune Credentials Cache Settings
Section titled “Tune Credentials Cache Settings”nodetool setauthcacheconfig --cache-name CredentialsCache \ --validity-period 5000 \ --update-interval 3000 \ --max-entries 2000Fast Permission Propagation
Section titled “Fast Permission Propagation”# Shorter validity for quick permission changesnodetool setauthcacheconfig --cache-name PermissionsCache \ --validity-period 1000 \ --update-interval 500Enable Active Update
Section titled “Enable Active Update”# Enable background refresh before cache entries expirenodetool setauthcacheconfig --cache-name CredentialsCache --enable-active-updateWhen to Use
Section titled “When to Use”Performance Tuning
Section titled “Performance Tuning”# Reduce system_auth loadnodetool setauthcacheconfig --cache-name CredentialsCache --validity-period 30000Increase cache validity when:
- Authentication queries are causing high load
- system_auth keyspace is under pressure
- Quick permission propagation is not critical
Security Response
Section titled “Security Response”# Decrease validity for faster permission revocationnodetool setauthcacheconfig --cache-name PermissionsCache --validity-period 1000
# Invalidate existing cachenodetool invalidatepermissionscacheDuring security incidents, reduce cache validity to ensure permission changes take effect quickly.
High-Connection Scenarios
Section titled “High-Connection Scenarios”# Increase cache size for many concurrent connectionsnodetool setauthcacheconfig --cache-name CredentialsCache --max-entries 10000nodetool setauthcacheconfig --cache-name PermissionsCache --max-entries 10000When handling many concurrent authenticated connections, increase cache size to maintain hit rates.
Configuration Guidelines
Section titled “Configuration Guidelines”Update Interval vs Validity
Section titled “Update Interval vs Validity”The update interval should be less than the validity period:
# Good: Update happens before expirynodetool setauthcacheconfig --cache-name PermissionsCache \ --validity-period 5000 \ --update-interval 3000
# Bad: Update interval >= validity (no background refresh)nodetool setauthcacheconfig --cache-name PermissionsCache \ --validity-period 5000 \ --update-interval 6000Cache Sizing
Section titled “Cache Sizing”Calculate max entries based on:
- Expected concurrent authenticated users
- Number of distinct roles/permissions
- Memory available for caching
# For 5000 concurrent usersnodetool setauthcacheconfig --cache-name CredentialsCache --max-entries 6000nodetool setauthcacheconfig --cache-name RolesCache --max-entries 1000Best Practices
Section titled “Best Practices”Tuning Recommendations
- Start conservative - Begin with default values
- Monitor metrics - Track cache hit rates and latency
- Adjust incrementally - Make small changes and observe
- Document changes - Record why settings were modified
Important Considerations
- Changes apply only to the target node
- Run on all nodes for cluster-wide consistency
- Settings lost on restart unless also updated in
cassandra.yaml - Very short validity periods increase system_auth load significantly
Corresponding cassandra.yaml Settings
The configuration parameter names vary by Cassandra version:
| Cassandra Version | Parameter Pattern | Example |
|---|---|---|
| Pre-4.1 | *_validity_in_ms, *_update_interval_in_ms, *_cache_max_entries | credentials_validity_in_ms: 2000 |
| 4.1+ | *_validity, *_update_interval, *_cache_max_entries, *_cache_active_update | credentials_validity: 2s |
Pre-4.1 example:
credentials_validity_in_ms: 5000credentials_update_interval_in_ms: 3000credentials_cache_max_entries: 1000permissions_validity_in_ms: 5000permissions_update_interval_in_ms: 3000permissions_cache_max_entries: 1000roles_validity_in_ms: 5000roles_update_interval_in_ms: 3000roles_cache_max_entries: 10004.1+ example (with duration literals):
credentials_validity: 5scredentials_update_interval: 3scredentials_cache_max_entries: 1000credentials_cache_active_update: truepermissions_validity: 5spermissions_update_interval: 3spermissions_cache_max_entries: 1000permissions_cache_active_update: trueroles_validity: 5sroles_update_interval: 3sroles_cache_max_entries: 1000roles_cache_active_update: trueVerification
Section titled “Verification”After making changes:
# Verify new settingsnodetool getauthcacheconfig
# Monitor cache performancenodetool info | grep -i cacheRelated Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| getauthcacheconfig | View current settings |
| invalidatecredentialscache | Clear credentials cache |
| invalidatepermissionscache | Clear permissions cache |
| invalidaterolescache | Clear roles cache |