Hangfire: Port hangfire to Sqlite

Created on 22 Jun 2015  路  16Comments  路  Source: HangfireIO/Hangfire

I have seen both Postgres and Oracle implementations but didn't know if anyone would be interested in a Sqlite version. This would make using Hangfire in a Windows service more self-containted with no outside dependencies.

All 16 comments

the hangfire sqlserver storage is using dapper for its data access. dapper also supports sqlite, so this should be easy to implement. with this setup you can run an embedded database.

only change is to use the SqliteConnection instead of SqlConnection, define the SqliteOptions and maybe modify some queries.

i have started on a SQLite storage package.
https://github.com/vip32/Hangfire.SQLite/tree/master/src/Hangfire.SQLite

@bgiromini : want to join the effort?

@vip32 Let me check it out.

Hi @odinserj,

Was this one merged or just parked for now? There's no commits on @vip32 SQLite fork.
The NuGet package Hangfire.SQLite is also pointing to the different source so would be great to update docs so that there won't be confusion.

Cheers

i haven't been able to finish the sqlite fork, not sure if it will ever finish. however a rough 80% should be in there now...

Haven't seen that one before. It is on nuget https://www.nuget.org/packages/Hangfire.SQLite
Did you try it out already?

@vip32 actually repo by @wanlitao is source for Hangfire.SQLite nuget package.

@Serjster Unfortunately SQLite can't be used as a Hangfire persistence _db_. At least fully functional. I tested 1 Worker per queue which works fine. When it comes to having more then one worker concurrency issues occur.

that's interesting as sqlite is able to handle multiple threads, maybe an issue with the sql statements?
http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
or with the connection handling

@vip32 maybe there are. check @wanlitao's repo. I'm not aware of any kind of database(file)-wide lock in SQLite which will prevent different workers to pick same job.

Hangfire + SQLite is in a very confusing state. As noted above, the official extensions page adds to this confusion. It lists @vip32 as the author of the GitHub project Hangfire.SQLite, but the page templating makes the faulty assumption that the GitHub project name and the NuGet package are the same:

<a href="https://www.nuget.org/packages/{{ project.name }}/" target="_blank">

This results in linking to an entirely different Hangfire.SQLite NuGet package, backed by a different GitHub project by @wanlitao. I can't find a NuGet package based on @vip32's work.

Based on comments above and elsewhere, can I assume that SQLite storage is not production-ready?

@odinserj said:

Yep, there are Hangfire.SQLite and Hangfire.MemoryStorage, but I haven't tested them.

@vip32 said:

i haven't been able to finish the sqlite fork, not sure if it will ever finish. however a rough 80% should be in there now...

@AGRocks said:

Unfortunately SQLite can't be used as a Hangfire persistence db. At least fully functional. I tested 1 Worker per queue which works fine. When it comes to having more then one worker concurrency issues occur.

@stajs as far as I know its not. And considering supported nosql solutions it probably won't be ever prod ready.

@AGRocks Good to know, thanks.

at least mine is not finished or in a production ready state. alpha at least (due to lack of testing with concurrency and so). it should now be clear from the readme at least. also made PR to remove it from the extensions page. hope this makes things clear.

Thanks, I appreciate the clarity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nigel-dewar picture nigel-dewar  路  3Comments

shorbachuk picture shorbachuk  路  4Comments

cottsak picture cottsak  路  3Comments

plmwong picture plmwong  路  3Comments

jeffsugden picture jeffsugden  路  4Comments