RecurringJob delay so much time

platform:.net7, docker, k8s environment. use mysql storage.
Each run of a scheduled job is delayed by tens of seconds to several minutes。

<PackageReference Include="Hangfire" Version="1.8.0" />
    <PackageReference Include="Hangfire.AspNetCore" Version="1.8.0" />
    <PackageReference Include="Hangfire.Core" Version="1.8.0" />
    <PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
    <PackageReference Include="Hangfire.HttpJob" Version="3.7.6" />
    <PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />
    <PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
builder.Services.AddHangfire(configuration => configuration
    .SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
    .UseSimpleAssemblyNameTypeSerializer()
    .UseRecommendedSerializerSettings()
    .UseStorage(new MySqlStorage(config.GetConnectionString("Hangfire"),
        new MySqlStorageOptions
        {
            TransactionIsolationLevel = IsolationLevel.ReadCommitted,
            QueuePollInterval = TimeSpan.FromSeconds(15),
            JobExpirationCheckInterval = TimeSpan.FromHours(1),
            CountersAggregateInterval = TimeSpan.FromMinutes(5),
            PrepareSchemaIfNecessary = true,
            DashboardJobListLimit = 50000,
            TransactionTimeout = TimeSpan.FromMinutes(1),
            TablesPrefix = "Hangfire"
        })).UseHangfireHttpJob());
RecurringJob.AddOrUpdate("ScheduleConsole", () => Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")), Cron.Minutely);

Successed Jobs in the dashboard:

|Id|Job|Total Duration|Succeeded|
|#25|Console.WriteLine|7.315s|05/11/2023 02:15:35|
|#24|Console.WriteLine|14.442s|05/11/2023 02:13:35|
|#23|Console.WriteLine|6.880s|05/11/2023 02:11:19|
|#22|Console.WriteLine|13.923s|05/11/2023 02:09:19|
|#21|Console.WriteLine|6.075s|05/11/2023 02:07:04|
|#20|Console.WriteLine|12.351s|05/11/2023 02:05:48|
|#19|Console.WriteLine|1.967s|05/11/2023 02:02:33|
|#18|Console.WriteLine|8.658s|05/11/2023 02:01:17|
|#17|Console.WriteLine|164ms|05/11/2023 01:58:18|
|#16|Console.WriteLine|291ms|05/11/2023 01:57:03|
|#15|Console.WriteLine|14.410s|05/11/2023 01:54:17|
|#14|Console.WriteLine|8.555s|05/11/2023 01:52:46|
|#13|Console.WriteLine|13.239s|05/11/2023 01:50:01|
|#12|Console.WriteLine|1.043s|05/11/2023 01:47:45|
|#11|Console.WriteLine|9.388s|05/11/2023 01:46:30|
|#10|Console.WriteLine|12.933s|05/11/2023 01:43:45|
|#9|Console.WriteLine|7.980s|05/11/2023 01:42:14|
|#8|Console.WriteLine|8.914s|05/11/2023 01:39:14|
|#7|Console.WriteLine|1.997s|05/11/2023 01:37:44|
|#6|Console.WriteLine|14.102s|05/11/2023 01:35:13|
|#5|Console.WriteLine|8.028s|05/11/2023 01:33:43|
|#4|Console.WriteLine|7.089s|05/11/2023 01:31:27|
|#3|Console.WriteLine|13.455s|05/11/2023 01:29:27|
|#2|Console.WriteLine|10.054s|05/11/2023 01:26:27|
|#1|Console.WriteLine|6.701s|05/11/2023 01:25:11|

the interval in the dashborad result at which it runs is not expected, all succeeded Jobs delay so much time。what was wrong with my codes?


The data of column ‘Total Duration’ and ‘Succeeded’ is not expected.
When I switched to UseMemoryStorage, the result is ok.

Scheduling a job doesn’t mean it will run at that time. It means it won’t be considered part of the queue until that time. If there are other jobs in the queue, your scheduled job may not execute until those jobs are processed.

You may want to the load on your database if your simple jobs are taking 10 seconds. You are also not polling frequently enough to for the job to process on the time it is scheduled. If you need precise scheduling I would suggest something that runs in memory and is not relying on a queue.