WeaviateEx.Config.Connection (WeaviateEx v0.7.4)

View Source

Connection pool configuration for HTTP and gRPC connections.

Fine-tune connection settings for high-load production scenarios.

Examples

# Create client with custom connection pool
{:ok, client} = Client.connect(
  base_url: "http://localhost:8080",
  connection: Connection.new(
    pool_size: 20,
    max_connections: 200,
    pool_timeout: 10_000
  )
)

# Or pass options directly
{:ok, client} = Client.connect(
  base_url: "http://localhost:8080",
  connection: [
    pool_size: 20,
    max_connections: 200
  ]
)

Summary

Functions

Create a new connection configuration.

Convert to Finch pool options.

Convert to gRPC channel options.

Types

t()

@type t() :: %WeaviateEx.Config.Connection{
  max_connections: pos_integer(),
  max_idle_time: pos_integer(),
  pool_size: pos_integer(),
  pool_timeout: pos_integer()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Create a new connection configuration.

Options

  • :pool_size - Number of connections to keep in pool (default: 10)
  • :max_connections - Maximum total connections (default: 100)
  • :pool_timeout - Timeout for acquiring connection from pool in ms (default: 5000)
  • :max_idle_time - Max idle time before closing connection in ms (default: 60000)

Examples

Connection.new(pool_size: 20, max_connections: 200)

to_finch_opts(config)

@spec to_finch_opts(t()) :: keyword()

Convert to Finch pool options.

Examples

config = Connection.new(pool_size: 15)
opts = Connection.to_finch_opts(config)
# => [size: 15, count: 6, pool_timeout: 5000]

to_grpc_opts(config)

@spec to_grpc_opts(t()) :: keyword()

Convert to gRPC channel options.

Examples

config = Connection.new(max_connections: 50)
opts = Connection.to_grpc_opts(config)