1

我希望有人可以对我面临的问题有所了解。我有如下所述的架构,我将编写流量进入实例的步骤。

  1. 请求命中域名,这是一条 A 记录,别名为 AWS ALB DNS 名称。
  2. 从这里,流量然后被路由到特定端口上的代理实例(原因,为什么我坚持使用应用程序负载平衡,是我不能简单地将 A 记录指向 URL/域和端口。另外,我正在使用 web插座)。
  3. 流量到达上游,上游一直发送响应。

注意:我正在使用中间的代理实例来拥有一个绑定 ALB 的“静态”IP 地址。根据分配的后端 IP 地址,仅代理实例上的 IP 地址会动态更改。

问题是巨大的初始延迟在使用 curl 进行测试后,我发现请求最初到达的 IP 地址只是超时,然后在几分钟后被路由到 ALB IP 地址。如何克服这个问题?

ALB 要求至少分布在两个子网中,但只有一个是公共的。

~ ❯❯❯ curl -v app1.domain.com
* Rebuilt URL to: app1.domain.com/
*   Trying "some_public_ip_adress_a"...
* TCP_NODELAY set
* Connection failed
* connect to "some_public_ip_adress_a" port 80 failed: Operation timed out
*   Trying "some_public_ip_adress_b"...
* TCP_NODELAY set
* Connected to app1.domain.com ("some_public_ip_adress_b") port 80 (#0)
> GET / HTTP/1.1
> Host: app1.domain.com
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 26 Jul 2018 10:39:31 GMT
< Content-Type: text/html
< Content-Length: 3700
< Connection: keep-alive
< Server: nginx/1.12.1
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: authorization,Content-Type
< Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, HEAD, DELETE
< X-FRAME-OPTIONS: SAMEORIGIN
< X-XSS-Protection: 1
< Accept-Ranges: bytes
< Last-Modified: Sat, 23 Jun 2018 21:06:06 GMT
<
<!doctype html><!-- 
4

0 回答 0