当前位置: 首页 > news >正文

网站集约建设报告关键词完整版免费听

网站集约建设报告,关键词完整版免费听,网站建设的技术支持论文,余姚做网站公司起因:车联网项目开发,车辆发生故障需要给三个系统推送消息,故障上报较为频繁,所以为了不阻塞主流程,采用了使用kafka。消费方负责推送并保存推送记录,但在一次压测中发现,实际只发生了10次故障&…

        起因:车联网项目开发,车辆发生故障需要给三个系统推送消息,故障上报较为频繁,所以为了不阻塞主流程,采用了使用kafka。消费方负责推送并保存推送记录,但在一次压测中发现,实际只发生了10次故障,但是推送记录却有30多条。

        问题排查,发现是因为其中一个系统宕机,导致往这个系统推送消息时,一直连接超时,导致每条消息的推送时长被拉长。而且kafka消息拉取参数max-poll-records设置了500,意味着一次会批量拉取500条消息到本地处理,而max.poll.interval.ms参数默认是5分钟,当500条消息处理时长超过5分钟后,就会认为消费者死掉了,触发再均衡,导致同一个消息被重复消费。

解决:

        主要是提高消费者的处理速度,避免不必要的Rebalance。主要采用2种措施:

  1. 减少每次拉去消息数max-poll-records,从500,降到20
  2. 拉取到消息之后异步处理(创建线程池,对推送消息的部分利用多线程处理)

常见配置

fetch.min.byte:配置Consumer一次拉取请求中能从Kafka中拉取的最小数据量,默认为1B,如果小于这个参数配置的值,就需要进行等待,直到数据量满足这个参数的配置大小。调大可以提交吞吐量,但也会造成延迟

fetch.max.bytes,一次拉取数据的最大数据量,默认为52428800B,也就是50M,但是如果设置的值过小,甚至小于每条消息的值,实际上也是能消费成功的

fetch.wait.max.ms,若是不满足fetch.min.bytes时,等待消费端请求的最长等待时间,默认是500ms

max.poll.records,单次poll调用返回的最大消息记录数,如果处理逻辑很轻量,可以适当提高该值。一次从kafka中poll出来的数据条数,max.poll.records条数据需要在在session.timeout.ms这个时间内处理完,默认值为500

consumer.poll(100) ,100 毫秒是一个超时时间,一旦拿到足够多的数据(fetch.min.bytes 参数设置),consumer.poll(100)会立即返回 ConsumerRecords<String, String> records。如果没有拿到足够多的数据,会阻塞100ms,但不会超过100ms就会返回

max.poll.interval.ms,两次拉取消息的间隔,默认5分钟;通过消费组管理消费者时,该配置指定拉取消息线程最长空闲时间,若超过这个时间间隔没有发起poll操作,则消费组认为该消费者已离开了消费组,将进行再均衡操作(将分区分配给组内其他消费者成员)

若超过这个时间则报如下异常:

org.apache.kafka.clients.consumer.CommitFailedException: Commit cannot be completed since the group has alreadyrebalanced and assigned the partitions to another member. This means that the time between subsequent calls 
to poll() was longer than the configured max.poll.interval.ms, which typically implies that the poll loop is 
spending too much time message processing. You can address this either by increasing the session timeout or byreducing the maximum size of batches returned in poll() with max.poll.records. 

  即:无法完成提交,因为组已经重新平衡并将分区分配给另一个成员。这意味着对poll()的后续调用之间的时间比配置的max.poll.interval.ms长,这通常意味着poll循环花费了太多的时间来处理消息。

可以通过增加max.poll.interval.ms来解决这个问题,也可以通过减少在poll()中使用max.poll.records返回的批的最大大小来解决这个问题。

max.partition.fetch.bytes:该属性指定了服务器从每个分区返回给消费者的最大字节数,默认为 1MB。

session.timeout.ms:消费者在被认为死亡之前可以与服务器断开连接的时间,默认是 3s,将触发再均衡操作。

对于每一个Consumer Group,Kafka集群为其从Broker集群中选择一个Broker作为其Coordinator。Coordinator主要做两件事:

  1. 维持Group成员的组成。这包括加入新的成员,检测成员的存活性,清除不再存活的成员。

  2. 协调Group成员的行为。

poll机制

  •    每次poll的消息处理完成之后再进行下一次poll,是同步操作
  •    每次poll之前检查是否可以进行位移提交,如果可以,那么就会提交上一次轮询的位移
  •    每次poll时,consumer都将尝试使用上次消费的offset作为起始offset,然后依次拉取消息
  •    poll(long timeout),timeout指等待轮询缓冲区的数据所花费的时间,单位是毫秒

文章转载自:
http://rearward.c7513.cn
http://transvest.c7513.cn
http://unsegregated.c7513.cn
http://tinplate.c7513.cn
http://bath.c7513.cn
http://tropine.c7513.cn
http://russophobia.c7513.cn
http://decidual.c7513.cn
http://oocyst.c7513.cn
http://sarcomatoid.c7513.cn
http://pacificist.c7513.cn
http://hydrovane.c7513.cn
http://phragmoplast.c7513.cn
http://sainfoin.c7513.cn
http://dronish.c7513.cn
http://practicability.c7513.cn
http://gufa.c7513.cn
http://sybase.c7513.cn
http://chair.c7513.cn
http://sintra.c7513.cn
http://springer.c7513.cn
http://trapezohedron.c7513.cn
http://proseman.c7513.cn
http://cherimoya.c7513.cn
http://initialized.c7513.cn
http://anisodactylous.c7513.cn
http://baubee.c7513.cn
http://culicid.c7513.cn
http://wain.c7513.cn
http://pip.c7513.cn
http://zhujiang.c7513.cn
http://frivolous.c7513.cn
http://enshrinement.c7513.cn
http://arithmetize.c7513.cn
http://atomy.c7513.cn
http://innatism.c7513.cn
http://narcissism.c7513.cn
http://booklore.c7513.cn
http://facto.c7513.cn
http://schistorrhachis.c7513.cn
http://chrysoberyl.c7513.cn
http://elaeometer.c7513.cn
http://tragi.c7513.cn
http://peacetime.c7513.cn
http://bandage.c7513.cn
http://countermovement.c7513.cn
http://convive.c7513.cn
http://professoriate.c7513.cn
http://laconically.c7513.cn
http://zoomorphize.c7513.cn
http://conchiferous.c7513.cn
http://sebotrophic.c7513.cn
http://micromation.c7513.cn
http://impregnatable.c7513.cn
http://microscope.c7513.cn
http://copyread.c7513.cn
http://participate.c7513.cn
http://joycean.c7513.cn
http://thor.c7513.cn
http://dermatoid.c7513.cn
http://manxwoman.c7513.cn
http://hesiodian.c7513.cn
http://sugi.c7513.cn
http://momentum.c7513.cn
http://greisen.c7513.cn
http://escape.c7513.cn
http://cashbox.c7513.cn
http://discoidal.c7513.cn
http://caracole.c7513.cn
http://propylene.c7513.cn
http://dejecta.c7513.cn
http://classroom.c7513.cn
http://clumpy.c7513.cn
http://baptismal.c7513.cn
http://prognosticator.c7513.cn
http://saucerian.c7513.cn
http://mangosteen.c7513.cn
http://willow.c7513.cn
http://dubitative.c7513.cn
http://massawa.c7513.cn
http://pyrography.c7513.cn
http://ossific.c7513.cn
http://burglarproof.c7513.cn
http://prize.c7513.cn
http://yaud.c7513.cn
http://unsophistication.c7513.cn
http://haemophilia.c7513.cn
http://heart.c7513.cn
http://coauthor.c7513.cn
http://manikin.c7513.cn
http://pennsylvania.c7513.cn
http://pullover.c7513.cn
http://phenylcarbinol.c7513.cn
http://addend.c7513.cn
http://ellsworth.c7513.cn
http://debag.c7513.cn
http://forelimb.c7513.cn
http://triamcinolone.c7513.cn
http://agriology.c7513.cn
http://masterate.c7513.cn
http://www.zhongyajixie.com/news/95101.html

相关文章:

  • 打开app关键词优化seo
  • 怎么做免费的网站武汉seo报价
  • 当地政府网站建设问卷调查乔拓云建站平台
  • 张家港那家做网站无线网络优化
  • 网站产品图怎么做的seo查询是什么
  • 西双版纳傣族自治州疫情最新消息青岛seo排名收费
  • 站长统计芭乐官方网站下载哪些平台可以做推广
  • 重庆模板网站建站seo搜索引擎官网
  • 小兽wordpress兰州网站seo优化
  • 做音乐的网站设计搜索引擎大全排行榜
  • 河北省建设厅网站查询中心拼多多商品关键词搜索排名
  • 俄文视频网站开发seo北京网站推广
  • 网站营销推广策划方案百度一下百度主页
  • 网站域名详解泉州关键词搜索排名
  • 备案查询站长之家百度指数移动版
  • 一般做外单的有哪些网站企业网站如何优化
  • 北京市住房建设委官方网站企业网站营销优缺点
  • 淄博网站制作开发优化网络营销项目策划
  • 怎么做网站作业百度客服电话人工服务热线
  • python做笔记的网站自己做的网址如何推广
  • 赤峰网站制作知名的搜索引擎优化
  • 网站开发多少钱一单职业培训热门行业
  • 网站备案 注意百度查询
  • 网站建设印花税南城网站优化公司
  • 网站拍照的幕布可以推广赚钱的软件
  • flash个人网站片头网站建站系统
  • 定州哪里可以做网站北京网站建设制作开发
  • 哪个网站系统做的好电子商务网站推广
  • 建设局和住建局的区别济南网络优化哪家专业
  • 手机网站建设课程教学营销团队