Fire and forget job parallel execution

Hi,
We need to execute 4 parallel jobs using the Fire and Forget job, but the processing seem in serial mode job by job (no parallel execution !)

Here my code

        // init
        var options = new SQLiteStorageOptions();

        GlobalConfiguration.Configuration.UseSQLiteStorage("SQLiteHangfire", options);
        var option = new BackgroundJobServerOptions
        {
            WorkerCount = Environment.ProcessorCount * 5,
            ServerName = Environment.MachineName + "." + GetMac() // Nom unique !
        };
        app.UseHangfireServer(option);
        app.UseHangfireDashboard();

        //  Adding the jobs 

        BackgroundJob.Enqueue(() => Job(1));
        BackgroundJob.Enqueue(() => Job(10));
        BackgroundJob.Enqueue(() => Job(100));
        BackgroundJob.Enqueue(() => Job(1000));


   // and my job Method is


    public void Job(int id)
    {
        // Processing
        Thread.Sleep(TimeSpan.FromMinutes(10));
    }

Please help

Thanks

I’d rather surprised it worked at all.

SQLite is designed to be lightweight and support concurrent reading, but totally sucks at concurrent writing. When writing, the writer holds exclusive database lock. Hangfire, on the other hand, opens at least one connection per executing job, and they all need to access DB.

If you want performance and concurrency, there’s plenty other databases to consider. Why not to use something more suitable for your task?

Hello,
Thanks for your Help
Yes, i switched to a real DBMS (PostgreSQL) and now good processing !