> 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/en/development-guide/sdk/sdk-latency.md).

# SDK Latency

The Hackle SDK uses stored configuration to process A/B Test, Feature Flag, and Remote Config distribution locally.\
No network call is made during the distribution process.

{% hint style="info" %}

* The SDK fetches configuration from the Hackle server during initialization.
* Events are stored internally and then sent asynchronously in batches at regular intervals.
* The `track()` call itself does not make a network call.
  {% endhint %}

Client and Server SDKs are designed to match the characteristics of their respective environments, and there are minor differences in how they behave accordingly.

### Client-side SDK

```mermaid
sequenceDiagram
    participant App as Client App
    participant SDK as Hackle SDK
    participant Server as Hackle Server

    App->>SDK: Initialize SDK
    alt Local Evaluation
        SDK->>Server: Request workspace configuration
        Server-->>SDK: Return workspace configuration
        SDK->>SDK: Store configuration
        App->>SDK: Call distribution/decision
        SDK->>SDK: Evaluate directly with stored configuration
        SDK-->>App: Return evaluation result
    else Remote Evaluation
        SDK->>Server: Send user information
        Server->>Server: Evaluate user
        Server-->>SDK: Return evaluation result
        SDK->>SDK: Store evaluation result
        App->>SDK: Call distribution/decision
        SDK->>SDK: Look up stored evaluation result
        SDK-->>App: Return evaluation result
    end
    App->>SDK: Call track()
    SDK->>Server: Send events asynchronously in batches
```

1. During SDK initialization, configuration data set in the Dashboard is fetched and stored in the SDK. You can also fetch it periodically or on demand.
2. When calling A/B tests, Feature Flags, or Remote Config, the operation is processed using only the configuration data stored inside the SDK, with no network call. When calling event tracking, events are not sent to the server immediately but are only stored in internal storage.
3. Collected events are periodically sent to the Hackle server asynchronously via background tasks. When the app closes or the website is navigated away from, any remaining events are sent to the Hackle server.

### Server-side SDK

```mermaid
sequenceDiagram
    participant App as Server Application
    participant SDK as Hackle SDK
    participant Server as Hackle Server

    App->>SDK: Initialize SDK
    SDK->>Server: Request workspace configuration
    Server-->>SDK: Return workspace configuration
    SDK->>SDK: Store configuration
    loop Every 10 seconds
        SDK->>Server: Request latest configuration
        Server-->>SDK: Return latest configuration
        SDK->>SDK: Update configuration
    end
    App->>SDK: Call distribution/decision
    SDK->>SDK: Evaluate directly with stored configuration
    SDK-->>App: Return evaluation result
    App->>SDK: Call track()
    SDK->>Server: Send events asynchronously in batches
```

1. During SDK initialization, configuration data set in the Dashboard is fetched and stored in the SDK. The latest configuration data is then fetched every 10 seconds.
2. When calling A/B tests, Feature Flags, or Remote Config, the operation is processed using only the configuration data stored inside the SDK, with no network call. When calling event tracking, events are not sent to the server immediately but are only stored in internal storage.
3. Collected events are periodically sent to the Hackle server asynchronously via background tasks.


---

# 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/en/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.
