위의 예시에서 볼 수 있듯이 대상 요청이 기본 대상 제한 시간 한도인 55초를 초과했습니다. 시간 한도는 구성할 수 있으며 제한 시간을 변경한 경우 대상 요청 소요 시간은 설정한 제한 시간과 일치합니다. 예를 들어 제한 시간이 10초라면 이 시나리오에서는 대상 요청이 10초 후에 시간 초과됩니다. 이러한 '느린 대상' 동작은 대상이 제시간에 요청에 응답하지 않음을 명확하게 나타냅니다.
해결 방법
Apigee에서는 느린 대상을 사용하지 않는 것이 좋습니다.
예를 들어 정상 대상 지연 시간이 50ms이고 지연 시간이 55,000ms이면 대상에 문제가 있는지 조사해야 할 수 있습니다.
제한 시간을 늘려야 하면 다음 단계를 수행합니다.
프록시 편집기에서 개발 탭을 클릭합니다.
탐색창에서 영향을 받는 대상 엔드포인트를 선택합니다.
XML 편집기에서 HTTPTargetConnection XML 요소를 찾습니다.
<HTTPTargetConnection> 요소 아래에 io.timeout.millis 속성을 추가하고 새 시간 제한을 밀리초 단위로 지정합니다. 예를 들면 다음과 같습니다.
Apigee는 <LoadBalancer> 엔드포인트 속성을 구성할 때 연결 문제의 정확한 원인을 공개하지 않습니다. 하지만 대상 요청의 경과 시간에서 연결 문제의 원인을 유추할 수 있습니다. 디버깅 메서드로 <LoadBalancer> 요소를 모두 삭제하고 프록시에서 직접 대상에 도달해 볼 수 있습니다.
위의 예시에서는 시간 초과가 발생하는 데 9초가 걸렸습니다. 55초가 아니기 때문에 느린 대상으로 인해 제한 시간이 초과된 것이 오류의 원인입니다.
기본적으로 <LoadBalancer> 요소가 TargetEndpoint에 사용된 경우 Apigee는 연결을 두 번 더 재시도합니다. 연결이 총 3회 시도되었고 연결 오류의 기본 제한 시간이 3초(connect.timeout.millis)임을 알고 있으므로 문제가 연결 문제라고 가정할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eThis document addresses \u003ccode\u003eGateway Timeout\u003c/code\u003e errors (HTTP status \u003ccode\u003e504\u003c/code\u003e) in Apigee and Apigee hybrid, specifically related to the \u003ccode\u003eTARGET_READ_TIMEOUT\u003c/code\u003e reason.\u003c/p\u003e\n"],["\u003cp\u003eThe default target read timeout in Apigee is 55 seconds, and requests exceeding this limit will result in a timeout error unless the timeout limit is configured to a new value, which has a maximum limit of 300 seconds.\u003c/p\u003e\n"],["\u003cp\u003eA "slow target" and a "TargetServer connectivity issue" are the two primary causes for a target timeout, with instructions provided on how to diagnose them using the Apigee Debug Tool.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve a slow target issue, it's recommended to avoid slow targets or increase the timeout period by modifying the \u003ccode\u003eio.timeout.millis\u003c/code\u003e property in the TargetEndpoint configuration.\u003c/p\u003e\n"],["\u003cp\u003eFor target connectivity issues, the \u003ccode\u003e<LoadBalancer>\u003c/code\u003e element can be removed temporarily for a more precise diagnosis, and if the issue remains, there is a requirement of diagnostic information for support.\u003c/p\u003e\n"]]],[],null,["# 504 Gateway timeout - Target read timeout\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nThere is no equivalent\n[Apigee Edge](https://docs.apigee.com/api-platform/get-started/get-started) documentation for this topic.*\n\nSymptom\n-------\n\n\nThis issue appears as a `Gateway Timeout` error with HTTP status `504`.\n\nError Message\n-------------\n\nYou may see this error in [API Monitoring](/apigee/docs/api-monitoring/investigate), [Debug](/apigee/docs/api-platform/debug/trace), or other tools. The `TARGET_READ_TIMEOUT` reason indicates that Apigee runtime did not receive a timely response from the target during the execution of a request.\n\n\u003cbr /\u003e\n\n\nThe default target read timeout value\n([io.timeout.millis](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification))\nis 55 seconds. Which means that if after 55 seconds the target doesn't respond, Apigee throws\nthis error: \n\n```\n{\"fault\":{\"faultstring\":\"Gateway Timeout\",\n \"detail\":{\"errorcode\":\"messaging.adaptors.http.flow.GatewayTimeout\",\n \"reason\":\"TARGET_READ_TIMEOUT\"}}}\n```\n\nPossible Causes\n---------------\n\nCause: Slow Target\n------------------\n\n### Diagnosis\n\n\nYou can diagnose a slow target issue using the Apigee [Debug Tool](/apigee/docs/api-platform/debug/trace):\n\n1. Create a [debug session](/apigee/docs/api-platform/debug/trace#create) for your API proxy.\n2. In the debug session, send a request and inspect the debug output.\n\n\nAs you can see in the example above, the Target Request exceeded 55 seconds, which is the\n[default\ntarget timeout](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification)\nlimit. The time limit is configurable, and if you have changed the timeout, then the duration\nof the Target Request will match the timeout you set. For instance, if your timeout is 10 seconds,\nthen in that scenario a target request will timeout after 10 seconds. Such \"slow target\" behavior is a clear\nindication that the target is not responding to a request in time.\n\n### Resolution\n\nApigee recommends that you avoid using [slow targets](/apigee/docs/api-platform/antipatterns/slow-backend).\nFor example, if normal target latency is 50 ms, and you experience a latency of 55000 ms, you\nmay need to investigate if there is a problem with the target.\n\n\nIf you must increase the timeout, follow these steps:\n\n1. Click on the **Develop** tab in the proxy editor.\n2. In the navigation pane, select the affected target endpoint.\n3. In the XML editor, find the `HTTPTargetConnection` XML element: \n\n\n4. Add the `io.timeout.millis` property under the `\u003cHTTPTargetConnection\u003e` element and specify the new time limit in milliseconds, for example: \n\n ```text\n \u003cHTTPTargetConnection\u003e\n \u003cURL\u003ehttps://my-very-slow-target.example.com\u003c/URL\u003e\n \u003cProperties\u003e\n \u003cProperty name=\"io.timeout.millis\"\u003e120000\u003c/Property\u003e\n \u003c/Properties\u003e\n \u003c/HTTPTargetConnection\u003e\n ```\n\n\n In the example above the timeout is increased to 120 seconds. Note that 300 seconds\n is the maximum limit. For further information, see\n [Endpoints\n property reference](/apigee/docs/api-platform/reference/endpoint-properties-reference).\n5. Save the new revision and deploy the proxy.\n\n\nIf the problem persists, go to [Must gather\ndiagnostic information](#mustgatherinfo) below.\n\n\nCause: TargetServer connectivity issue\n--------------------------------------\n\n\u003cbr /\u003e\n\n### Diagnosis\n\n\nApigee does not reveal the exact cause of a connectivity issue when you configure the\n[\u003cLoadBalancer\u003e](/apigee/docs/api-platform/deploy/load-balancing-across-backend-servers#configuringatargetendpointtoloadbalanceacrossnamedtargetservers)\nendpoint property. You may be able to infer the cause of a connectivity problem, however,\nfrom the elapsed time of the Target Request. As a debugging method, you can try to remove\nthe `\u003cLoadBalancer\u003e` element altogether, and try to hit the target directly in the proxy.\n\n\nTo diagnose the issue, use the [Debug Tool](/apigee/docs/api-platform/debug/trace).\n\n1. Create a [debug session](/apigee/docs/api-platform/debug/trace#create) for your API proxy.\n2. In the debug session, send a request and inspect the debug output.\n\n\n\u003cbr /\u003e\n\n\nIn the example above, it took nine seconds for a timeout to occur. Since it is not 55 seconds,\nyou know the cause of the error is not that the timeout limit was exceeded due to a slow target.\nBy default, Apigee retries a connection two additional times if the `\u003cLoadBalancer\u003e` element\nis used on the TargetEndpoint. Because you know that connection has been attempted three times\nin total, and the default timeout for a connection error is three seconds\n([connect.timeout.millis](/apigee/docs/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification)),\nyou can assume that the issue is a connectivity issue.\n\n### Resolution\n\n\nIf the issue is confirmed to be a connection timeout, see [VPC Peering 503 Service Unavailable error with TARGET_CONNECT_TIMEOUT](/apigee/docs/api-platform/troubleshoot/playbooks/runtime/vpc-503-target-connect-timeout).\n\n\nFor other issues, remove the `\u003cLoadBalancer\u003e`\nelement to debug and reveal the exact\nerror code, and check for the code in the\n[error catalog](/apigee/docs/api-platform/errorcatalog/mp-runtime-errorcatalog).\n\nMust Gather Diagnostic Information\n----------------------------------\n\n\nIf the problem persists even after following the above instructions, gather the following\ndiagnostic information and then contact [Google\nCloud Support](https://cloud.google.com/support-hub):\n\n1. Project ID and the Apigee organization name\n2. Proxy name(s) and the environment.\n3. Time-frame of the issue.\n4. Frequency of the issue\n5. Target hostname.\n6. [Debug session](/apigee/docs/api-platform/debug/trace#download) with the issue."]]