diff --git a/lib/xandra.ex b/lib/xandra.ex index 3b49474e..a4f0087e 100644 --- a/lib/xandra.ex +++ b/lib/xandra.ex @@ -448,7 +448,9 @@ defmodule Xandra do doc: """ Options to forward to the socket transport. If the `:encryption` option is `true`, then the transport is SSL (see the Erlang `:ssl` module) otherwise it's - TCP (see the `:gen_tcp` Erlang module). + TCP (see the `:gen_tcp` Erlang module). The `:buffer` option (`t:pos_integer/0`), + which controls the size of the user level buffer in use by the active mode + socket, defaults to `1_000_000` bytes. """ ], diff --git a/lib/xandra/connection.ex b/lib/xandra/connection.ex index 1c284f23..8e933833 100644 --- a/lib/xandra/connection.ex +++ b/lib/xandra/connection.ex @@ -19,6 +19,10 @@ defmodule Xandra.Connection do @forced_transport_options [packet: :raw, mode: :binary, active: false] + # The default size of the user-level buffer used by the driver + # We will receive at most this many bytes from the active mode socket + @default_transport_buffer_size 1_000_000 + # How old a timed-out stream ID can be before we flush it. @max_timed_out_stream_id_age_in_millisec :timer.minutes(5) @@ -410,6 +414,7 @@ defmodule Xandra.Connection do options: options |> Keyword.get(:transport_options, []) + |> Keyword.put_new(:buffer, @default_transport_buffer_size) |> Keyword.merge(@forced_transport_options) }