Skip to content

Commit

Permalink
feat(producer): add batch queue when batch size limit reached
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveigah committed Sep 17, 2023
1 parent d325275 commit d25c4df
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 170 deletions.
9 changes: 5 additions & 4 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ config :klife,
linger_ms: 100
},
%{
name: :my_no_batch_producer,
client_id: "my_no_batch_producer",
name: :benchmark_producer,
client_id: "my_custom_client_id",
max_in_flight_requests: 1
}
],
topics: [
%{name: "benchmark_topic", producer: :benchmark_producer},
%{
name: "my_batch_topic",
enable_produce: true,
Expand All @@ -41,8 +43,7 @@ config :klife,
},
%{
name: "my_no_batch_topic",
enable_produce: true,
producer: :my_no_batch_producer
enable_produce: true
}
]
]
Expand Down
18 changes: 17 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import Config

# KAFKA EX BENCHMARK
# kafka_ex benchmark
config :kafka_ex,
brokers: [
{"localhost", 19092},
{"localhost", 29092}
],
kafka_version: "kayrock"

# Brod benchmark
config :brod,
clients: [
kafka_client: [
endpoints: [localhost: 19092, localhost: 29092],
auto_start_producers: true,
default_producer_config: [
required_acks: -1,
partition_onwire_limit: 1,
max_linger_ms: 0,
max_batch_size: 512_000
]
]
]
1 change: 0 additions & 1 deletion lib/klife/producer/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ defmodule Klife.Producer.Controller do

import Klife.ProcessRegistry

require Logger
alias KlifeProtocol.Messages
alias Klife.Connection.Broker
alias Klife.Utils
Expand Down
Loading

0 comments on commit d25c4df

Please sign in to comment.