Skip to content

Allow Clients to Configure OkHttpClient for Improved Performance #615

@kamilReady

Description

@kamilReady

Is your feature request related to a problem? Please describe.

The SDK doesn't allow clients to configure the OkHttpClient instance used for network operations. This creates a serious performance drawback since each app should maintain a single OkHttpClient instance to share thread pools and connection pools. Multiple instances lead to increased memory usage and reduced efficiency.

Describe the solution you'd like

Add a mechanism for clients to supply their own OkHttpClient instance during SDK initialization. This would enable:

  • Sharing a single OkHttpClient across the entire application
  • Reusing connection pools and thread pools

Describe alternatives you've considered

Exposing configuration options within the SDK would help but still results in multiple OkHttpClient instances if the client uses their own instance elsewhere, defeating the purpose of resource sharing.

Additional context

The OkHttp documentation recommends creating a single OkHttpClient instance and reusing it for all HTTP calls: "each client holds its own connection pool and thread pools. Reusing connections and threads reduces latency and saves memory."

This feature would align the SDK with best practices and allow developers to optimize their applications' network performance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions