Winform在大量更新广播期间无响应 [英] Winform non responsive during heavy update broadcast

查看:57
本文介绍了Winform在大量更新广播期间无响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个用于证券交易所证券交易的应用程序.它具有来自供应商之一的实时市场信息.我们正在处理工作线程上的市场数据,并在更新主GUI时将这些数据编组到GUI线程.
让我更明确地说,有一个具有80列的超网格(第三方gridview),我们大约有40行具有相同的安全性,当市场数据波动时,必须对其进行更新.我们能够处理10条消息/秒/安全性的市场频率.但除此之外,我们无能为力.当频率增加到25-30 msgs/sec/安全性时,GUI变得无响应.我们在设计和实施时遵循了最佳实践,但仍然无法处理高频率.我们正在工作线程/背景线程上执行所有非GUI特定的工作,但仍面临GUI挂起的问题.请帮我建议任何现成的解决方案,以解决此问题.出于安全原因,这里不能放入代码片段.

Hi guys,
I am having an application which is for securities trading in stock exchange. It has real time market feed from one of the vendors. We are processing market data on worker thread(s) and while updating main GUI we are marshaling this data to GUI thread.
Let me make this more clear, there is an ultragrid (third party gridview) having 80 columns, we have around 40 rows with same security that must be updated as and when there is fluctuation in market data. We are able to handle market frequency of 10 messages/sec/security. But beyond that we are unable to handle. GUI becomes non-responsive when frequency increases to 25-30 msgs/sec/security. We have followed best practices while designing and implementation but still we can not handle high freq. We are performing all non-GUI specific work on worker/back-ground threads, but still facing GUI hang. Please help in suggesting me any out of the box solution to tackle this problem. Here I can not put code snippet due to security reasons.

推荐答案

在我看来,这个问题是更新UltraGrid的速度.您是否在循环添加数据?尝试改用AddRange.第二;在添加记录的代码周围调用BeginUpdate()/EndUpdate()-这样可以防止网格不得不多次使自身无效/重新绘制.

查看WinGrid文档-如果您使用数据源直接更新网格,则该数据源可能会导致许多内部操作发生更新-您可以使用SuspendRowSynchronization()/ BeginRowSynchronization()将其关闭.

如果仍然需要,还可以对网格进行其他优化,但是这些优化足以使您入门.
It sounds to me like this issue is the speed of updating UltraGrid. Are you looping round adding data? Try using AddRange instead. Second; call BeginUpdate()/EndUpdate() around that code that adds the records in - this prevents the grid having to invalidate/repaint itself many times.

Looking at the WinGrid documentation - if you are using a DataSource to upate the grid directly, the DataSource may result in lots of internal operations where updates are occurring - you can switch this off with SuspendRowSynchronization()/BeginRowSynchronization().

There are other optimisations that can be performed on the grid if you still need to, but these should be enough to get you started.


这篇关于Winform在大量更新广播期间无响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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