How to prevent performance issues from unbounded login history growth?
-
Our FusionAuth instance has accumulated a large volume of login history records over time. We currently have Login Record Settings configured with unlimited retention, and we've been advised that this unbounded growth could eventually impact system performance and stability.
What is the recommended approach for managing login history retention to maintain optimal performance? Is there a best practice retention period, and what should we expect when implementing a retention policy on an existing large dataset?
-
To prevent performance degradation from unbounded login history growth, you should configure a retention period in your Login Record Settings rather than keeping unlimited history.
Recommended Configuration
- Navigate to Settings → System → Advanced → Login Record Settings
- Enable auto-deletion of login records
- Set a retention period (365 days is a common best practice)
- Once configured, records older than your specified retention period will be removed on a rolling basis
What to Expect
- Zero downtime: This is a simple configuration change that does not require any system downtime
- Initial cleanup: After setting the retention period, FusionAuth will automatically delete existing records that exceed the retention threshold. Any existing login records older than the configured number of days become eligible for deletion based on this configuration — they are not grandfathered in.
- Rolling maintenance: Going forward, old records are automatically cleaned up, preventing the tables from growing indefinitely
Implementation Options
You can make this configuration change yourself during a convenient time. The change can be applied through:
- Admin UI: Navigate to Settings → System → Advanced → Login Record Settings
- System Configuration API: Use a
PATCHorPUTrequest to/api/system-configurationwith theloginRecordConfigurationsettings - Terraform: Configure the
login_record_configurationblock in your system configuration resource
This proactive maintenance helps ensure your FusionAuth instance remains performant as your user base and login volume grow over time.
Related Documentation
- Update System Configuration API - Request Body - Details on configuring login record retention via API, including the
loginRecordConfiguration.delete.enabledandnumberOfDaysToRetainparameters - Terraform System Configuration Resource - Configuration reference for managing login record settings with Terraform
- Search Login Records API - API for searching and paginating through login records
- Export Login Records API - API for exporting login records to CSV format
-
D dan has marked this topic as solved