antonputra / tutorials

DevOps Tutorials
https://youtube.com/antonputra
MIT License
3.19k stars 2.5k forks source link

About the Golang stream client #322

Open Gsantomaggio opened 4 weeks ago

Gsantomaggio commented 4 weeks ago

Hi Anton, About the Golang streaming client, here, you used the default settings.

Default settings are more throughput-oriented; the client aggregates the messages and sends them every 100 milliseconds by default. or when the Batch-Size is reached.

You could reduce the timing with

producer, err := env.NewProducer(streamName,stream.NewProducerOptions().SetBatchPublishingDelay(10))

or reduce the batchSize with stream.NewProducerOptions().SetBatchSize(50)

There is also another API, BatchSend, where the aggregation part is up to the user. The API is synchronous.

Please read: https://github.com/rabbitmq/rabbitmq-stream-go-client?tab=readme-ov-file#send-vs-batchsend

and also: https://groups.google.com/g/rabbitmq-users/c/IO_9-BbCzgQ

I hope this helps :)!

antonputra commented 2 weeks ago

thanks, @Gsantomaggio. kafka is a complicated system with a bunch of settings that you can tune and optimize either for latency or throughput, but i appreciate your help. i'll see if i can make any adjustments for the next benchmark between kafka and nats

Gsantomaggio commented 2 weeks ago

well, actually, I was speaking about the RabbitMQ Golang client :)

antonputra commented 2 weeks ago

@Gsantomaggio sorry about that, i usually dive deeper only when i'm working on a specific benchmark

Gsantomaggio commented 2 weeks ago

No problem. I need to include some information on this issue. My fault

That's the benchmark: https://www.youtube.com/watch?v=UPkOsXKG4ns

btw don't worry.