Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hangfire Clean up #27

Open
adnan-kamili opened this issue Mar 4, 2022 · 8 comments
Open

Hangfire Clean up #27

adnan-kamili opened this issue Mar 4, 2022 · 8 comments

Comments

@adnan-kamili
Copy link

Please refer to the following at the bottom:

HangfireIO/Hangfire#1705

@ahydrax
Copy link
Owner

ahydrax commented Mar 5, 2022

Hi there,
Could you launch select count(*) from hangifre.[table_name] where expireat is null for the following tables: Counter, Job, Jobparameter, State?

@adnan-kamili
Copy link
Author

adnan-kamili commented Mar 7, 2022

Thanks for looking into this. Here are the results:

select count(*) from hangfire.counter where expireat is null : 202,560,245

select count(*) from hangfire.job where expireat is null: 1

I manually ran this to clean this up:

delete from hangfire.job where expireat is not null and expireat < now() otherwise it was 163 million.

select count(*) from hangfire.jobparameter // no expireat column: 163 ( I ran the delete query, previously it was 126 million)

select count(*) from hangfire.state // no expireat column: 537 ( I ran the delete query, previously it was189 million)

@adnan-kamili
Copy link
Author

select key, sum(value) from counter where key in (?, ?) group by key

The above query pushes the AWS Aurora Postgres to limits. Any query you suggest to cleanup this table?

@adnan-kamili
Copy link
Author

I ran this query to cleanup:

delete from hangfire.counter where key = 'stats:succeeded'

It took 15 mins.

And then:

delete from hangfire.counter where expireat is not null

Now it has only three rows

@ahydrax
Copy link
Owner

ahydrax commented Mar 7, 2022

Thanks for the info you provided!

What version of package do you use now?

@adnan-kamili
Copy link
Author

 <PackageReference Include="Hangfire.AspNetCore" Version="1.7.27" />
 <PackageReference Include="Hangfire.PostgreSql.ahydrax" Version="1.7.4" />

@adnan-kamili
Copy link
Author

Now, I see a new weird behaviour:

autovacuum: VACUUM hangfire.counter

is continuously timing out.

@ahydrax
Copy link
Owner

ahydrax commented Mar 7, 2022

It looks like autovacuum is enabled in AWS Aurora Postgres by default. You can try to launch it manually in query console.
My package doesn't call vacuum explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants