请求处理优先级在OPC UA中。

huangapple go评论82阅读模式
英文:

Request handling priority in OPC UA

问题

I'm building an OPCUA Server in Visual C# to be put on a client's machines.

The client wants to make sure that Methods called on the server that have physical consequences have priority on all other requests, for example if a server has 10 active client sessions, and 9 of those clients send a read/write request and one of them sends a move command for a robotic arm, this command should be executed first and the read/write operations should be completed later.

This makes sense for safety reasons: I don't want to wait on 9 read operations before the server gets to the conveyor_belt_stop() command, which was issued to prevent a person from getting injured.

Requests management is handled internally by the Server SDK, so there is no way of implementing custom requests handling policies.

I studied the code of my SDK of choice, and I saw that it adds requests to a Queue object and uses worker threads to satisfy the requests. Given that Queue is a FIFO queue makes it impossible to somehow rearrange the request to favor those that I want.

For now I plan to use the sample client to benchmark the latency of this queue mechanism and trust the OPCUA devs that this is the right approach, but I would like to have a better answer for my client.

Does OPCUA provide a way to define priorities for the request handling from either the Client or Server side?

英文:

I'm building an OPCUA Server in Visual C# to be put on a client's machines.

The client wants to make sure that Methods called on the server that have physical consequences have priority on all other requests, for example if a server has 10 active client sessions, and 9 of those clients send a read/write request and one of them sends a move command for a robotic arm, this command should be executed first and the read/write operations should be completed later.

This makes sense for safety reasons: I don't want to wait on 9 read operations before the server gets to the conveyor_belt_stop() command, which was issued to prevent a person from getting injured.

Requests management is handled internally by the Server SDK, so there is no way of implementing custom requests handling policies.

I studied the code of my SDK of choice, and I saw that it adds requests to a Queue<T> object and uses worker threads to satisfy the requests. Given that Queue<T> is a FIFO queue makes it impossible to somehow rearrange the request to favor those that I want.

For now I plan to use the sample client to benchmark the latency of this queue mechanism and trust the OPCUA devs that this is the right approach, but I would like to have a better answer for my client.

Does OPCUA provide a way to define priorities for the request handling from either the Client or Server side?

答案1

得分: 1

OPCUA是否提供了一种定义请求处理优先级的方式,无论是从客户端还是服务器端?
不提供。
但我认为您对所链接的SDK的实现有所误解。它不会排队请求并逐个处理它们。您链接的对象是一个字典,而不是队列,它用于其他记录目的。
尽管如此,您可以考虑保持两个会话的打开状态,并使用其中一个会话作为您的“高优先级”会话,只发出您的应用程序认为是高优先级的方法调用或其他操作。

英文:

> Does OPCUA provide a way to define priorities for the request handling from either the Client or Server side?

No, it doesn't.

But I think you've misunderstood the implementation of the SDK you linked to. It does not queue requests and process them one-by-one. The object you link to is a Dictionary, not a Queue, and it's used for other bookkeeping purposes.

That said, you could consider keeping 2 sessions open, and using one of those sessions as your "high priority" session where you only issue method calls or other operations your application considers high priority.

huangapple
  • 本文由 发表于 2023年5月18日 00:57:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76274506.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定