简体   繁体   English

如何向 Traefik Ingress Controller 后面的微服务添加缓存?

[英]how to add caching to Microservices behind Traefik Ingress Controller?

I was using a Docker-based setup with an nginx reverse proxy forwarding to Dockerized Microservices for some time.一段时间以来,我一直在使用基于 Docker 的设置和 nginx 反向代理转发到 Dockerized 微服务。 Right now I am evaluating a switch to a Kubernetes-based approach and the Traefik Ingress Controller.现在我正在评估转向基于 Kubernetes 的方法和Traefik Ingress Controller。

The Ingress Controller provides all functionality required for this, except for one: It doesn't support caching . Ingress Controller 提供了为此所需的所有功能,除了一个:它不支持缓存

The Microservices aren't very performant when it comes to serving static resources, and I would prefer to reduce the load so they can concentrate on their actual purpose, handling dynamic REST requests.在提供静态资源方面,微服务的性能不是很好,我更愿意减少负载,以便它们可以专注于其实际目的,处理动态 REST 请求。

Is there any way to add caching support for Traefik-based Ingress?有没有办法为基于 Traefik 的 Ingress 添加缓存支持? As there are many yet small services, I'd prefer not to spinup a dedicated Pod per Microservice if possible.由于有许多小服务,如果可能的话,我不想为每个微服务启动一个专用的 Pod。 Additionally, a configuration-based approach would be appreciated, if possible (maybe using a custom Operator ?).此外,如果可能的话,基于配置的方法将不胜感激(也许使用自定义Operator ?)。

Caching functionality is still on the wish list in Traefik project.缓存功能仍然在Traefik项目的愿望清单上。
As a kind of workaround please check this scenario where NGINX is put in front to do caching.作为一种变通方法,请检查 方案,其中NGINX放在前面做缓存。
I don't see any contraindications to apply the same idea in front of Traefik Ingress Controller.我没有看到在 Traefik Ingress Controller 前面应用相同想法的任何禁忌症。

This is an enterprise feature.这是企业功能。 You have to buy Traefik enterprise to get caching functionality.您必须购买 Traefik Enterprise 才能获得缓存功能。

Came accross this and alltough we are still testing it, apparently cache is finally been implemented directly in traeffik, including selective per path whish was our main concern.遇到了这个问题,尽管我们仍在测试它,显然缓存终于在 traeffik 中直接实现了,包括我们主要关注的每条路径选择性。 Unsure of the limitations/performance alltough I've read that only memory allocated per router is currently available as a storage:不确定限​​制/性能尽管我已经读过,目前只有每个路由器分配的内存可用作存储:

https://github.com/traefik/traefik/issues/878 https://github.com/traefik/traefik/issues/878

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM