bloom-server 基于 rust 编写的 rest api cache 中间件,他位于lb 与api worker 之间,使用redis 作为缓存内容存储,
我们需要做的就是配置proxy,同时他使用基于share 的概念,进行cache 的分布存储,包含了请求端口(proxy,访问数据)
以及cache 控制端口(api 方便cache 策略的控制)
测试环境使用openresty+ docker + docker-compose 运行
一张参考图
环境准备
docker-compose 文件
version: "3"
services:
redis:
image: redis
ports:
- "6379:6379"
lb:
image: openresty/openresty:alpine-fat
volumes:
- "./nginx/nginx-lb.conf:/usr/local/openresty/nginx/conf/nginx.conf"
ports:
- "9000:80"
webapi:
image: openresty/openresty:alpine-fat
volumes:
- "./nginx/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf"
ports:
- "8090:80"
webapi2:
image: openresty/openresty:alpine-fat
volumes:
- "./nginx/nginx2.conf:/usr/local/openresty/nginx/conf/nginx.conf"
ports:
- "8091:80"
bloom:
image: valeriansaliou/bloom:v1.25.0
environment:
- "RUST_BACKTRACE=1"
volumes:
- "./bloom/config.cfg:/etc/bloom.cfg"
ports:
- "8080:8080"
- "8811:8811"
bloom2:
image: valeriansaliou/bloom:v1.25.0
environment:
-