> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/development-guide/sdk/sdk-latency.md).

# SDK 레이턴시

핵클 SDK는 저장된 설정을 사용해 A/B 테스트, 기능 플래그, 원격 구성의 분배를 로컬에서 처리합니다.\
분배 과정에서는 네트워크를 호출하지 않습니다.

{% hint style="info" %}

* SDK는 초기화 시 핵클 서버에서 설정을 가져옵니다.
* 이벤트는 내부에 저장한 뒤, 정해진 주기로 비동기 일괄 전송합니다.
* `track()` 호출 자체는 네트워크를 호출하지 않습니다.
  {% endhint %}

클라이언트, 서버 SDK는 각 환경의 특성에 맞춰 설계되었으며, 이에 따라 동작 로직에 미세한 차이가 있습니다.

### Client-side SDK

```mermaid
sequenceDiagram
    participant App as 클라이언트 앱
    participant SDK as Hackle SDK
    participant Server as 핵클 서버

    App->>SDK: SDK 초기화
    alt 로컬 평가
        SDK->>Server: 워크스페이스 설정 정보 요청
        Server-->>SDK: 워크스페이스 설정 정보 반환
        SDK->>SDK: 설정 정보 저장
        App->>SDK: 분배·결정 호출
        SDK->>SDK: 저장된 설정으로 직접 평가
        SDK-->>App: 평가 결과 반환
    else 원격 평가
        SDK->>Server: 사용자 정보 전달
        Server->>Server: 사용자 평가
        Server-->>SDK: 평가 결과 반환
        SDK->>SDK: 평가 결과 저장
        App->>SDK: 분배·결정 호출
        SDK->>SDK: 저장된 평가 결과 조회
        SDK-->>App: 평가 결과 반환
    end
    App->>SDK: track() 호출
    SDK->>Server: 이벤트 비동기 일괄 전송
```

1. SDK 초기화시 대시보드에 설정된 정보를 SDK로 가져와서 저장합니다. 주기적으로 가져오게 하거나, 직접 가져올 수도 있습니다
2. A/B 테스트, 기능플래그, 원격구성 호출시 네트워크 호출 없이 SDK 내부에 저장된 설정정보만 가지고 처리가 됩니다. 이벤트 전송 호출시 서버로 즉시 전송하지 않고 내부 저장소에만 저장해 놓습니다.
3. 주기적으로 백그라운드 작업을 통해 수집된 이벤트들을 핵클 서버로 비동기로 전송합니다. 앱이 종료되거나 웹사이트가 닫힐 때 남아있는 이벤트를 핵클 서버로 전송합니다.

### Server-side SDK

```mermaid
sequenceDiagram
    participant App as 서버 애플리케이션
    participant SDK as Hackle SDK
    participant Server as 핵클 서버

    App->>SDK: SDK 초기화
    SDK->>Server: 워크스페이스 설정 정보 요청
    Server-->>SDK: 워크스페이스 설정 정보 반환
    SDK->>SDK: 설정 정보 저장
    loop 10초마다
        SDK->>Server: 최신 설정 정보 요청
        Server-->>SDK: 최신 설정 정보 반환
        SDK->>SDK: 설정 정보 갱신
    end
    App->>SDK: 분배·결정 호출
    SDK->>SDK: 저장된 설정으로 직접 평가
    SDK-->>App: 평가 결과 반환
    App->>SDK: track() 호출
    SDK->>Server: 이벤트 비동기 일괄 전송
```

1. SDK 초기화시 대시보드에 설정된 정보를 SDK로 가져와서 저장합니다. 이후 10초마다 최신 설정 정보를 가져옵니다
2. A/B 테스트, 기능플래그, 원격구성 호출시 네트워크 호출 없이 SDK 내부에 저장된 설정정보만 가지고 처리가 됩니다. 이벤트 전송 호출시 서버로 즉시 전송하지 않고 내부 저장소에만 저장해 놓습니다.
3. 주기적으로 백그라운드 작업을 통해 수집된 이벤트들을 핵클 서버로 비동기로 전송합니다.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/development-guide/sdk/sdk-latency.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
