如何从数据库实时将数据分发到客户端应用程序 [英] How to distributed data to client apps from database in real-time

查看:101
本文介绍了如何从数据库实时将数据分发到客户端应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在订阅实时股票市场数据供稿,该供稿将在收到数据时更新数据库表.我还分发了几个前端(客户端)应用程序,这些应用程序每毫秒查询一次数据库以分析数据.

每毫秒轮询一次会占用大量资源且效率低下.有人可以显示/解释执行此操作的正确方法吗?我确定每毫秒轮询一次是错误的!

我还编写了一个数据库应用程序,该应用程序从我解析,分析并传递到表进行更新的dataFeed接收消息.我目前正在使用多线程消费者/生产者队列来完成此任务.就CPU使用率峰值和内存消耗而言,我遇到了许多性能问题.能否请我指出正确的方向,以建立与我在此解释的系统相似的系统.

预先感谢,
-Dee

解决方案

再见,唐纳德,

您需要一种提供发布/订阅功能的消息队列解决方案.

如果您的安全要求不严格,则可以尝试:
http://www.rabbitmq.com/ [ ^ ]或 http://www.zeromq.org/ [ ^ ]

使用rabbitmq实现所需的功能应该很容易.

用zeromq可以实现的性能几乎胜过一切,但这是与常规的代理mq解决方案完全不同的野兽,难以开发,但是每秒410万条消息令人印象深刻.

也有类似 Oracle MessageQ [WebSphere MQ [ ^ ]和 Microsoft消息队列–使用Microsoft SQL Server记录交易信息 [ ^ ]?

最好的问候
Espen Harlinn


如果这是SQL Server,请查看SqlDependency.也许是可行的:在Windows应用程序中使用SqlDependency [ ^ ]


I''m current subscribing to live stock-market data feed that updates a database table as data is received. I''ve also distributed several front-end (client) apps that query the database every millisecond for data to analyze.

Polling every millisecond is resource intensive and inefficient. Can someone please show/explain the correct way to do this? I''m sure that polling every millisecond is wrong!

Also I''ve written a database app that receives messages from a dataFeed that I parse, analyze and pass on to a table to update. I''m current using a multiThreaded consumer/producer queue to accomplish this. I''m having a bunch of performance issues as far as CPU usage spikes and memory consumption. Can some please point me the right direction as far building systems that are similar to what I''m explaining here.

Thanks in advance,
-Dee

解决方案

Hi again Donald,

What you need is some kind of message queuing solution that provides publish/subscribe functionailty.

If your security requirements aren''t to strict you could try:
http://www.rabbitmq.com/[^] or http://www.zeromq.org/[^]

Implementing what you need using rabbitmq should be fairly easy.

The performance you can achieve with zeromq beats just about anything, but it''s an entirely different kind of beast than regular brokered mq solutions, harder to develop for, but 4.1 million messages per second is quite impressive.

There is also products like Oracle MessageQ[^], WebSphere MQ[^] and MSMQ[^] that provides integration with AD - and that''s often desireable.

Did you ever look at my article Microsoft Message Queuing – Log Trade Information using Microsoft SQL Server[^]?

Best regards
Espen Harlinn


If this is SQL Server, have a look at SqlDependency. Perhaps it would be feasible: Using SqlDependency in a Windows Application[^]


这篇关于如何从数据库实时将数据分发到客户端应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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