Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AI_DOCUMENT_CONVERSION_ENDPOINT=http://127.0.0.1:8000/api/v1/documents/convert
AI_DOCUMENT_CONVERSION_TIMEOUT=60s
# AI_RUNTIME_SERVICE_CREDENTIAL=
AI_RUNTIME_CONNECT_TIMEOUT=2s
AI_RUNTIME_OVERALL_TIMEOUT=240s
AI_RUNTIME_OVERALL_TIMEOUT=300s
AI_RUNTIME_MAX_RESPONSE_BYTES=1048576
AI_DOCUMENT_GENERATION_MAX_RESPONSE_BYTES=20971520
AI_RUNTIME_MAX_CONCURRENT_CALLS=8
Expand Down
4 changes: 2 additions & 2 deletions docs/ai-runtime-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Slot 조회와 ANALYZE 호출은 수행하지 않습니다. 따라서 지원하
`AiAnalysisRequest`에 유지하지만 HTTP JSON에는 넣지 않습니다.

한 번의 PLAN 또는 ANALYZE 호출 제한시간은 `AI_RUNTIME_OVERALL_TIMEOUT`을 단일 기준으로
사용합니다. 기본값은 실제 A.X CPU 추론 시간을 수용하는 `240s`이고 계약상 최대값은
사용합니다. 기본값은 실제 A.X CPU 추론 시간을 수용하는 `300s`이고 계약상 최대값은
`5m`입니다. Client 요청은 먼저 `202 + aiRunId`를 반환하므로 이 제한시간 동안 HTTP 화면
요청을 붙잡지 않으며, 진행 상태는 SSE와 조회 API로 제공합니다.

Expand Down Expand Up @@ -378,7 +378,7 @@ AI_RUNTIME_SERVICE_CREDENTIAL=<배포 환경 Secret>
| 설정 | 기본값 | 의미 |
| --- | --- | --- |
| `AI_RUNTIME_CONNECT_TIMEOUT` | `2s` | AI 서버에 TCP 연결을 맺을 수 있는 최대 시간 |
| `AI_RUNTIME_OVERALL_TIMEOUT` | `15s` | 연결·요청·응답 수신 전체의 Server 상한 |
| `AI_RUNTIME_OVERALL_TIMEOUT` | `300s` | 연결·요청·응답 수신 전체의 Server 상한 |
| `AI_RUNTIME_MAX_RESPONSE_BYTES` | `1048576` | 응답을 메모리에 받기 전 적용하는 최대 크기 |
| `AI_DOCUMENT_GENERATION_ENDPOINT` | `http://127.0.0.1:8000/api/v1/documents/generate` | Renewal 문서 생성 API |
| `AI_DOCUMENT_CONVERSION_ENDPOINT` | `http://127.0.0.1:8000/api/v1/documents/convert` | HWP·HWPX를 PDF 미리보기로 변환하는 API |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class AiRuntimeProperties implements AiRuntimeDeadlinePolicy {
private URI documentConversionEndpoint = URI.create("http://127.0.0.1:8000/api/v1/documents/convert");
private String serviceCredential;
private Duration connectTimeout = Duration.ofSeconds(2);
private Duration overallTimeout = Duration.ofMinutes(4);
private Duration overallTimeout = Duration.ofMinutes(5);
private Duration documentConversionTimeout = Duration.ofSeconds(60);
private int maxResponseBytes = 1_048_576;
private int maxDocumentResponseBytes = MAX_DOCUMENT_RESPONSE_BYTES;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ app:
document-conversion-timeout: ${AI_DOCUMENT_CONVERSION_TIMEOUT:60s}
service-credential: ${AI_RUNTIME_SERVICE_CREDENTIAL:}
connect-timeout: ${AI_RUNTIME_CONNECT_TIMEOUT:2s}
overall-timeout: ${AI_RUNTIME_OVERALL_TIMEOUT:240s}
overall-timeout: ${AI_RUNTIME_OVERALL_TIMEOUT:300s}
max-response-bytes: ${AI_RUNTIME_MAX_RESPONSE_BYTES:1048576}
max-document-response-bytes: ${AI_DOCUMENT_GENERATION_MAX_RESPONSE_BYTES:20971520}
max-concurrent-calls: ${AI_RUNTIME_MAX_CONCURRENT_CALLS:8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
class AiRuntimePropertiesTest {

@Test
void usesFourMinuteDeadlineByDefault() {
void usesFiveMinuteDeadlineByDefault() {
AiRuntimeProperties properties = new AiRuntimeProperties();

assertThat(properties.getOverallTimeout()).isEqualTo(Duration.ofMinutes(4));
assertThat(properties.attemptDeadlineMs()).isEqualTo(240_000L);
assertThat(properties.getOverallTimeout()).isEqualTo(Duration.ofMinutes(5));
assertThat(properties.attemptDeadlineMs()).isEqualTo(300_000L);
assertThat(properties.getDocumentConversionTimeout()).isEqualTo(Duration.ofSeconds(60));
}

@Test
void usesConfiguredOverallTimeoutAsAttemptDeadline() {
AiRuntimeProperties properties = new AiRuntimeProperties();

properties.setOverallTimeout(Duration.ofSeconds(180));
properties.setOverallTimeout(Duration.ofSeconds(300));

assertThat(properties.getOverallTimeout()).isEqualTo(Duration.ofSeconds(180));
assertThat(properties.attemptDeadlineMs()).isEqualTo(180_000L);
assertThat(properties.getOverallTimeout()).isEqualTo(Duration.ofSeconds(300));
assertThat(properties.attemptDeadlineMs()).isEqualTo(300_000L);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void createsQueriesAnswersAndFinishesOneWorkerAnalysis() throws Exception {
ArgumentCaptor<AiAnalysisRequest> requestCaptor = ArgumentCaptor.forClass(AiAnalysisRequest.class);
verify(runtimeClient, atLeast(3)).analyze(requestCaptor.capture(), any());
assertThat(requestCaptor.getAllValues())
.allSatisfy(request -> assertThat(request.deadlineMs()).isEqualTo(240_000L));
.allSatisfy(request -> assertThat(request.deadlineMs()).isEqualTo(300_000L));
assertThat(stageCount("PLAN", "PLAN_RUNTIME_CALL", "SUCCESS") - planBefore)
.isEqualTo(1);
assertThat(stageCount("ANALYZE", "SLOT_RESOLUTION", "SUCCESS") - slotBefore)
Expand Down
Loading