洞悉Linux系统和应用性能

《洞悉Linux系统和应用性能》

  • 出版社:电子工业出版社
  • ISBN:9787121386947
  • 版次:1
  • 商品编码:13067826
  • 品牌:博文视点
  • 包装:平装
  • 开本:16开
  • 出版时间:2020-12-01
  • 用纸:胶版纸
  • 页数:840
  • 字数:1117200
基本介绍书籍目录点评信息
  • 书籍内容

    本书作为全面介绍 BPF 技术的图书,从 BPF 技术的起源到未来发展方向都有涵盖,不仅系统介绍了 BPF 的编程模型,还完整介绍了两个主要的 BPF 前端编程框架—BCC 和 bpftrace,更给出了一系列实现范例,生动展示了 BPF 技术的实际能力和未来发展前景。本书的另一个关注方向是 Linux 系统性能和应用程序性能的调优,内容涉及系统性能调优的策略、工具与实践案例,不仅介绍了对应的 BPF 工具,还着重介绍了这些工具如何与 Linux 传统性能工具配合使用,这样读者可以选择最佳方案。本书介绍的工具小巧精致,并提供了简单易读的源代码,它们充分展现了 BPF 技术的魅力 :安全、高效、快捷的系统扩展力。未来 BPF 技术在 Linux 中的应用场景会越来越多、越来越重要。希望本书能在大家学习 BPF 技术并关注它的发展时提供帮助。

    编辑推荐

    适读人群 :BPF性能工具将是所有管理员、开发人员、支持人员和其他IT专业人员不可或缺的资源,他们可以在任何企业或云环境中使用任何最新的Linux发行版。
    作为BPF技术的开拓者和专家,Brendan Gregg在本书中不仅展示了超过150个可以立即使用的分析工具和调试工具,对这些工具的应用场景进行了分析,还提供了开发自定义工具的分步指南。在本书中,读者可学习到如何分析CPU、内存、存储设备、文件系统、网络、编程语言、应用程序、容器、虚拟机管理器、安全及内核。Gregg带领读者由浅入深地了解从基础工具到进阶工具的使用,帮助读者收集更有用、更深入的技术信息,可以用来优化几乎任何类型的Linux系统和应用程序。

    作者简介

    Netflix 资深性能工程师 Brendan Gregg 是 BPF(eBPF)的主要贡献者,他帮助开发和维护了两个主要的 BPF 前端编程框架,开创了 BPF 用于可观测性的先河,并创建了数十种基于 BPF 的性能分析工具。他还编著有畅销书《性能之巅 :洞悉系统、企业与云计算》。
  • Part I: Technologies
    1 Introduction 1
    1.1 What Are BPF and eBPF? 1
    1.2 What Are Tracing, Snooping, Sampling, Profiling, and
    Observability? 2
    1.3 What Are BCC, bpftrace, and IO Visor? 3
    1.4 A First Look at BCC: Quick Wins 4
    1.5 BPF Tracing Visibility 6
    1.6 Dynamic Instrumentation: kprobes and uprobes 8
    1.7 Static Instrumentation: Tracepoints and USDT 9
    1.8 A First Look at bpftrace: Tracing open() 10
    1.9 Back to BCC: Tracing open() 12
    1.10 Summary 14
    2 Technology Background 15
    2.1 BPF Illustrated 15
    2.2 BPF 16
    2.3 Extended BPF (eBPF) 17
    2.3.1 Why Performance Tools Need BPF 19
    2.3.2 BPF Versus Kernel Modules 21
    2.3.3 Writing BPF Programs 22
    2.3.4 Viewing BPF Instructions: bpftool 23
    2.3.5 Viewing BPF Instructions: bpftrace 30
    2.3.6 BPF API 31
    2.3.7 BPF Concurrency Controls 35
    2.3.8 BPF sysfs Interface 36
    2.3.9 BPF Type Format (BTF) 37
    2.3.10 BPF CO-RE 37
    2.3.11 BPF Limitations 38
    2.3.12 BPF Additional Reading 38
    2.4 Stack Trace Walking 39
    2.4.1 Frame Pointer–Based Stacks 39
    2.4.2 debuginfo 40
    2.4.3 Last Branch Record (LBR) 40
    2.4.4 ORC 40
    2.4.5 Symbols 41
    2.4.6 More Reading 41
    2.5 Flame Graphs 41
    2.5.1 Stack Trace 41
    2.5.2 Profiling Stack Traces 41
    2.5.3 Flame Graph 42
    2.5.4 Flame Graph Features 44
    2.5.5 Variations 44
    2.6 Event Sources 45
    2.7 kprobes 46
    2.7.1 How kprobes Work 46
    2.7.2 kprobes Interfaces 47
    2.7.3 BPF and kprobes 48
    2.7.4 kprobes Additional Reading 49
    2.8 uprobes 49
    2.8.1 How uprobes Work 49
    2.8.2 Uprobes Interfaces 51
    2.8.3 BPF and uprobes 51
    2.8.4 uprobes Overhead and Future Work 52
    2.8.5 uprobes Additional Reading 52
    2.9 Tracepoints 53
    2.9.1 Adding Tracepoint Instrumentation 53
    2.9.2 How Tracepoints Work 55
    2.9.3 Tracepoint Interfaces 56
    2.9.4 Tracepoints and BPF 56
    2.9.5 BPF Raw Tracepoints 57
    2.9.6 Additional Reading 58
    2.10 USDT 58
    2.10.1 Adding USDT Instrumentation 58
    2.10.2 How USDT Works 60
    2.10.3 BPF and USDT 61
    2.10.4 USDT Additional Reading 61
    2.11 Dynamic USDT 61
    2.12 PMCs 63
    2.12.1 PMC Modes 63
    2.12.2 PEBS 64
    2.12.3 Cloud Computing 64
    2.13 perf_events 64
    2.14 Summary 65
    3 Performance Analysis 67
    3.1 Overview 67
    3.1.1 Goals 68
    3.1.2 Activities 68
    3.1.3 Mulitple Performance Issues 69
    3.2 Performance Methodologies 69
    3.2.1 Workload Characterization 70
    3.2.2 Drill-Down Analysis 71
    3.2.3 USE Method 72
    3.2.4 Checklists 72
    3.3 Linux 60-Second Analysis 73
    3.3.1 uptime 73
    3.3.2 dmesg | tail 74
    3.3.3 vmstat 1 74
    3.3.4 mpstat -P ALL 1 75
    3.3.5 pidstat 1 75
    3.3.6 iostat -xz 1 76
    3.3.7 free -m 77
    3.3.8 sar -n DEV 1 77
    3.3.9 sar -n TCP,ETCP 1 78
    3.3.10 top 78
    3.4 BCC Tool Checklist 79
    3.4.1 execsnoop 80
    3.4.2 opensnoop 80
    3.4.3 ext4slower 80
    3.4.4 biolatency 81
    3.4.5 biosnoop 81
    3.4.6 cachestat 82
    3.4.7 tcpconnect 82
    3.4.8 tcpaccept 82
    3.4.9 tcpretrans 83
    3.4.10 runqlat 83
    3.4.11 profile 84
    3.5 Summary 84
    4 BCC 85
    4.1 BCC Components 86
    4.2 BCC Features 86
    4.2.1 Kernel-Level Features 87
    4.2.2 BCC User-Level Features 87
    4.3 BCC Installation 88
    4.3.1 Kernel Requirements 88
    4.3.2 Ubuntu 88
    4.3.3 RHEL 89
    4.3.4 Other Distributions 89
    4.4 BCC Tools 89
    4.4.1 Highlighted Tools 90
    4.4.2 Tool Characteristics 91
    4.4.3 Single-Purpose Tools 91
    4.4.4 Multi-Purpose Tools 93
    4.5 funccount 94
    4.5.1 funccount Examples 94
    4.5.2 funccount Syntax 97
    4.5.3 funccount One-Liners 97
    4.5.4 funccount Usage 98
    4.6 stackcount 99
    4.6.1 stackcount Example 99
    4.6.2 stackcount Flame Graphs 100
    4.6.3 stackcount Broken Stack Traces 101
    4.6.4 stackcount Syntax 102
    4.6.5 stackcount One-Liners 102
    4.6.6 stackcount Usage 103
    4.7 trace 104
    4.7.1 trace Example 104
    4.7.2 trace Syntax 105
    4.7.3 trace One-Liners 106
    4.7.4 trace Structs 107
    4.7.5 trace Debugging File Descriptor Leaks 107
    4.7.6 trace Usage 109
    4.8 argdist 110
    4.8.1 argdist Syntax 111
    4.8.2 argdist One-Liners 112
    4.8.3 argdist Usage 113
    4.9 Tool Documentation 114
    4.9.1 Man Page: opensnoop 115
    4.9.2 Examples File: opensnoop 118
    4.10 Developing BCC Tools 119
    4.11 BCC Internals 120
    4.12 BCC Debugging 121
    4.12.1 printf() Debugging 122
    4.12.2 BCC Debug Output 124
    4.12.3 BCC Debug Flag 125
    4.12.4 bpflist 126
    4.12.5 bpftool 127
    4.12.6 dmesg 127
    4.12.7 Resetting Events 127
    4.13 Summary 128
    5 b
微信公众号

热门文章

更多