https://companyb.acme.org/another/custom/custom/custom/apiendpoint 专用的EC2实例
(两个EC2实例都使用相同的核心应用程序,每个客户都可以自定义API端点的目录)
大多数时候这些EC2实例是空闲的,因此我们秘密地想阻止它们,但我们不希望客户关心该实例是否启动。
当需要唤醒实例之前,我们可以接受2秒的延迟,然后再回答客户API调用
我的想法是拦截所有传入的HTTP请求并在路由 +转发之前缓冲它们。
我需要一个延迟才能检查是否匹配子域的后端是否匹配,并在下降时将其唤醒。
任何人都知道任何现有的代理 /负载平衡解决方案能够缓冲 /队列HTTP请求,然后允许进行一些自定义魔术(以启动正确的EC2实例),然后基于Origin / referer转发请求?
(答案可能是最后一部分的每个现有代理)
正在考虑以下内容:
触发AWS lambda , 不确定在启动EC2主机时,NGINX如何处理请求缓冲 /转发。
奖励问题:如何不浪费任何时间转发请求,以防后端已经上升?
https://companyA.acme.org/custom/api/endpoint1 is hosted on a dedicated ec2 instance
https://companyB.acme.org/another/custom/apiendpoint is hosted on a dedicated ec2 instance
(both ec2 instance are using the same core app, each customer can customize the catalog of API endpoints)
Most of the time those ec2 instances are idle, so we secretly want to stop them, but we don't want the customer to care about the instance being up or not.
We can accept a 2 sec delay on response timing when instance needs to be wake up before answering the customer API call
My idea is to intercept all incoming HTTP request and buffer them before routing + forwarding.
I need a delay to be able to check if a backend matching the subdomain is up or not and wake it up if it is down.
Anyone knows any existing proxy / load balancing solution able to buffer / queue HTTP requests, then allows to do some custom magic (in order to launch the right ec2 instance), then forward the request based on Origin/Referer ?
(the answer being probably every existing proxy for the last part )
I was thinking about the following:
But I am not sure on how NGINX will handle the request buffering / forwarding while I start the ec2 host.
Bonus question : how not to waste any time forwarding the request in case the backend is already up ?
发布评论