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权威指南
26
2
2.6.3
 操作系统调优
大部分
Linux
发行版默认的内核调优参数配置已经能够满足大多数应用程序的运行需求,
不过还是可以通过调整一些参数来进一步提升
Kafka
的性能。这些参数主要与虚拟内存、
网络子系统和用来存储日志片段的磁盘挂载点有关。这些参数一般配置在
/etc/sysctl.conf
文件里,不过在对内核参数进行调整时,最好参考操作系统的文档。
1.
虚拟内存
一般来说,
Linux
的虚拟内存会根据系统的工作负荷进行自动调整。我们可以对交换分区
的处理方式和内存脏页进行调整,从而让
Kafka
更好地处理工作负载。
对于大多数依赖吞吐量的应用程序来说,要尽量避免内存交换。内存页和磁盘之间的交换
Kafka
各方面的性能都有重大影响。
Kafka
大量地使用系统页面缓存,如果虚拟内存被
交换到磁盘,说明已经没有多余内存可以分配给页面缓存了。
一种避免内存交换的方法是不设置任何交换分区。内存交换不是必需的,不过它确实能够
在系统发生灾难性错误时提供一些帮助。进行内存交换可以防止操作系统由于内存不足而
突然终止进程。基于上述原因,建议把
vm.swappiness
参数的值设置得小一点,比如
1
。该
参数指明了虚拟机的子系统将如何使用交换分区,而不是只把内存页从页面缓存里移除。
要优先考虑减小页面缓存,而不是进行内存交换。
为什么不把
vm.swappiness
设为零
先前,人们建议尽量把
vm.swapiness
设为
0
,它意味着“除非发生内存溢
出,否则不要进行内存交换”。直到
Linux
内核
3.5-rc1
版本发布,这个值的 ...
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