Skip to Content
Kafka权威指南
book

Kafka权威指南

by Neha Narkhede, Gwen Shapira, Todd Palino
January 2018
Beginner to intermediate
234 pages
7h 8m
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南
28
2
net.ipv4.tcp_max_syn_backlog 设为比默认值
1024
更大的值,可以接受更多的并发连接。
net.core.netdev_max_backlog 设为比默认值
1000
更大的值,有助于应对网络流量的爆
发,特别是在使用千兆网络的情况下,允许更多的数据包排队等待内核处理。
2.7
 生产环境的注意事项
当你准备把
Kafka
从测试环境部署到生产环境时,需要注意一些事项,以便创建更可靠的
消息服务。
2.7.1
 垃圾回收器选项
为应用程序调整
Java
垃圾回收参数就像是一门艺术,我们需要知道应用程序是如何使用内
存的,还需要大量的观察和试错。幸运的是,
Java 7
为我们带来了
G1
垃圾回收器,让这
种状况有所改观。在应用程序的整个生命周期,
G1
会自动根据工作负载情况进行自我调
节,而且它的停顿时间是恒定的。它可以轻松地处理大块的堆内存,把堆内存分为若干小
块的区域,每次停顿时并不会对整个堆空间进行回收。
正常情况下,
G1
只需要很少的配置就能完成这些工作。以下是
G1
的两个调整参数。
MaxGCPauseMillis
该参数指定每次垃圾回收默认的停顿时间。该值不是固定的,
G1
可以根据需要使用更
长的时间。它的默认值是
200ms
。也就是说,
G1
会决定垃圾回收的频率以及每一轮需
要回收多少个区域,这样算下来,每一轮垃圾回收大概需要
200ms
的时间。
InitiatingHeapOccupancyPercent
该参数指定了在
G1
启动新一轮垃圾回收之前可以使用的堆内存百分比,默认值是
45 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9787115473271