java.lang.IllegalStateException: Buffer overflow when available data size (16384) >= application buffer size (16384)
at org.apache.kafka.common.network.SslTransportLayer.read(SslTransportLayer.java:592)
at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:95)
at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:448)
at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:398)
at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:678)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:580)
at org.apache.kafka.common.network.Selector.poll(Selector.java:485)
at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:549)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:262)
at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:233)
at org.apache.kafka.clients.consumer.KafkaConsumer.pollForFetches(KafkaConsumer.java:1308)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1248)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1216)
at kafka.tools.ConsumerPerformance$.consume(ConsumerPerformance.scala:126)
at kafka.tools.ConsumerPerformance$.main(ConsumerPerformance.scala:56)
at kafka.tools.ConsumerPerformance.main(ConsumerPerformance.scala)
This could happen because of the Java Security provider sequence differences. In order to fix this you need to check what is the sequence of Java security provider on client and server. In order to confirm this check "jre/lib/security/java.security" file under Java installation directory. It contains the Java Security provider classes sequence to use.
Make sure both client and server has the same sequence.
Showing posts with label Kafka. Show all posts
Showing posts with label Kafka. Show all posts
Fix: Buffer overflow when available data size...
This is an unusual problem you might face while consuming data from Kafka broker over SSL.
Kafka Performance Benchmarking
Apache Kafka comes with the kafka-*-perf-test tool, which can be used to benchmark the performance of the Kafka cluster. This can be used as the first level of benchmarking tool before you run your production load tests.
Kafka Producer Test
You can use kafka-producer-perf-test to measure the Kafka write performance. The below command demonstrates running the Kafka producer test for 100K records.
bin/kafka-producer-perf-test.sh \
--num-records 100000 --topic test2 \
--record-size 10 --throughput -1 \
--producer.config producer.properties
Once you run the above command you will see the result like below
100000 records sent, 158730.158730 records/sec (1.51 MB/sec), 104.48 ms avg latency, 202.00 ms max latency, 117 ms 50th, 154 ms 95th, 158 ms 99th, 159 ms 99.9th.
The producer.properties should contain details like below
linger.ms=100
acks=1
batch.size=1000
buffer.memory=4294967296
request.timeout.ms=300000
bootstrap.servers=localhost:9092
The "--help" option provides more details on controlling different parameters for the test.Kafka Consumer Test
Similar to the producer test you can run a consumer test as well to measure the read performance from Kafka. The below command demonstrates consumer test on broker localhost and topic test2.
bin/kafka-consumer-perf-test.sh \
--broker-list localhost:9092 \
--consumer.config consumer.properties \
--topic test2 --print-metrics --threads 1 \
--num-fetch-threads 1 --messages 10000 \
--show-detailed-stats
Once you run the consumer perf test with print-metrics it will provide consuming stats as well like below.time, threadId, data.consumed.in.MB, MB.sec, data.consumed.in.nMsg, nMsg.sec, rebalance.time.ms, fetch.time.ms, fetch.MB.sec, fetch.nMsg.sec
2020-10-27 16:33:37:363, 0, 0.0041, 0.0006, 1, 0.1597, 1603816414867, -1603816408604, 0.0000, 0.0000
2020-10-27 16:33:42:384, 0, 842.1655, 167.7278, 211001, 42023.5013, 0, 5021, 167.7278, 42023.5013
You can control different parameters of the consumer test by providing the consumer.properties file as specified belowsecurity.protocol=PLAINTEXT
max.partition.fetch.bytes=30485760
fetch.max.bytes=51971520
fetch.min.bytes=5242880
max.poll.records=500
fetch.max.wait.ms=50
enable.auto.commit=false
auto.offset.reset=earliest
Using Connect-standalone in Kafka with Kerberos cluster
Kafka Connect is a tool for scalably and reliably streaming data between Apache Kafka and other systems. It can also be used in secured Kafka environment. In Kerberixed Kafka installation also you can use the Kafka Connect utilities.
You just have to provide the Java security config and Kerberos config as parameters to connect utils.
Below command shows how can you specify the security properties to the connect-standalone.sh.
The command assumes that you are in the Kafka installation directory.
Here the kafka-jass.config should specify the file path which contains the KafkaClient properties like below.
You just have to provide the Java security config and Kerberos config as parameters to connect utils.
Below command shows how can you specify the security properties to the connect-standalone.sh.
The command assumes that you are in the Kafka installation directory.
bin/connect-standalone.sh connect_standalone.properties source.properties -Djava.security.auth.login.config=kafka-jaas.config -Djava.security.krb5.conf=krb5.conf
Here the kafka-jass.config should specify the file path which contains the KafkaClient properties like below.
KafkaClient { com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true keyTab="" storeKey=true useTicketCache=false serviceName="kafka" principal=" "; };
And the krb5.conf should detail about the KDC server property. Sample shown below.
[libdefaults] renew_lifetime = 7d forwardable = true default_realm = example.com ticket_lifetime = 24h dns_lookup_realm = false dns_lookup_kdc = false default_ccache_name = /tmp/krb5cc_%{uid} #default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5 #default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5 [realms] example.com = { master_kdc = my.master.kdc.com admin_server = my.admin.com kdc = my.kdc.com }If above command does not work of if Kafka connect is not able to use the kerberos config, then update the Kafka-run-class.sh file to pass these security parameters to exec command at the end "-Djava.security.auth.login.config=kafka-jaas.config -Djava.security.krb5.conf=krb5.conf"
Subscribe to:
Posts (Atom)
Caching is a technique used to store frequently accessed data in a temporary storage layer to improve system performance and reduce latency....