Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Remote » SQL Remote 部署和管理 » SQL Remote 管理 » 提高 SQL Remote 的性能 » 在接收消息时提高性能

 

调整要重新发送消息的请求

当队列中某一消息丢失时,消息代理 (dbremote) 会在请求重新发送该丢失的消息之前等待指定数量的轮询。消息代理 (dbremote) 等待的轮询数称为其等待时间。缺省情况下,消息代理 (dbremote) 的等待时间为 1。

如果消息代理 (dbremote) 的等待时间为 1,并且应接收到消息 6,但却接收到消息 7,则它不会执行任何操作。相反,消息代理 (dbremote) 会等待下一次轮询的结果。如果在下一次轮询之后仍未接收到消息 6,则消息代理 (dbremote) 会发出请求,要求重新发送消息 6。

增加重新发送的等待时间

假设轮询间隔非常短,并且消息系统不会保留消息到达的顺序。顺序错乱的消息在两次或三次轮询完成以后到达的情况可能很常见。在此示例中,建议使用 -rp 选项来增加消息代理 (dbremote) 的等待时间,以免发送大量不必要的重新发送请求。-rp 选项通常与设置轮询间隔的 -rd 选项一起使用。请参见调整轮询间隔以检查新消息

示例

有两个远程用户(名为 user1 和 user2),都以 30 秒的轮询间隔和 3 次轮询的等待时间来运行消息代理 (dbremote)。例如,他们使用以下命令运行消息代理 (dbremote):

dbremote -c "DSN=SQL Anywhere 11 Demo"  -rd 30s -rp 3

在以下一系列操作中,消息被标记为 userX.n,其中 X 为用户名,n 为消息号。例如,user1.5 是来自 user1 的第 5 条消息。消息代理 (dbremote) 预期两个用户的消息都从编号 1 开始。

在 0 秒时:

  1. 消息代理 (dbremote) 读取 user1.1、user2.4

  2. 消息代理 (dbremote) 应用 user1.1

  3. 消息代理 (dbremote) 的等待时间现在为 user1:未知,user2:3,因为来自 user2 的失序消息已到达

在 30 秒时:

  1. 消息代理 (dbremote) 读取:无新消息

  2. 消息代理 (dbremote) 应用:无

  3. 消息代理 (dbremote) 的等待时间现在为 user1:未知,user2: 2

在 60 秒时:

  1. 消息代理 (dbremote) 读取:user1.3

  2. 消息代理 (dbremote) 应用:无新消息

  3. 消息代理 (dbremote) 的等待时间:user1:3,user2: 1

在 90 秒时:

  1. 消息代理 (dbremote) 读取:user1.4

  2. 消息代理 (dbremote) 应用:无

  3. 消息代理 (dbremote) 的等待时间为 user1:3,user2:0

  4. 消息代理 (dbremote) 向 user2 发出重发请求

当用户接收到新消息时,消息代理 (dbremote) 的等待时间将被重置,即使该消息不是预期的消息。

在 120 秒时:

  1. 消息代理 (dbremote) 读取:user1.2 和 user2.2

  2. 消息代理 (dbremote) 应用 user1.2、user1.3、user1.4 和 user2.2

  3. 消息代理 (dbremote) 的等待时间为 user1:未知,user2:N/A

另请参见