504 errors from balancing elastic load using Tomcat

I have an application running on multiple EC2 instances and maintained by Apache Tomcat. I set up the AWS load balancer before the application, and everything basically works as expected. However, I sometimes get a random 504 timeout error from ELB. This does not seem to be load related, as I have seen errors with light load and heavy load. In addition, this does not occur in any regular pattern or situation.

Earlier in my testing, I was getting 504 errors because my application took longer to respond than the 60 second default timeout on ELB. I decided that by typing the ELB timeout to the level necessary for my application. However, the 504 errors that I get now occur very quickly. So, for example, one error that I saw was on request with a response time of about a second. It seems strange to get a timeout error when the request cannot be installed on the application server.

This could be a similar problem for this question , although I could not say from the information provided. In addition, I do not have an additional load balancer in the mix, just ELB directly on Tomcat.

+4
source share
2

, , . , - :

504 ELB:

  • ELB. - - 504 , ELB 60 . ELB .
  • ELB , , . - - 504, , , - ELB.

- , , - ELB. , - ELB. "-1 -1 -1", , :

2015-12-11T13:42:07.736195Z my-elb 10.0.0.1:59893 - -1 -1 -1 504 0 0 0 "GET http://my-elb/ HTTP/1.1" "curl/7.19.7" - -

:

, - ELB , - keepalive 504 .

- , ELB, Tomcat , , - ELB . - ELB, , connectionTimeout, Tomcat. connectionTimeout , - ELB, 504. , "" "" .

Tomcat keepAliveTimeout, , connectionTimeout, . , connectionTimeout , .

+1

ELB , , . 504 Gateway Timeout, , ( Tomcat) .

( ELB SO. , , , .)

, , , ELB Tomcat . Tomcat, curl localhost , .

, ELB , , , - , ELB , . . CloudWatch ELB, , .

504 , , , . , Java - . CloudWatch EC2, , .

+1

Source: https://habr.com/ru/post/1691760/


All Articles