I'm developing the backend server for a turn based game using App Harbor and thus far it seems perfectly suited to my needs. I would really like to run a background process to process turn data etc and I was wondering if someone could clarify what the difference between 'Web workers' and 'Background workers' are? I have fairly limited experiance with web development, but as far as I can tell 'Web workers' are for interacting with AJAX pages (which I don't need) and 'Background workers' allow you to run a console application in the background (which I do need!)
我正在开发使用App Harbor进行回合制游戏的后端服务器,到目前为止它似乎非常适合我的需求。我真的想运行一个后台流程处理转弯数据等,我想知道是否有人可以澄清“网络工作者”和“背景工作者”之间的区别是什么?我对Web开发的实验相当有限,但据我所知,'Web worker'用于与AJAX页面交互(我不需要),'后台工作者'允许您在后台运行控制台应用程序(我需要的!)
Thanks!
2 个解决方案
#1
5
Web workers is connected with the request from browser and can get and send data to the request on browser.
Web worker与浏览器的请求相关联,可以在浏览器上获取和发送数据到请求。
Background Workers are independent threads that are not connected with any request and can not send data to the browser alone*.
后台工作程序是独立的线程,不与任何请求连接,不能单独向浏览器发送数据*。
[*] Only through a web worker.
[*]只能通过网络工作者。
#2
4
In general 'Web worker' is the web application, or the ASP.NET site/service that handles requests from user. 'Background worker' is simply a scheduled task. It runs in background, on specified intervals, and executes some code.
通常,“Web worker”是Web应用程序,或处理来自用户请求的ASP.NET站点/服务。 '后台工作者'只是一个预定的任务。它在后台运行,按指定的时间间隔运行,并执行一些代码。
The difference is that a Web worker does some work when a new request comes to the application. A request means someone loads a page/calls a web service on ASP.NET. While the background worker is being started on some interval, and doesn't need a user to load a page to be executed. It is mostly used for processing long-running tasks. The usual workflow is - the web worker receives a request from the user, and queues some data to be processed. On next run, the background worker gets the data and processes it, and stores the data somewhere(usually in database). Then the web worker, on next request from user, checks the database and if the result is there - shows it to the user.
不同之处在于,当新请求到达应用程序时,Web worker会执行某些操作。请求表示有人在ASP.NET上加载页面/调用Web服务。虽然后台工作程序在某个时间间隔内启动,但不需要用户加载要执行的页面。它主要用于处理长时间运行的任务。通常的工作流程是 - Web工作者接收来自用户的请求,并将一些数据排队以进行处理。在下一次运行时,后台工作程序获取数据并对其进行处理,并将数据存储在某处(通常在数据库中)。然后,Web工作者在用户的下一个请求中检查数据库以及结果是否存在 - 将其显示给用户。
This way the user doesn't need to wait for the asp.net page to process the data and return a result immediately.
这样,用户无需等待asp.net页面处理数据并立即返回结果。
#1
5
Web workers is connected with the request from browser and can get and send data to the request on browser.
Web worker与浏览器的请求相关联,可以在浏览器上获取和发送数据到请求。
Background Workers are independent threads that are not connected with any request and can not send data to the browser alone*.
后台工作程序是独立的线程,不与任何请求连接,不能单独向浏览器发送数据*。
[*] Only through a web worker.
[*]只能通过网络工作者。
#2
4
In general 'Web worker' is the web application, or the ASP.NET site/service that handles requests from user. 'Background worker' is simply a scheduled task. It runs in background, on specified intervals, and executes some code.
通常,“Web worker”是Web应用程序,或处理来自用户请求的ASP.NET站点/服务。 '后台工作者'只是一个预定的任务。它在后台运行,按指定的时间间隔运行,并执行一些代码。
The difference is that a Web worker does some work when a new request comes to the application. A request means someone loads a page/calls a web service on ASP.NET. While the background worker is being started on some interval, and doesn't need a user to load a page to be executed. It is mostly used for processing long-running tasks. The usual workflow is - the web worker receives a request from the user, and queues some data to be processed. On next run, the background worker gets the data and processes it, and stores the data somewhere(usually in database). Then the web worker, on next request from user, checks the database and if the result is there - shows it to the user.
不同之处在于,当新请求到达应用程序时,Web worker会执行某些操作。请求表示有人在ASP.NET上加载页面/调用Web服务。虽然后台工作程序在某个时间间隔内启动,但不需要用户加载要执行的页面。它主要用于处理长时间运行的任务。通常的工作流程是 - Web工作者接收来自用户的请求,并将一些数据排队以进行处理。在下一次运行时,后台工作程序获取数据并对其进行处理,并将数据存储在某处(通常在数据库中)。然后,Web工作者在用户的下一个请求中检查数据库以及结果是否存在 - 将其显示给用户。
This way the user doesn't need to wait for the asp.net page to process the data and return a result immediately.
这样,用户无需等待asp.net页面处理数据并立即返回结果。