本文介绍了不同微服务的缓存层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我们有不同的微服务,这些微服务会重复调用内部和外部服务.我们需要在服务之间缓存这些调用,以改善延迟.我们正在考虑引入一个API网关,其主要目的是在服务之间缓存数据.其他一些目标是-

We have different microservices which makes duplicate calls to internal and external services. We need to cache these calls between services to improve latency. We are thinking of introducing an API gateway whose major aim would be caching the data between services.Some other objectives are -

i)将调用不同的微服务以汇总其响应.

i) Would be calling different micro-services to aggregate their response.

ii)还将避免跨微服务多次调用外部服务.

ii) Would also be avoiding multiple calls to external services across micro services.

iii)将负责缓存未命中&击中外部API调用.

iii) Would be taking care of cache miss & hit for external API calls.

iv)高吞吐量,高性能和低延迟.

iv) High throughput, performance and low latency.

我们有基于vert.x的技术堆栈.实施这种系统的最佳方法是什么.我有以下问题-

We have vert.x based tech stack.What would be the best way to implement such a system. I had following questions -

1)将其实现为库还是服务?

1) Implement it as a library or a service ?

2)要使用哪个数据存储(我们正在考虑Redis/Hazelcast)?

2) Which data store to be used ( we are considering Redis/Hazelcast) ?

3)Varnish/Squid/Nginx之类的库可以在这里提供帮助吗?

3) Can libraries such as Varnish/Squid/Nginx help here ?

4)如何处理缓存失效?

4) How to handle cache invalidation ?

推荐答案

我认为您有很多选择:

  1. Redis
  2. Redis Sentinel(支持群集)
  3. ETCD(来自CoreOS):支持群集
  4. Apache Geode
  5. Aerospike:即使在数据中心之间也支持集群

以及许多商业产品,例如SAP HANA.

and many commercial products like SAP HANA.

注意:Aerospike是免费的,但我认为您应该为数据中心之间的集群支付费用.

note : Aerospike is free but for clustering between data centers I think you should pay.

我本人在相同的情况下使用了 ETCD (感谢Brandon Philips).

I myself have used ETCD for same scenarios (thanks to Brandon Philips).

这篇关于不同微服务的缓存层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 22:51