.net在多台服务器上共享的长时间运行任务 [英] .net long running tasks shared on multiple servers

查看:96
本文介绍了.net在多台服务器上共享的长时间运行任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我有一个asp.net Web应用程序,用户将从我的Web应用程序触发长时间运行的作业。

每个用户任务都将导致多个线程和长时间运行的资源饥饿任务。并且将从数据库中显示用户进度日志。

我希望我的工作服务器能够即插即用并共享/平衡负载。 我不希望单个服务器执行长时间运行的工作,我希望多个服务器执行它

最好的方法是什么?我知道我可以做所有的汇集并发明自己的方式,但让我听听你的经验!谢谢



我的尝试:



我见过像hangfire,windows服务等解决方案。

解决方案

您可以使用服务发现并启动多个进程。因此,从asp.net应用程序,您将检查服务发现并确定哪些服务可用,然后在获取此信息后,您将请求重定向到服务,而不是可用于处理请求(设置或获取所需信息)。



参考链接:横向缩放应用程序使用Proxy&服务发现 [ ^ ]



对于将处理此作业的应用程序,您需要确保它们在不再可用时注册Service Discovery和Unregister 。



如果您使用Service Discovery有任何限制,您可以依赖Message Queue



参考链接:水平扩展.net C#/ NodeJS,MongDB with Micro Services [ ^ ]

I have a scenario where i have a asp.net Web application and users will trigger long running jobs from my web app.
Each user task will lead to multiple threaded and long running resource hungry tasks. And user will be shown logs of progress from database.
I want my worker servers to be plug and play and share/balance the load. "I don't want single server to do the long running jobs, I want multiple servers doing it"
What would be the best way to approach this ? I know i can do all the pooling and invent my own way but let me hear your experience! Thanks

What I have tried:

I have seen solutions like hangfire, windows service etc. 

解决方案

You can use service discovery and spin up multiple processes. So from asp.net application you will check with service discovery and identify which all service are available then after getting this information you will redirect your request to service than is available to process a request (set or get required info).

Reference Link: Horizontal scaling application using Proxy & Service Discovery[^]

For an application which will process this job, you need to make sure they get registered with Service Discovery and Unregister when they are no longer available.

If you have any limitation using Service Discovery, you can depend on Message Queue

Reference link : Horizontal scaling .net C# / NodeJS, MongDB with Micro Services[^]


这篇关于.net在多台服务器上共享的长时间运行任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆