CadyIO / hangfire-ravendb

RavenDB job storage for Hangfire
https://www.nuget.org/packages/Hangfire.Raven/
18 stars 35 forks source link

Improved implementation for RavenDB #9

Closed xinix00 closed 8 years ago

xinix00 commented 8 years ago
// Listen to the queues you actually use, else it fetches more than needed.
var options = new RavenStorageOptions()
{
   QueueNames = new[]
   {
      "listen_to_this_queue"
   }
};
GlobalConfiguration.Configuration.UseRavenStorage("http://ipaddress", "RavenDatabase", options);

Please be carefull:

AustinWinstanley commented 8 years ago

Nice. Has this been tested thoroughly? I am out of town right now and not able to test this myself. Can you confirm you've tested these changes well and used them?

xinix00 commented 8 years ago

I did test it, though you have to take a look at the embedded store and the dependency paths inside the solution file of hangfire.raven. My packages from nuget are 2 levels deeper (using it as submodule (in git) inside another project).

Also did not check the included example.

Running over a week now in a production environment, tested > 1,000,000 jobs.

Op vr 19 aug. 2016 17:33 schreef Austin Winstanley <notifications@github.com

:

Nice. Has this been tested thoroughly? I am out of town right now and not able to test this myself. Can you confirm you've tested these changes well and used them?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cady-io/hangfire-ravendb/pull/9#issuecomment-241051450, or mute the thread https://github.com/notifications/unsubscribe-auth/ADg577-Jz-UWxv6jSNGsjDVWfybiP5Zcks5qhcy1gaJpZM4JoSXB .

AustinWinstanley commented 8 years ago

Ok cool. Thanks. I'l take a look in a few days and run it through some testing and merge it if everything looks good. Thanks for the contribution!

xinix00 commented 8 years ago

Added a new commit finetuning jobdata inside the document, it was Serialized inside the database, bit unnecisary since RavenDB is using JSON as storage (so you had to do a double Deserialize (one from RavenDB, another inside the plugin Hangfire.Raven):

{
    "Job": {
        "Arguments": [
            {
                "$type": "Beta.Core.Import.EktExportJobContext, Beta.Core.Import",
                "Name": "EktExportPreOrder"
            }
        ],
        "Type": "Beta.Core.Import.Jobs.HangfireEktExportPreOrderJob, Beta.Core.Import, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
        "Method": "Beta.Core.Import;Beta.Core.Import.Jobs.HangfireEktExportPreOrderJob;Execute"
    },
    "Parameters": {
        "RecurringJobId": "\"Name|EktExportPreOrder\"",
        "CurrentCulture": "\"en-US\"",
        "CurrentUICulture": "\"en-US\""
    },
    "CreatedAt": "2016-08-21T21:25:00.4575755Z",
    "StateData": {
        "Name": "Succeeded",
        "Reason": null,
        "Data": {
            "SucceededAt": "2016-08-21T21:25:00.5668436Z",
            "PerformanceDuration": "62",
            "Latency": "46"
        }
    },
    "History": [
        {
            "StateName": "Succeeded",
            "Reason": null,
            "CreatedAt": "2016-08-21T21:25:00.6138186Z",
            "Data": {
                "SucceededAt": "2016-08-21T21:25:00.5668436Z",
                "PerformanceDuration": "62",
                "Latency": "46"
            }
        },
        {
            "StateName": "Processing",
            "Reason": null,
            "CreatedAt": "2016-08-21T21:25:00.4888510Z",
            "Data": {
                "StartedAt": "2016-08-21T21:25:00.4888510Z",
                "ServerId": "ww01-tilaa-ams:2620:c71d3fba-eb5d-4e90-9446-b16a905cbaae",
                "WorkerId": "ad2596dd-90ed-4f77-a10b-b74e929386a8"
            }
        },
        {
            "StateName": "Enqueued",
            "Reason": "Triggered by recurring job scheduler",
            "CreatedAt": "2016-08-21T21:25:00.4731037Z",
            "Data": {
                "EnqueuedAt": "2016-08-21T21:25:00.3949318Z",
                "Queue": "ekt_export_preorder"
            }
        }
    ]
}

Have to take a look at the serialized parameters, can also skip a round of extra Serialize / Deserialize. Any idea which service/backgroundjob is using "List"? It's the only unoptimized bit. Rewritten "Hash" / "Sets" / "Counters" / "Job" and ofcourse your DistributedLock to better accomodate the use of RavenDB.

sphiecoh commented 8 years ago

How far along is the testing of this ?

AustinWinstanley commented 8 years ago

Going to go ahead and merge it. Let me know if there any issues.

sphiecoh commented 8 years ago

build to nuget ?

On Fri, Sep 2, 2016 at 4:10 AM, Austin Winstanley notifications@github.com wrote:

Going to go ahead and merge it. Let me know if there any issues.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cady-io/hangfire-ravendb/pull/9#issuecomment-244265276, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPFoqd3u5OmbniKxNhxL_K6CERYWW3Mks5ql4WngaJpZM4JoSXB .

AustinWinstanley commented 8 years ago

Built with these changes and .Net Core support and pushed to Nuget

https://www.nuget.org/packages/Hangfire.Raven/2.0.0