[英]Running task as windows service out of band of iis
We have a web app in which a request for a long running or high processor process is called. 我们有一个Web应用程序,其中调用了长时间运行或处理器运行速度较高的请求。
We want to create a windows service to off-load this from the IIS servers. 我们要创建一个Windows服务,以从IIS服务器上卸载该服务。 We will install this service on multiple machines to lower the wait time for these jobs. 我们将在多台计算机上安装此服务,以减少这些作业的等待时间。 One idea we are looking at is serializing the Job
object into Sql Server with its JobType
as another column. 我们正在考虑的一个想法是将Job
对象序列化为Sql Server,并将其JobType
作为另一列。
The job service will claim the job by updating the row with its indicator, this will keep other services from picking it up. 作业服务将通过使用其指示器更新该行来声明该作业,这将防止其他服务选择该作业。 Once the job is complete the service removes that entry. 作业完成后,服务将删除该条目。
What I am looking for is other, possibly better ideas to accomplish the Job Service Queuing. 我正在寻找的是其他可能更好的想法来完成作业服务排队。
I would say this is a great way to handle this issue. 我会说这是处理此问题的好方法。 The only thing I would add is that while I don't know what the Job object is or how it is created, you might be able to offload this as well. 我唯一要添加的是,尽管我不知道Job对象是什么或如何创建它,您也可以卸载它。 Instead of creating the object and serializing it to the database, simply store the raw data in SQL. 无需创建对象并将其序列化到数据库,只需将原始数据存储在SQL中即可。 Let the Services handle building the Job object themselves from the ground up. 让服务自己从头开始构建Job对象。 That way you cut the serialization out of the mix. 这样,您就可以避免序列化了。 However, if this isn't possible, I would say that your solution seems to be the most viable. 但是,如果这不可能,那么我想说您的解决方案似乎是最可行的。
If you do go this route, you could look into optimization of your Service offloading. 如果您采用这种方法,则可以考虑优化服务分流。 For example, you could wake extra services when the load gets busy and then put some to sleep when the load lightens. 例如,您可以在负载繁忙时唤醒额外的服务,然后在负载减轻时使某些服务进入睡眠状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.