建议 [英] Suggestion

查看:63
本文介绍了建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Windows服务应用程序,可以创建报告。它是
多线程应用程序,它每隔几秒就扫描一次数据库,并且
从数据库中检索记录,而不是跨越每个新线程

创建报告的记录。我在3个不同的
服务器上运行此应用程序,每个服务器执行特定类型的记录。我想要什么呢?
要做的是让所有服务器处理任何类型的记录,但我只想要一个程序处理任何一条记录的
。我的问题是我如何保持多个服务器处理相同的记录

。我试图在数据库中放置一个

标志,因为1 =处理而0 =不是,但是数据库不是很快就足够了,在数据库上缓存可以防止阅读最新状态。

如何在所有服务器之间进行通信。我不是在寻找特定的

代码,只是在处理记录之前如何在所有服务器之间进行通信的想法或指示。我不想拥有主服务器因为

这是一个失败点。

谢谢你

彼得

I have Windows Service application which creates reports. It''s a
multithreaded application which scans database every several seconds and
retrieves records from a database and than spans a new thread for each
record which creates a report. I run this application on 3 different
servers and each server does a specific type of records. What I would like
to do is to have all servers processing any type of record, but I want only
one program processing any one record. My question is how do I keep
multiple servers from processing the same records. I''ve tried to place a
flag in the database as 1 = processing and 0 = is not, but database it not
fast enough, caching on the database prevents reading of the latest status.
How do I communicate between all servers. I am not looking for specific
code just an idea or pointers on how to communicate between all servers
before processing a record. I don''t want to have a master server because
it''s a one point of failure.
Thank You
Peter

推荐答案

2008年8月12日星期二00:00:51 -0500,Peter写道:

On Tue, 12 Aug 2008 00:00:51 -0500, Peter wrote:


我让多台服务器处理相同的记录。我已经尝试过将
在数据库中放置一个标志,因为1 =处理而0 =不是,但是

数据库它不够快,缓存在数据库上可以防止阅读

最新状态。如何在所有服务器之间进行通信。我不是在寻找具体的代码只是一个想法或指示如何在处理记录之前在所有服务器之间进行通信的b $ b。我不想拥有一台

主服务器,因为这是一个失败点。
I keep multiple servers from processing the same records. I''ve tried to
place a flag in the database as 1 = processing and 0 = is not, but
database it not fast enough, caching on the database prevents reading of
the latest status. How do I communicate between all servers. I am not
looking for specific code just an idea or pointers on how to communicate
between all servers before processing a record. I don''t want to have a
master server because it''s a one point of failure.



实现一个监视数据库的套接字服务器,并将

标识符分发给客户端。客户端启动并连接以查找下一个

记录,如果没有,则服务器会阻止客户端报告,直到

有事可做。您可以根据需要启动任意数量的客户端。

所有服务器都会监视数据库并在队列中循环

请求将它们分发出去工作。


Ken


Implement a socket server that monitors the database and hands out the
identifiers to the clients. Clients start and connect to find out next
record, if there is none then the server blocks the client reports until
there is something to do. You can start as many clients as you want and
all the server does is monitor the database and cycle through the queue
of requests handing them out to work.

Ken


谢谢Ken的帮助!


但是如果套接字服务器出现问题所有客户都失败了 - 单一

失败点。

Ken Foskey < rm ********** @ optushome.com.auwrote in message

news:48 ******** @ dnews.tpgi.com.au .. 。
Thanks Ken for your help!

But if the socket server goes down all of the clients are down - single
point of failure.
"Ken Foskey" <rm**********@optushome.com.auwrote in message
news:48********@dnews.tpgi.com.au...

2008年8月12日星期二00:00:51 -0500,Peter写道:

On Tue, 12 Aug 2008 00:00:51 -0500, Peter wrote:


>我让多台服务器处理相同的记录。我试图在数据库中放置一个标志,因为1 =处理而0 =不是,但是数据库不够快,缓存在数据库上会阻止读取最新的
状态。如何在所有服务器之间进行通信。在处理记录之前,我并不是在寻找特定代码只是一个想法或指示如何在所有服务器之间进行通信。我不想拥有一台主服务器,因为这是一个失败点。
>I keep multiple servers from processing the same records. I''ve tried to
place a flag in the database as 1 = processing and 0 = is not, but
database it not fast enough, caching on the database prevents reading of
the latest status. How do I communicate between all servers. I am not
looking for specific code just an idea or pointers on how to communicate
between all servers before processing a record. I don''t want to have a
master server because it''s a one point of failure.




实现一个监视数据库的套接字服务器,并将

标识符分发给客户端。客户端启动并连接以查找下一个

记录,如果没有,则服务器会阻止客户端报告,直到

有事可做。您可以根据需要启动任意数量的客户端。

所有服务器都会监视数据库并在队列中循环

请求将它们分发出去工作。


Ken



Implement a socket server that monitors the database and hands out the
identifiers to the clients. Clients start and connect to find out next
record, if there is none then the server blocks the client reports until
there is something to do. You can start as many clients as you want and
all the server does is monitor the database and cycle through the queue
of requests handing them out to work.

Ken



2008年8月12日星期二00:32:49 -0500,Peter写道:
On Tue, 12 Aug 2008 00:32:49 -0500, Peter wrote:

感谢Ken的帮助!


但是如果套接字服务器出现故障,所有客户端都会关闭 - 单个

失败点。
Thanks Ken for your help!

But if the socket server goes down all of the clients are down - single
point of failure.



使用UDP和广播,让所有客户端监控相同的UDP

广播套接字。没有滞后时间。每个人都会宣传他们选择的是什么?
up。


服务器应该宣传完成的。如果没有完成并且

服务器处于空闲状态,它应该使用相同的

广播来查询旧的未完成作业,如果没有响应则选择一个并开始工作<再次使用
(可恢复性)。


注意UDP不可靠,两个可以开始完全相同的工作

同一件同时。因此你必须处理冲突,它只会降低概率。


我想知道你怎么没有中心点的失败a

数据库无论如何?


Ken

Use UDP and a broadcast, have all clients monitor the same UDP
broadcast socket. No lag time. Each one advertises which ones they pick
up.

Servers should advertise completed ones. If there is no completed and a
server is idle it should query old incomplete jobs using the same
broadcast and if there is no response pick that one up and start working
on it again (recoverability).

Note that UDP is not reliable and two could start work on exactly the
same piece at the same time. So you have to handle conflicts still, it
just reduces the probability.

I am wondering how you don''t have a central point of failure with a
Database anyway?

Ken


这篇关于建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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