Hangfire+bootstrap Ace template for background task management platform

Source: Internet
Author: User

Objective

The front-end time has just begun to contact Hangfire translated an official tutorial [translation + Cottage]hangfire highlighter Tutorial, later in the work needs to implement an asynchronous and timed execution of the task management platform, combining bootstrap Ace templates and Hangfire are implemented. As follows:

Encounter the Pit

1.Hangfire Task persistence consumes performance

When the production environment is deployed, the database Hangfire related tables have been created manually, which may be ignored, and the site runtime is created, because the DBA gives the permissions without creating the error. The best solution is to give Hangfire a bigger set of permissions to create a management table.

Because of insufficient permissions to use (LOCALDB) \V11 access to the task persisted data, and then again, how to run the LocalDB? Here's a scenario localdb on how to successfully configure IIS, require permissions, and decisively give up. The task data can be persisted to the memory bar, smoothly on-line. A small number of tests did not find the problem, when I created 68W tasks, found that memory consumption 2.6g,cpu has been more than 80%. Originally thought so big memory is my job cause, first thought that if IIS restarts the task information can not continue is a big problem, so have to find operations to discuss the task related tables to create another one of our own management of the database (another machine). When the database connection is configured to re-add 68W tasks, it is found that the application server's memory is more than 300 m, the physical file of the task store database has more than 2G, and the CPU consumption of the database has risen a lot. this is realized that Hangfire's task persistence is very performance-intensive, but also fortunately there is no application data in a database.

2.Hangfire Dashboard Remote Access

By default, Hangfire only allows native access to dashboard, so once deployed on the server, you cannot view the status of the task in real time as if it were local. Solution permissions issues about Hangfire

3. Modify the number of retries and concurrency of the Hangfire

     // sets the number of attempts to hangfire after a job fails, the default value is ten             GLOBALJOBFILTERS.FILTERS.ADD (new3});             // set the number of Hangfire concurrent processing jobs, the default is the number            of CPUs var New Ten };            App. Usehangfireserver (options);

4. How to delete a task that is not performed

I haven't found a way.

The evils of Hangfire are only

0. Remotely view task execution status

1. Code exceptions You can view the stack directly from the dashboard panel

2. The task can have a return value, which can also be seen in the dashboard panel

3.hangfire support for multiple servers, not yet researched how to use, later use to supplement

Useful Links:

How long does it take to use Hangfire to know the job? Use Hangfire to work with non-synchronized tasks about Hangfire permissions issues

Hangfire+bootstrap Ace template for background task management platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.