问题描述
亲爱的所有人,
我正在开发一个项目,该项目从UDP组播通道接收数据包,将其解码并将其保存到数据库中.
有不同格式的不同数据包.
实际上,广播速度非常快.可能是每秒600-800个数据包.目前,我创建了一个线程,在其中加入组并接收数据包,并添加了在另一个线程中运行的数据包处理器对象.此数据包处理器处理每个数据包并解压缩,解码其中的数据并引发一个事件,该事件将数据刷新给用户,此时,我将解码后的数据添加到数据对象中,该数据对象将数据保存到在不同线程中运行的数据库中.
这就是我正在做的所有事情,因为我不想错过任何数据包.
进程运行正常,但是我的问题是在此进程中CPU使用率很高.
您能告诉我什么是解决该问题的最佳实践.请记住,每秒有将近1000条插入语句在SQL Server中运行.
问候,
古塔姆
[已删除电子邮件地址]
Dear All,
I am developing a project which receives packets from a UDP Multicast channel decode it and saves it into database.
There are different packets in different formats.
Actually the broadcast is very fast. May be 600-800 packets per second. For the time I created a thread in which I join the group and receives the packets and adding in a packet processor object running in another thread. This packets processor process every packet and decompress, decodes the data inside it and raises an event which refreshes the data to user, at this time I am adding the decoded data in a data object which saves the data into the database running in a different thread.
This is all I am doing because I dont want to miss any packet.
The process is running OK, But my problem is in this process the CPU usage is very high.
Can you just tell me what will be the best practice for the problem. Remember there are almost 1000 insert statement is running in SQL Server in a second.
Regards,
Goutam
[e-mail address removed]
推荐答案
这篇关于UDP广播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!