Kong has 3 different timeout
- connect_timeout: from kong to the micro. Once is connected then the connection is managed by
- keep-alive HTTP 1/1
- open HTTP/2
- can be used any reasonable value under 30000 ms
- read_timeout: end to end flow (inbound > outbound > inbound). This is the MOST important timeout.
- if kong closes the connection before the application then is raised +504 http and application timeout MUST BE RAISED MANUALLY. For each http request (example fetch) add an AbortSignal with a proper value.
- if application closes the connection before kong is raised by the application usually +500 http error and this error is returned to the caller.
- write_timeout: from kong to kong. internal stream. Set as 30000 ms
If the client, or the load balancer before kong, close the connection, then kong raise a +499 http error.
Production example
- browser > load balancer (or cloud provider entry point)
- load balancer > kong
- kong > micro
- load balancer close connection
- load balancer raises tipically a http +502 error (or another 5xx)
- kong raises http +499 (because it’s nginx based)
In this scenario the advise is to increment load balancer timeout properly
0 Comments