sparkstreaming对接kafka数据,在idea程序上出现警告信息并卡住不动的解决办法

spark jira 用中文的同学看了我笑了,牛啊
在这里插入图片描述
Unexpected delay before fetch response transmission

Details

Type:Bug
Status:Open
Priority:  Major
Resolution: Unresolved
Affects Version/s:
0.9.0.0, 0.9.0.1, 0.10.0.0, (3)
0.10.0.1, 0.10.1.0, 0.10.1.1
Fix Version/s:None
Component/s:None
Labels:None

Description

From the user list, Krzysztof Ciesielski reports the following:

Scenario description:
First, a producer writes 500000 elements into a topic
Then, a consumer starts to read, polling in a loop.
When "max.partition.fetch.bytes" is set to a relatively small value, each
"consumer.poll()" returns a batch of messages.
If this value is left as default, the output tends to look like this:

Poll returned 13793 elements
Poll returned 13793 elements
Poll returned 13793 elements
Poll returned 13793 elements
Poll returned 0 elements
Poll returned 0 elements
Poll returned 0 elements
Poll returned 0 elements
Poll returned 13793 elements
Poll returned 13793 elements

As we can see, there are weird "gaps" when poll returns 0 elements for some
time. What is the reason for that? Maybe there are some good practices
about setting "max.partition.fetch.bytes" which I don't follow?

The gist to reproduce this problem is here: https://gist.github.com/kciesielski/054bb4359a318aa17561.

After some initial investigation, the delay appears to be in the server’s networking layer. Basically I see a delay of 5 seconds from the time that Selector.send() is invoked in SocketServer.Processor with the fetch response to the time that the send is completed. Using netstat in the middle of the delay shows the following output:

tcp4       0      0  10.191.0.30.55455      10.191.0.30.9092       ESTABLISHED
tcp4       0 102400  10.191.0.30.9092       10.191.0.30.55454      ESTABLISHED

From this, it looks like the data reaches the send buffer, but needs to be flushed.

rangadi Raghu Angadi added a comment - 17/Mar/16 07:37

This shows server is ok. It is trying to send and already flushed/wrote on its end of the tcp connection. If you check netstat for the side of the connection (local port 55454) you should see data in receive buffers. Still don’t know why consumer is not reading.
I am also seeing similar weird behavior. with 64K receiver buffer reduces the intensity of the problem, but does not fix it.

Jason Gustafson added a comment - 28/Mar/16 22:12

I made a little progress understanding this problem. The 5 second pause that we’re seeing is caused by the TCP persist timer, which kicks in when the remote window size gets small enough. You can see this by watching the traffic through tcpdump and confirming the persist timeout event with ‘netstat -s’. Clearly there are some cases where the client is not reading the data off the socket fast enough, which is causing the window size to fall and the server to back off.

解决办法:

2021-03-17 11:16:56,711 WARN — [ main] org.apache.spark.streaming.kafka010.KafkaUtils (line: 66) : overriding enable.auto.commit to false for executor
2021-03-17 11:16:56,714 WARN — [ main] org.apache.spark.streaming.kafka010.KafkaUtils (line: 66) : overriding auto.offset.reset to none for executor
2021-03-17 11:16:56,714 WARN — [ main] org.apache.spark.streaming.kafka010.KafkaUtils (line: 66) : overriding executor group.id to spark-executor-recommender
2021-03-17 11:16:56,715 WARN — [ main] org.apache.spark.streaming.kafka010.KafkaUtils (line: 66) : overriding receive.buffer.bytes to 65536

zk的提交offset设置和receive.buffer.bytes =65536

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值