Tuning Guide
Total Page:16
File Type:pdf, Size:1020Kb
Red Hat Enterprise Linux for Real Time 7 Tuning Guide Advanced tuning procedures to optimize latency in RHEL for Real Time Last Updated: 2020-10-01 Red Hat Enterprise Linux for Real Time 7 Tuning Guide Advanced tuning procedures to optimize latency in RHEL for Real Time Jaroslav Klech Red Hat Customer Content Services [email protected] Sujata Kurup Red Hat Customer Content Services [email protected] Marie Doleželová Red Hat Customer Content Services Jana Heves Red Hat Customer Content Services Maxim Svistunov Red Hat Customer Content Services Radek Bíba Red Hat Customer Content Services David Ryan Red Hat Customer Content Services Cheryn Tan Red Hat Customer Content Services Lana Brindley Red Hat Customer Content Services Alison Young Red Hat Customer Content Services Legal Notice Copyright © 2020 Red Hat, Inc. This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project. The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community. All other trademarks are the property of their respective owners. Abstract This book contains advanced tuning procedures for Red Hat Enterprise Linux for Real Time. For installation instructions, see the Red Hat Enterprise Linux for Real Time Installation Guide . Table of Contents Table of Contents .P .R . E. .F . A. .C . E. 3. .C . H. .A . P. .T .E . R. 1.. .B . E. .F . O. .R . E. Y. .O . U. S. .T . A. .R .T . .T . U. .N . I.N . .G . .Y . O. .U . .R . R. .E . D. H. .A . T. E. .N . T. .E .R . P. .R . I.S . E. L. I.N . .U . X. F. O. R. R. .E .A . L. T. .I M. E. .S . Y. .S . T. E. .M . 4 1.1. RUNNING LATENCY TESTS AND INTERPRETING THEIR RESULTS 5 .C . H. .A . P. .T .E . R. 2. G. E. N. E. R. .A . L. S. .Y . S. T. .E . M. .T .U . N. I.N . G. 9. 2.1. USING THE TUNA INTERFACE 9 2.2. SETTING PERSISTENT TUNING PARAMETERS 9 2.3. SETTING BIOS PARAMETERS 10 2.4. INTERRUPT AND PROCESS BINDING 11 2.5. FILE SYSTEM DETERMINISM TIPS 14 2.6. USING HARDWARE CLOCKS FOR SYSTEM TIMESTAMPING 15 2.7. AVOID RUNNING EXTRA APPLICATIONS 17 2.8. SWAPPING AND OUT OF MEMORY TIPS 18 2.9. NETWORK DETERMINISM TIPS 20 2.10. SYSLOG TUNING TIPS 21 2.11. THE PC CARD DAEMON 22 2.12. REDUCE TCP PERFORMANCE SPIKES 22 2.13. SYSTEM PARTITIONING 23 2.14. REDUCE CPU PERFORMANCE SPIKES 24 .C . H. .A . P. .T .E . R. 3. R. .E . A. .L . T. I. M. .E . -. S. .P . E. C. I.F .I .C . .T .U . N. I.N . G. .2 . 6. 3.1. SETTING SCHEDULER PRIORITIES 26 3.2. USING KDUMP AND KEXEC WITH THE RED HAT ENTERPRISE LINUX FOR REAL TIME KERNEL 29 3.3. TSC TIMER SYNCHRONIZATION ON OPTERON CPUS 32 3.4. INFINIBAND 33 3.5. ROCEE AND HIGH PERFORMANCE NETWORKING 33 3.6. NON-UNIFORM MEMORY ACCESS 33 3.7. REDUCING THE TCP DELAYED ACK TIMEOUT 34 3.8. USING DEBUGFS 35 3.9. USING THE FTRACE UTILITY FOR TRACING LATENCIES 35 3.10. LATENCY TRACING USING TRACE-CMD 39 3.11. USING SCHED_NR_MIGRATE TO LIMIT SCHED_OTHER TASK MIGRATION. 40 3.12. REAL TIME THROTTLING 40 3.13. ISOLATING CPUS USING TUNED-PROFILES-REALTIME 42 3.14. OFFLOADING RCU CALLBACKS 45 .C . H. .A . P. .T .E . R. 4. .A . P. .P .L . I.C . A. .T . I.O . .N . .T . U. .N . I.N . G. .A . N. .D . .D . E. .P . L. .O . Y. .M . .E .N . .T . .4 . 7. 4.1. SIGNAL PROCESSING IN REAL-TIME APPLICATIONS 47 4.2. USING SCHED_YIELD AND OTHER SYNCHRONIZATION MECHANISMS 47 4.3. MUTEX OPTIONS 48 4.4. TCP_NODELAY AND SMALL BUFFER WRITES 50 4.5. SETTING REAL-TIME SCHEDULER PRIORITIES 51 4.6. LOADING DYNAMIC LIBRARIES 51 4.7. USING _COARSE POSIX CLOCKS FOR APPLICATION TIMESTAMPING 52 4.8. ABOUT PERF 53 .C . H. .A . P. .T .E . R. 5. M. O. R. .E . I.N . .F .O . .R . M. .A . T. .I O. N. .5 . 7. 5.1. REPORTING BUGS 57 .A .P . P. .E . N. .D . I. X. A . .E .V . E. .N . T. T. .R .A . C. .I .N . G. .5 . 8. 1 Tuning Guide .A .P . P. .E . N. .D . I. X. B . D. E. T. .A . I.L . E. .D . .D . E. .S .C . R. .I .P .T . I.O . .N . .O . F. F. .T .R . A. .C . E. .5 . 9. .A .P . P. .E . N. .D . I. X. C . .R .E . V. .I S. .I O. N. H. .I S. .T . O. .R . Y. .1 .0 . 9. 2 PREFACE PREFACE This book details tuning information about Red Hat Enterprise Linux for Real Time. Many industries and organizations need extremely high performance computing and may require low and predictable latency, especially in the financial and telecommunications industries. Latency, or response time, is defined as the time between an event and system response and is generally measured in microseconds (μs). For most applications running under a Linux environment, basic performance tuning can improve latency sufficiently. For those industries where latency not only needs to be low, but also accountable and predictable, Red Hat has now developed a 'drop-in' kernel replacement that provides this. Red Hat Enterprise Linux for Real Time provides seamless integration with Red Hat Enterprise Linux 7 and offers clients the opportunity to measure, configure, and record latency times within their organization. You will need to have the Red Hat Enterprise Linux for Real Time kernel installed before you begin the tuning procedures in this book. If you have not yet installed the Red Hat Enterprise Linux for Real Time kernel, or need help with installation issues, read the Red Hat Enterprise Linux for Real Time Installation Guide. 3 Tuning Guide CHAPTER 1. BEFORE YOU START TUNING YOUR RED HAT ENTERPRISE LINUX FOR REAL TIME SYSTEM Red Hat Enterprise Linux for Real Time is designed to be used on well-tuned systems for applications with extremely high determinism requirements. Kernel system tuning offers the vast majority of the improvement in determinism. For example, in many workloads thorough system tuning improves consistency of results by around 90%. This is why we typically recommend that customers first perform the Chapter 2, General System Tuning of standard Red Hat Enterprise Linux before using Red Hat Enterprise Linux for Real Time. Things to Remember While You Are Tuning Your Red Hat Enterprise Linux for Real Time Kernel 1. Be Patient Real-time tuning is an iterative process; you will almost never be able to tweak a few variables and know that the change is the best that can be achieved. Be prepared to spend days or weeks narrowing down the set of tunings that work best for your system. Additionally, always make long test runs. Changing some tuning parameters then doing a five minute test run is not a good validation of a set of tunes. Make the length of your test runs adjustable and run them for longer than a.