在服务结构中实现缓存支持 [英] Implement cache support in service fabric

查看:78
本文介绍了在服务结构中实现缓存支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,我将调用Service Fabric方法并将数据返回给最终用户。数据很少被修改或几乎不变,所以我想维护一个
的缓存并在数据未被修改时返回它。


项目结构为:WepApi(无状态服务) - >存储库 - > SatefulService


在Azure Service Fabric中实现此功能的最佳方法是什么?我想到两个选择:

1. Redis cache

a。创建一个Redis缓存项目,它将公开两个端点以存储和获取缓存数据。该项目将在存储库层中引用。

b。创建Redis缓存服务(服务结构)并从存储库调用。

2.有状态服务

a。在现有的有状态服务中创建一个单独的字典,并用它来获取和存储数据。


和,我也有以下问题。

方法#1:

1.我们必须依赖第三方系统(Redis缓存),如果服务器不可用,我们可能无法得到准确的结果。

方法#2:

1.如果缓存数据随着时间的推移而增加,我们可能会遇到性能问题。


在服务结构中实现缓存的最佳方法是什么?


谢谢,

解决方案

如果你需要使用缓存,那么你应该看看Azure缓存


https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/


这不是你的事会像SF设计的那样直接构建到SF我没有看到只使用SF来利用缓存的方法。 


I am working on a project in which I will be calling Service Fabric methods and returning the data to end user. The Data is modified very infrequently or is almost constant so I want to maintain a cache and return it if the data is not modified.

The project structure is: WepApi(Stateless Service) -> Repository -> SatefulService

What is the best way of implementing this in Azure Service Fabric? I am thinking of two options:
1. Redis cache
a. Creating a Redis cache project where it will expose two endpoints for storing and getting cache data. This project will be referenced in the repository layer.
b. Creating a Redis cache service( service fabric ) and calling from the repository.
2. stateful service
a. Creating a separate dictionary in the existing stateful service and use it for getting and storing data.

And, I am also having below questions.
Approach #1:
1. We have to depend on 3rd party system(Redis cache) and we might not get accurate results if the server is not available.
Approach #2:
1. We might get a performance issue if the cache data is increased over time.

Any best approaches to implement a cache in service fabric?

Thanks,

解决方案

If you need to use caching then you should look into Azure Cache

https://docs.microsoft.com/en-us/azure/azure-cache-for-redis/

This is not something you would build into SF directly as the way SF is designed I don't see a way to utilize caching by just using SF. 


这篇关于在服务结构中实现缓存支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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