Php-rdkafka: Can I use the chunk function?

Created on 27 Sep 2019  Β·  11Comments  Β·  Source: arnaud-lb/php-rdkafka

  • PHP version: 7.3
  • librdkafka version:
    librdkafka version (runtime) => 0.11.3
    librdkafka version (build) => 0.11.3.255
  • php-rdkafka version: how can I know on ubuntu?
  • kafka version: kafka_2.12-2.3.0

Can I use the chunk function?
I'm wondering if it's going to be implemented.
If you can use it, I hope you have a friendly example.
My particular message is so big that I need the Chunk feature.

thx.

question

All 11 comments

@fwang-laralabs afaik this is not implemented atm, can you maybe quickly elaborate what it does and what you need it for?

My specific message size is 1245858 (1.24k).
I need the ability to send messages in pieces.
I'm producing a message but it's not displaying in the consumer console. (Other messages are well consumed.)
It would be convenient to have a chunk-like interface for laravel collections.
(https://laravel.com/docs/5.8/collections#method-chunk)

@nick-zh what is atm?

atm = at the moment :smiley:

@fwang-laralabs ah ok i understand, i might be mistaken, but i think Kafka doesn't have this feature.
So unless i am mistaken, there are mutiple solutions:

  • Either allow the message size to be higher (can be configured through message.max.bytes on producer and broker)
  • or you chunk it up yourself and add metadata to the headers, so your header could contain a chunk_group_id and a chunk_sequence or something similar to achieve this
    Unless there is a Kafka feature that i have overseen (if so please let me know), i don't think this will be added to the extension, since the need can be covered in the app

@fwang-laralabs regarding implementing this in your application, maybe this article helps, it elaborates a bit more how you would do this on the producer / consumer side:
https://medium.com/workday-engineering/large-message-handling-with-kafka-chunking-vs-external-store-33b0fc4ccf14

.../opt/kafka/config# vi /opt/kafka/config/server.properties

message.max.bytes=10000000

server.properties 에 μˆ˜μ •ν•˜κ³  ν…ŒμŠ€νŠΈ ν•΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€.
μ •μƒλ™μž‘ν•˜μ§€ μ•Šμ•„μ„œ, producer μͺ½λ„ μˆ˜μ •ν•΄ λ³΄μ•˜μŠ΅λ‹ˆλ‹€.
.../opt/kafka/config# vi /opt/kafka/config/producer.properties
max.request.size=10000000

ν•˜μ§€λ§Œ μ—¬μ „νžˆ 큰 λ©”μ„Έμ§€λŠ” λ™μž‘ ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. :(

이에 λŒ€ν•œ 뢀뢄을 μ°Ύκ³  μžˆμŠ΅λ‹ˆλ‹€.

chunking 을 ν• μ§€, μ„œλ²„ μˆ˜μ •μ„ ν†΅ν•œ 큰 λ©”μ„Έμ§€ 전달이 κ°€λŠ₯ν•˜λ„λ‘ ν• μ§€ κ³ λ―Όμ€‘μž…λ‹ˆλ‹€.

λ‹Ήμ‹ μ˜ λ‹΅λ³€ κ°μ‚¬ν•©λ‹ˆλ‹€.

for the producer you also need to set the setting message.max.bytes (PHP)

Can I do this?
$pconf = new Conf();
$pconf->set("message.max.bytes", 10000000 );
$this->producer = new Producer( $pconf );

Let's try it.
Thank you for your kind reply. :)

@fwang-laralabs yes, this should work if the broker is set correctly as well :+1:
Let me know if it works

Works fine. Thanks to :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eailyass picture eailyass  Β·  6Comments

remizyaka picture remizyaka  Β·  7Comments

aand18 picture aand18  Β·  10Comments

denisgolius picture denisgolius  Β·  3Comments

atrauzzi picture atrauzzi  Β·  7Comments