Impact of auto cleanup on Lightningd SQLite3: growth slowdown
The Lightning CLI changed the rules of the game for the Bitcoin network, allowing users to create and manage Lightning Network nodes. One of the key features that enables this functionality is the auto-clean-once mechanism, which periodically cleans up stale data to maintain node performance and security. However, some users have reported unusual behavior when using the autoclean-once command.
Problem: Automatic cleaning without vacuuming
When running lightning-cli autoclean-once
, there are two different outcomes depending on whether vacuum is used or not:
- Vacuumed Out: If the autoclean-once command uses the
--vacuum
flag, it will try to clean up stale data in the SQLite database. In this case, if lightningd.sqlite3 is upgraded and new data is added, it can result in a significant slowdown.
- Non-Vacuumed Out
: If no vacuum is used (
autoclean-once --
), the autoclean-once command will only clean out stale data that has not changed since the last upgrade. In this scenario, lightningd.sqlite3 should continue to grow and update at a normal pace.
Problem: Slowing Growth
The problem is due to the way autoclean-once' handles upgrades and new data added to the SQLite database. Although it is intended to clean up stale data, some users have reported that automatic cleaning without vacuum can slow down the growth of lightningd.sqlite3. This slowdown is likely due to the increased time required to upgrade and update the database.
Conclusion
The autoclean-once mechanism plays a key role in maintaining the performance and security of a node on the Lightning network. However, using it without vacuum can lead to significant growth slowdowns, especially during times of high activity or when new data is added to the SQLite database. To avoid this issue, users should opt for the–vacuumflag when running autoclean-once.
Recommendation
To reduce the impact of autoclean-once on lightningd.sqlite3 growth, use the–vacuumflag whenever possible:
- Use the following command:lightning-cli autoclean-once –vacuum`
- Avoid using the default behavior (‘autoclean-once’ without vacuum)
- Regularly check for SQLite database updates and consider upgrading when necessary
By taking this precaution, users can ensure optimal performance and growth for their Lightning Network nodes.