Here are some advanced level approaches to manage the size of and to manipulate the Slurm
database directly on the Slurm
database.
Slurm
database size may grow significantly and quickly in some HPC setups. This is a problem if your space dedicated to Slurm
is limited for your workload or the same is applying to the analysis tools like XDMoD
. Please note the operations below will delete data and is indented for users who know what they are doing.
1. Analyze Database Size First, determine the size of each table within your slurm_acct_db
to identify potential bloat:
USE slurm_acct_db;
SELECT TABLE_NAME AS "Table",
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS "Size (MB)"
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "slurm_acct_db"
ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC;
2. Count Job Entries To monitor specific job types, use:
SELECT COUNT(*) FROM xxx_job_table WHERE job_name LIKE '%keyword%';
SELECT COUNT(*) FROM xxx_step_table WHERE step_name LIKE '%keyword%';
, replace xxx
with your own cluster name and the keyword
with the job name that you particularly search for. This helps in identifying trends and potential purge candidates.
3. Purge Specific Entries For cleaning up outdated or specific entries, execute:
/usr/bin/mysql -u root -p -Bse "USE slurm_acct_db; DELETE FROM xxx_job_table WHERE job_name LIKE '%keyword%';"
You can consider automating the cleanup process with cron jobs
to run during low-usage hours. Also regularly review and optimize indexes to enhance query performance and reduce space usage.
Precaution
Backup: Always ensure backups are taken before performing deletions to avoid data loss.