gpt4 book ai didi

.net - Redis 用于频繁更改的市场信息

转载 作者:可可西里 更新时间:2023-11-01 11:22:12 26 4
gpt4 key购买 nike

我们软件环境中的当前方法是在分布式 SOA 基础结构中拥有多个 WCF 服务。有不止一种服务向前端网站提供来自证券交易所的信息,例如股票、债券、货币、共同基金。

Web 服务查询数据库,我们有直接来自 .net 框架的 ThreadCache,它可以将信息缓存 3-5 分钟。如果缓存过期,最终用户将调用将从数据库中检索新信息的方法。因此,该网站非常快,除了使用过期数据调用网络服务的网站之外......该用户的响应时间非常慢......可能大约 10-20 秒 :/

我想每 5 分钟将此市场信息提供给在 Windows 服务器上运行的 Redis 服务。 WCF 服务将从 REDIS 而不是数据库中获取信息。

我的一个大问题是,如何让使用新信息更新 REDIS 服务的数据馈送器在同一台机器上运行的最佳方法是什么?

  • Windows 服务每 5 分钟运行一次
  • 守护进程每 5 分钟从工作负载调度程序运行一次
  • ..或者也许我可以在 Redis 中实现一些方法,他自己 (REDIS) 会检查是否
    数据已过期,然后调用一些更新 REDIS 数据存储的方法。

给你意见! :)

最佳答案

这是我的看法

The webservices query the database and we have ThreadCache straight from .net framework which caches the information for 3-5 minutes. If the cache is expired, it would be the enduser that invokes the method that is going to retrieve new information from the database. So the website is pretty fast except for the one that invokes the webservice with expired data....that user will have a pretty slow reponse time... probably about 10-20 second :/

为什么需要服务层?如果仅用于缓存数据,我强烈建议您使用 AppFabric 或简单的 Redis 直接查询分布式缓存。另一层似乎对您的情况毫无用处,尤其是当代码似乎与您的网站耦合不佳时。

  • Windows service running in every 5 minutes
  • Daemon running every 5 minutes from an workload scheduler ..
  • Or maybe I can implement some method in Redis and he himself (REDIS) would check if the data has expired and then invoke some methods that updated the REDIS data storage.

Windows Service 或 Daemon,它们完全相同,并且是设置后台处理的推荐方式。我熟悉topshelf ,我发现它真的很强大。即使 Redis 现在支持键空间通知,也无法直接调用用 .net 编写的内容。

您的数据在 5 分钟后过期?好的,但每分钟在后台运行一次任务以预加载/预缓存数据。对于最终用户来说,它总是很快,因为您永远不必重新加载它。

最后,Redis 的另一个重要特性是 PubSub .当 Redis 发生变化时,很容易通知所有订阅者。只需几行代码,它就可以让您在所有网站上实现本地缓存失效,并避免不同步的节点。

I want to feed this market information to a Redis service running on windows server in every 5 minutes. The WCF services would the get information from REDIS instead of database.

目前,Windows 上的 Redis 端口不是生产质量,但可用于 Windows(服务器)环境中的开发目的。我使用了几个月,发现它非常稳定,但建议在 Linux 环境中运行 Redis。

关于.net - Redis 用于频繁更改的市场信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20947936/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com