SlideShare a Scribd company logo
1 of 42
Refining Linux
Jason Murray, D.CS
Cornwall-Lebanon SD
 jasonmurray72@gmail.com
 @jasonmurray72
 slideshare.net/jasonmurray72
Agenda
 Linux Intro
 What is Optimization?
 Performance
 Server Optimization
 Performance Monitoring
 System Monitoring Tools
 Benchmark Tools
Kernels
 Linux – Monolithic Kernel Architecture: provides all
services
 Windows – Micro Kernel Architecture: small core group of
services that executes other services and applications
Recompile the Kernel
 make mrproper - This target cleans up the build environment of any stale
files and dependencies that might have been left over from a previous kernel
build. All previous kernel configurations will be cleaned (deleted) from the
build environment.
 make clean - This target does not do as thorough a job as the “mrproper”
target. It only deletes most generated files. It does not delete the kernel
configuration file (.config).
 make menuconfig - This target invokes a text-based editor interface with
menus, option lists, and text-based dialog boxes for configuring the kernel.
 make xconfig - This is an X Window System–based kernel configuration tool
that relies on the Qt graphical development libraries. These libraries are used
by KDE-based applications.
 make gconfig - This target also invokes an X Window System–based kernel
configuration tool, but it relies on the GTK2 (GIMP) toolkit. This GTK2 toolkit
is heavily used in the GNOME desktop world.
 make help - This target will show you all the other possible make targets and
also serves as a quick online help system.
What is Optimization?
 Server Design
 Stability
 Availability
 Performance
 General Server Response
 Hardware Response
 Service Response
Performance
 Hardware
 Safe Clean Environment
 Software
 Enhancement in parameter improvements can compensate and
improve older hardware performance
 Avoid a GUI
 At least unload the GUI after using it
Server Optimization
 Fine Tuning
 Services
 Hardware
 Kernel
 Network
 Security
 Database
 Storage
 Memory
Recommendations
 Custom installs
 Only load the essentials
 Partitioning Planning
 Know the purpose of your server
Performance Monitoring
 CPU
 Network
 I/O
 Memory
CPU Performance Metrics
 Context Switch
 Run Queue
 CPU Utilization
 Load Average
Context Switch
 Context Switch - CPU moves from one thread to another
 During context switch, the kernel stores current thread state in
memory
 Simultaneously, the kernel retrieves previously stored thread state
from memory & loads it to the CPU
 Context switching affords multitasking of CPU
 High levels of context switching can cause performance degradation
 Example: pidstat 2 5
 Display five reports of CPU statistics for every active task in the system at
two second intervals.
Run Queue
 Run Queue – total number of active processes in current
queue for CPU
 Processes in sleep state of I/O wait state are not in the
run queue
 High number of processes in the run queue can cause
performance degradation
 Example: vmstat
 The r column in the table represents run queue processes
CPU Utilization
 CPU Utilization – percentage that the CPU is being used
 Higher percentage of CPU utilization can cause
performance degradation
 Example: top
 Real time view of cpu utilization
Load Average
 Load Average – average CPU load over a specified time period
 Load average is displayed for the last 1 minute, 5 minutes, and 15
minutes
 Easy monitoring for overall load
 Load Average is calculated by combining the total number of
processes in the run queue and the total number of processes in the
uninterruptable task status
 Example: uptime
 “0.25 1.20 1.90” – System load coming down
 .25 - Load average for last 1 minute
 1.20 – Load average for last 5 minutes
 1.90 – Load average for last 15 minutes
Disk I/O Optimization
 4 different I/O schedulers
 CFQ (default) – distributes all I/O bandwidth evenly among all
processes requesting I/O
 NOOP – acts as a basic FIFO queue expecting the hardware controller to
handle the performance operations of the requests; attempts to use as
little CPU as possible
 Anticipatory – designed to increase performance on systems that have
slow disks; reorders all disk I/O operations to optimize disk seeks
 Deadline – places I/O requests in a priority queue so each is guaranteed
to run within a certain time; often used in real-time operating
Changing Schedulers
 Which schedules do you have compiled
 /sys/block/sda/queue # cat scheduler
 anticipatory deadline [cfq]
 Compile noop
 /sys/block/sda/queue # modprobe noop-iosched
 anticipatory deadline [cfq] noop
 Change
 /sys/block/sda/queue # echo anticipatory > scheduler
 http://www.linuxhowtos.org/System/iosched.htm
Scheduler
 Agility
 Changing schedulers on the fly allows for benchmark
testing of your specific applications and hardware
 Notes
 The change will not be instant. All current processes in
run queue must complete first.
 Once you find the optimal scheduler for your specific
situation, apply the change for subsequent reboots
Scheduler Suggestions
 Use NOOP or Deadline on SSD drives
 Benchmark each scheduler to determine your optimal
solution
 CFQ is not always the best scheduler for your system
 Example: Your system is running a raid
I/O Optimization
 Consistent high I/O wait indicates an issue with the disk
subsystem
 Monitor BI & BO (Block in & Block out)
 Reads/second & writes/second can also identify trouble areas
 Check TPS (transactions/second) – total of BI & BO
 Example: vmstat
vmstat
 Procs
 r: The number of processes
waiting for run time.
 b: The number of processes in
uninterruptible sleep.
 Memory
 swpd: the amount of virtual
memory used.
 free: the amount of idle
memory.
 buff: the amount of memory
used as buffers.
 cache: the amount of memory
used as cache.
 inact: the amount of inactive
memory. (-a option)
 active: the amount of active
memory. (-a option)
 Swap
 si: Amount of memory swapped
in from disk (/s).
 so: Amount of memory swapped
to disk (/s).
 IO
 bi: Blocks received from a block
device (blocks/s).
 bo: Blocks sent to a block
device (blocks/s).
 System
 in: The number of interrupts per
second, including the clock.
 cs: The number of context
switches per second.
 CPU
 These are percentages of total
CPU time.
 us: Time spent running non-
kernel code. (user time,
including nice time)
 sy: Time spent running kernel
code. (system time)
 id: Time spent idle. Prior to
Linux 2.5.41, this includes IO-
wait time.
 wa: Time spent waiting for IO.
Prior to Linux 2.5.41, included
in idle.
 st: Time stolen from a virtual
machine. Prior to Linux 2.6.11,
unknown.
Disk I/O Optimization
File
System
Max File
Size
Max Partition
Size
Journaling Notes
Fat16 2 GB 2 GB No Legacy
Fat32 4 GB 8 TB No Legacy
NTFS 2 TB 256 TB Yes
(For Windows Compatibility) NTFS-3g is
installed by default in Ubuntu, allowing
Read/Write support
ext2 2 TB 32 TB No Legacy
ext3 2 TB 32 TB Yes
Standard linux filesystem for many years. Best
choice for super-standard installation.
ext4 16 TB 1 EB Yes
Modern iteration of ext3. Best choice for new
installations where super-standard isn't
necessary.
reiserFS 8 TB 16 TB Yes No longer well-maintained.
JFS 4PB 32PB
Yes
(metadata)
Created by IBM - Not well maintained.
XFS 8 EB 8 EB
Yes
(metadata)
Created by SGI. Best choice for a mix of
stability and advanced journaling.
Disk I/O Optimization
 Disk Cache Policy
 hdparm -a /dev/sda
 Readahead value at least 1024
 Write Policy
 Writeback
 Read Policy
 Adaptive readahead
 Penalties
 Calculate the IOPS
Disk Optimization
 Solutions
 Bonnie++
 Hdparm
 Upgrades
 BIOS
 Firmware
Network
 Monitoring
 Total number of packets
 Received
 Sent
 Dropped
TCP Optimization –
Large Production Servers
 Port Availability
 Echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
 Memory Allocation with Socket Buffers
 Echo 262143 > /proc/sys/net/core/rmem_max
 Echo 262143 > /proc/sys/net/core/rmem_default
 TCP Stack Workload Reduction
 Echo 0 >/proc/sys/net/ipv4/tcp_sack
 Echo 0 > /proc/sys/net/ipv4/tcp_timestamps
Memory Optimization
 Virtual Memory – swap space available on the disk & physical memory
(user space & kernel space)
 Kernel’s file system cache takes advantage of the unused RAM
 During a swap, Linux writes the least used memory pages from the
physical memory to the swap space on the disk
 High levels of swapping will degrade performance, because the disk is
much slower
 Vmstat command
 Recommendation
 Benchmark tests prove that ECC RAM is faster
Additional Helpful Commands
 Netstat – lists network sockets
 Ps – snapshot of current processes
 Atop – interactive monitor for the load averages
 Mtop – displays mysql threads
 Iostat – reports cpu & I/O statistics
 Xosview – displays CPU usage, load average, memory
usage, swap space usage, network usage, interrupts, and
serial port status
Kernel Optimization
 The first thing to get loaded is the kernel. Keep in mind that no operating system
exists in memory at this point, and PCs (by their unfortunate design) have no easy
way to access all of their memory. Thus, the kernel must load completely into the
first megabyte of available random access memory (RAM). In order to accomplish
this, the kernel is compressed. The head of the file contains the code necessary to
bring the CPU into protected mode (thereby removing the memory restriction) and
decompress the remainder of the kernel.
 Kernel Execution. With the kernel in memory, it can begin executing. It knows only
whatever functionality is built into it, which means any parts of the kernel
compiled as modules are useless at this point. At the very minimum, the kernel
must have enough code to set up its virtual memory subsystem and root file system
(usually, the ext3 file system). Once the kernel has started, a hardware probe
determines what device drivers should be initialized. From here, the kernel can
mount the root file system. (You could draw a parallel of this process to that of
Windows being able to recognize and access its C drive.) The kernel mounts the
root file system and starts a program called init.
Boot Loaders
 MBR – starting on page 142 of Linux Administration
 GRUB
 Modify boot record & kernel initiation
 Splash screen
 Hidden menus
 Title
 Root
 Initrd – preload modules in kernel
 LILO
Database Optimization
 MySQL – use MySQL tuning scripts
 Optimize table
OpenLDAP Optimization
 Important Decision – Which attributes will you build indexes on
 Optimal Parameters – change before data entry
 /etc/openldap.conf
 Cachesize 10000
 Dbcachesize 100000
 Sizelimit 10000
 Loglevel 0
 dbcacheNoWsync
 Index cn,uid
 Index uidnumber
 Index gid
 Index gidnumber
 Index mail
Apache Optimization
 Good Benchmark Scores – many initial daemons
 Example
 MinSpareServers 20
 MaxSpareServers 80
 StartServers 32
 If Apache is recompiled
 MaxClients 256
 MaxRequestsPerChild 10000
 Notes – A high number of max servers and an honest
number of spare servers will work fine. For the most part
the StartServers help with the instant load that
benchmarks generate.
Apache Management
 Default Directory - /var/www/html
 Apache Config File - /etc/httpd/httpd.conf
 /etc/httpd/conf.d/phpMyAdmin.conf
 PHP Config File - /etc/php.ini
 /etc/init.d/httpd start|stop|restart
 Service httpd start|stop|restart
 /var/log/httpd/error_log
 /var/log/httpd/access_log
Poor Performance Website
 Consider
 Optimizers
 Memcache
 Adjusting Apache
 Minimizing Apache modules
 Alternative to apache - nginx
Benchmarking
 Benchmarking is helping; HOWEVER,
 Its impossible to duplicate real world situations
 Understand the GOAL for benchmarking
 Measuring the performance of ONE particular element very
accurately
 Benchmarks are excellent tools if you understand what
they are doing and trying to accomplish
Benchmark Tools
 Bonnie++ - file system benchmarking tool
 Dbench – I/O workload generator to a file system or
networked CIFS or NFS server
 Http_load – throughput tester for a web server
 Dkftpbench – FTP download benchmark analyzer
 Tiobench – multi-threaded I/O benchmark tool
 Ttcp – network throughput measuring tool
 Netperf – network performance tester
More Helpful Tools
 Lsof – list open files
 Tcpdump – network packet analyzer
 Htop – process monitoring
 Iotop – monitors disk I/O
 IPTraf – real time IP LAN monitoring
 Psacct – monitor user activity
 Monit – process & services monitoring
 Nethogs – monitor per process network bandwidth
 Iftop – network bandwidth monitoring
 Monitorix – system & network monitoring
Troubleshooting Methodology
 Clearly understand the problem
 Monitor & collect data
 Eliminate and narrow issues
 Make one change at a time & OBSERVE
 Document everything!
References
 Davor Guttierrez - @dguttierrez
 Soyinka, W. (2008). Linux Administration: A Beginner's Guide.
McGraw-Hill, Inc..
 http://www.tecmint.com/command-line-tools-to-monitor-linux-
performance/
 http://www.thegeekstuff.com/2011/07/iostat-vmstat-mpstat-
examples/

More Related Content

What's hot

Linux memory consumption
Linux memory consumptionLinux memory consumption
Linux memory consumptionhaish
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debuggingHao-Ran Liu
 
Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in LinuxRaghu Udiyar
 
Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Brendan Gregg
 
Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Chirag Jog
 
Unix Internals OS Architecture
Unix Internals OS ArchitectureUnix Internals OS Architecture
Unix Internals OS ArchitectureKhader Shaik
 
Systems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudSystems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudBrendan Gregg
 
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicUnix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicCircling Cycle
 
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicHow to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicCircling Cycle
 
RTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draftRTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draftJou Neo
 
Stateless Hypervisors at Scale
Stateless Hypervisors at ScaleStateless Hypervisors at Scale
Stateless Hypervisors at ScaleAntony Messerl
 
Analysis of interrupt latencies in a real-time kernel
Analysis of interrupt latencies in a real-time kernelAnalysis of interrupt latencies in a real-time kernel
Analysis of interrupt latencies in a real-time kernelGabriele Modena
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemLieYah Daliah
 
Bootloader and bootloading
Bootloader and bootloadingBootloader and bootloading
Bootloader and bootloadingArpita Gupta
 
OS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchOS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchDaniel Ben-Zvi
 

What's hot (20)

Linux memory consumption
Linux memory consumptionLinux memory consumption
Linux memory consumption
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Memory management in Linux
Memory management in LinuxMemory management in Linux
Memory management in Linux
 
Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016Broken Linux Performance Tools 2016
Broken Linux Performance Tools 2016
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Operating System
Operating SystemOperating System
Operating System
 
Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how Testing real-time Linux. What to test and how
Testing real-time Linux. What to test and how
 
OS - Process
OS - ProcessOS - Process
OS - Process
 
Unix Internals OS Architecture
Unix Internals OS ArchitectureUnix Internals OS Architecture
Unix Internals OS Architecture
 
Systems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the CloudSystems Performance: Enterprise and the Cloud
Systems Performance: Enterprise and the Cloud
 
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan BaljevicUnix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
Unix and Linux Common Boot Disk Disaster Recovery Tools by Dusan Baljevic
 
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-BaljevicHow to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
How to-mount-3 par-san-virtual-copy-onto-rhel-servers-by-Dusan-Baljevic
 
Linux monitoring
Linux monitoringLinux monitoring
Linux monitoring
 
Tuned
TunedTuned
Tuned
 
RTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draftRTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draft
 
Stateless Hypervisors at Scale
Stateless Hypervisors at ScaleStateless Hypervisors at Scale
Stateless Hypervisors at Scale
 
Analysis of interrupt latencies in a real-time kernel
Analysis of interrupt latencies in a real-time kernelAnalysis of interrupt latencies in a real-time kernel
Analysis of interrupt latencies in a real-time kernel
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
 
Bootloader and bootloading
Bootloader and bootloadingBootloader and bootloading
Bootloader and bootloading
 
OS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchOS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switch
 

Viewers also liked

Virtualized Professional Development
Virtualized Professional DevelopmentVirtualized Professional Development
Virtualized Professional DevelopmentJason Murray
 
Mobile Apps for Education
Mobile Apps for EducationMobile Apps for Education
Mobile Apps for EducationJason Murray
 
SL formal_education
SL formal_educationSL formal_education
SL formal_educationJason Murray
 
Virtual Professional Development
Virtual Professional DevelopmentVirtual Professional Development
Virtual Professional DevelopmentJason Murray
 
Field Trips from the Comfort of the Classroom
Field Trips from the Comfort of the ClassroomField Trips from the Comfort of the Classroom
Field Trips from the Comfort of the ClassroomJason Murray
 
Coordinating Technology through Open Source Software
Coordinating Technology through Open Source SoftwareCoordinating Technology through Open Source Software
Coordinating Technology through Open Source SoftwareJason Murray
 
Student Tech Possibilities
Student Tech PossibilitiesStudent Tech Possibilities
Student Tech PossibilitiesJason Murray
 
Social Media: Art of the Possible
Social Media: Art of the PossibleSocial Media: Art of the Possible
Social Media: Art of the PossibleJason Murray
 
Christmas letter 2012
Christmas letter 2012Christmas letter 2012
Christmas letter 2012Jason Murray
 
Gamification – Instructional Design Strategy
Gamification – Instructional Design StrategyGamification – Instructional Design Strategy
Gamification – Instructional Design StrategyJason Murray
 
Social media in education
Social media in educationSocial media in education
Social media in educationJason Murray
 
Social Media in Education
Social Media in EducationSocial Media in Education
Social Media in EducationJason Murray
 
A strategic view of mobile device management
A strategic view of mobile device managementA strategic view of mobile device management
A strategic view of mobile device managementJason Murray
 
Cyber security awareness
Cyber security awarenessCyber security awareness
Cyber security awarenessJason Murray
 
2016 TTL Security Gap Analysis with Kali Linux
2016 TTL Security Gap Analysis with Kali Linux2016 TTL Security Gap Analysis with Kali Linux
2016 TTL Security Gap Analysis with Kali LinuxJason Murray
 

Viewers also liked (19)

Virtualized Professional Development
Virtualized Professional DevelopmentVirtualized Professional Development
Virtualized Professional Development
 
Mobile Apps for Education
Mobile Apps for EducationMobile Apps for Education
Mobile Apps for Education
 
SL formal_education
SL formal_educationSL formal_education
SL formal_education
 
Ipod touches
Ipod touchesIpod touches
Ipod touches
 
Virtual Professional Development
Virtual Professional DevelopmentVirtual Professional Development
Virtual Professional Development
 
Field Trips from the Comfort of the Classroom
Field Trips from the Comfort of the ClassroomField Trips from the Comfort of the Classroom
Field Trips from the Comfort of the Classroom
 
Coordinating Technology through Open Source Software
Coordinating Technology through Open Source SoftwareCoordinating Technology through Open Source Software
Coordinating Technology through Open Source Software
 
Student Tech Possibilities
Student Tech PossibilitiesStudent Tech Possibilities
Student Tech Possibilities
 
Social Media: Art of the Possible
Social Media: Art of the PossibleSocial Media: Art of the Possible
Social Media: Art of the Possible
 
Christmas letter 2012
Christmas letter 2012Christmas letter 2012
Christmas letter 2012
 
1 to 1 Logistics
1 to 1 Logistics1 to 1 Logistics
1 to 1 Logistics
 
Gamification – Instructional Design Strategy
Gamification – Instructional Design StrategyGamification – Instructional Design Strategy
Gamification – Instructional Design Strategy
 
Social media in education
Social media in educationSocial media in education
Social media in education
 
Social Media in Education
Social Media in EducationSocial Media in Education
Social Media in Education
 
A strategic view of mobile device management
A strategic view of mobile device managementA strategic view of mobile device management
A strategic view of mobile device management
 
Cyber security awareness
Cyber security awarenessCyber security awareness
Cyber security awareness
 
Online safety
Online safetyOnline safety
Online safety
 
Alice training
Alice trainingAlice training
Alice training
 
2016 TTL Security Gap Analysis with Kali Linux
2016 TTL Security Gap Analysis with Kali Linux2016 TTL Security Gap Analysis with Kali Linux
2016 TTL Security Gap Analysis with Kali Linux
 

Similar to Optimizing Linux Server Performance

linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning iman darabi
 
Fast boot
Fast bootFast boot
Fast bootSZ Lin
 
Linux optimization strategy plan by shiv
Linux optimization strategy plan by shivLinux optimization strategy plan by shiv
Linux optimization strategy plan by shivthedatabasearchitect
 
CPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCoburn Watson
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessorslpapadop
 
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance Barriers
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance BarriersCeph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance Barriers
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance BarriersCeph Community
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentalsBimal Jain
 
Introduction and fundamentals of Operating System.ppt
Introduction and fundamentals of Operating System.pptIntroduction and fundamentals of Operating System.ppt
Introduction and fundamentals of Operating System.pptminaltmv
 
Presentation aix performance tuning
Presentation   aix performance tuningPresentation   aix performance tuning
Presentation aix performance tuningxKinAnx
 
Windows 1Fundaments.ppt
Windows 1Fundaments.pptWindows 1Fundaments.ppt
Windows 1Fundaments.pptkarthikvcyber
 
OS-20210426203801 introduction to os.ppt
OS-20210426203801 introduction to os.pptOS-20210426203801 introduction to os.ppt
OS-20210426203801 introduction to os.pptnaghamallella
 

Similar to Optimizing Linux Server Performance (20)

linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 
Optimizing Linux Servers
Optimizing Linux ServersOptimizing Linux Servers
Optimizing Linux Servers
 
Fast boot
Fast bootFast boot
Fast boot
 
Linux optimization strategy plan by shiv
Linux optimization strategy plan by shivLinux optimization strategy plan by shiv
Linux optimization strategy plan by shiv
 
CPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performanceCPN302 your-linux-ami-optimization-and-performance
CPN302 your-linux-ami-optimization-and-performance
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
 
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance Barriers
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance BarriersCeph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance Barriers
Ceph Day Melbourne - Ceph on All-Flash Storage - Breaking Performance Barriers
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
os
osos
os
 
Introduction and fundamentals of Operating System.ppt
Introduction and fundamentals of Operating System.pptIntroduction and fundamentals of Operating System.ppt
Introduction and fundamentals of Operating System.ppt
 
Operating system.pptx
Operating system.pptxOperating system.pptx
Operating system.pptx
 
Operating system.pptx
Operating system.pptxOperating system.pptx
Operating system.pptx
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Presentation aix performance tuning
Presentation   aix performance tuningPresentation   aix performance tuning
Presentation aix performance tuning
 
OS-20210426203801.ppt
OS-20210426203801.pptOS-20210426203801.ppt
OS-20210426203801.ppt
 
OS-20210426203801.ppt
OS-20210426203801.pptOS-20210426203801.ppt
OS-20210426203801.ppt
 
OS-20210426203801.ppt
OS-20210426203801.pptOS-20210426203801.ppt
OS-20210426203801.ppt
 
OS full chapter.ppt
OS full chapter.pptOS full chapter.ppt
OS full chapter.ppt
 
Windows 1Fundaments.ppt
Windows 1Fundaments.pptWindows 1Fundaments.ppt
Windows 1Fundaments.ppt
 
OS-20210426203801 introduction to os.ppt
OS-20210426203801 introduction to os.pptOS-20210426203801 introduction to os.ppt
OS-20210426203801 introduction to os.ppt
 

More from Jason Murray

Desktop Support Essentials
Desktop Support EssentialsDesktop Support Essentials
Desktop Support EssentialsJason Murray
 
Schoology Features
Schoology FeaturesSchoology Features
Schoology FeaturesJason Murray
 
Literacy Resources
Literacy ResourcesLiteracy Resources
Literacy ResourcesJason Murray
 
Technology Leadership: Transforming a Culture
Technology Leadership:  Transforming a CultureTechnology Leadership:  Transforming a Culture
Technology Leadership: Transforming a CultureJason Murray
 
Creating Effective elearning
Creating Effective elearningCreating Effective elearning
Creating Effective elearningJason Murray
 
Second Life: The Distance Ed Vehicle
Second Life: The Distance Ed VehicleSecond Life: The Distance Ed Vehicle
Second Life: The Distance Ed VehicleJason Murray
 
CLSD Technology Partial Roadmap - Admin Retreat
CLSD Technology Partial Roadmap - Admin RetreatCLSD Technology Partial Roadmap - Admin Retreat
CLSD Technology Partial Roadmap - Admin RetreatJason Murray
 
Flavors of linux - framework
Flavors of linux - frameworkFlavors of linux - framework
Flavors of linux - frameworkJason Murray
 
Virtualized professional development
Virtualized professional developmentVirtualized professional development
Virtualized professional developmentJason Murray
 
Mobile learning tools
Mobile learning toolsMobile learning tools
Mobile learning toolsJason Murray
 
Popular Open Source Software
Popular Open Source SoftwarePopular Open Source Software
Popular Open Source SoftwareJason Murray
 
SL - Student privacy
SL - Student privacySL - Student privacy
SL - Student privacyJason Murray
 
Online opportunities
Online opportunitiesOnline opportunities
Online opportunitiesJason Murray
 
Economic Influence on OSS Adoption
Economic Influence on OSS AdoptionEconomic Influence on OSS Adoption
Economic Influence on OSS AdoptionJason Murray
 
Leveraging game culture in the workplace
Leveraging game culture in the workplaceLeveraging game culture in the workplace
Leveraging game culture in the workplaceJason Murray
 

More from Jason Murray (17)

Desktop Support Essentials
Desktop Support EssentialsDesktop Support Essentials
Desktop Support Essentials
 
Schoology Features
Schoology FeaturesSchoology Features
Schoology Features
 
Literacy Resources
Literacy ResourcesLiteracy Resources
Literacy Resources
 
Technology Leadership: Transforming a Culture
Technology Leadership:  Transforming a CultureTechnology Leadership:  Transforming a Culture
Technology Leadership: Transforming a Culture
 
Creating Effective elearning
Creating Effective elearningCreating Effective elearning
Creating Effective elearning
 
Flipped Meetings
Flipped MeetingsFlipped Meetings
Flipped Meetings
 
Second Life: The Distance Ed Vehicle
Second Life: The Distance Ed VehicleSecond Life: The Distance Ed Vehicle
Second Life: The Distance Ed Vehicle
 
CLSD Technology Partial Roadmap - Admin Retreat
CLSD Technology Partial Roadmap - Admin RetreatCLSD Technology Partial Roadmap - Admin Retreat
CLSD Technology Partial Roadmap - Admin Retreat
 
Flavors of linux - framework
Flavors of linux - frameworkFlavors of linux - framework
Flavors of linux - framework
 
Virtualized professional development
Virtualized professional developmentVirtualized professional development
Virtualized professional development
 
Mobile learning tools
Mobile learning toolsMobile learning tools
Mobile learning tools
 
Popular Open Source Software
Popular Open Source SoftwarePopular Open Source Software
Popular Open Source Software
 
SL - Student privacy
SL - Student privacySL - Student privacy
SL - Student privacy
 
Optical illusions
Optical illusionsOptical illusions
Optical illusions
 
Online opportunities
Online opportunitiesOnline opportunities
Online opportunities
 
Economic Influence on OSS Adoption
Economic Influence on OSS AdoptionEconomic Influence on OSS Adoption
Economic Influence on OSS Adoption
 
Leveraging game culture in the workplace
Leveraging game culture in the workplaceLeveraging game culture in the workplace
Leveraging game culture in the workplace
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Optimizing Linux Server Performance

  • 2. Jason Murray, D.CS Cornwall-Lebanon SD  jasonmurray72@gmail.com  @jasonmurray72  slideshare.net/jasonmurray72
  • 3. Agenda  Linux Intro  What is Optimization?  Performance  Server Optimization  Performance Monitoring  System Monitoring Tools  Benchmark Tools
  • 4.
  • 5.
  • 6. Kernels  Linux – Monolithic Kernel Architecture: provides all services  Windows – Micro Kernel Architecture: small core group of services that executes other services and applications
  • 7. Recompile the Kernel  make mrproper - This target cleans up the build environment of any stale files and dependencies that might have been left over from a previous kernel build. All previous kernel configurations will be cleaned (deleted) from the build environment.  make clean - This target does not do as thorough a job as the “mrproper” target. It only deletes most generated files. It does not delete the kernel configuration file (.config).  make menuconfig - This target invokes a text-based editor interface with menus, option lists, and text-based dialog boxes for configuring the kernel.  make xconfig - This is an X Window System–based kernel configuration tool that relies on the Qt graphical development libraries. These libraries are used by KDE-based applications.  make gconfig - This target also invokes an X Window System–based kernel configuration tool, but it relies on the GTK2 (GIMP) toolkit. This GTK2 toolkit is heavily used in the GNOME desktop world.  make help - This target will show you all the other possible make targets and also serves as a quick online help system.
  • 8. What is Optimization?  Server Design  Stability  Availability  Performance  General Server Response  Hardware Response  Service Response
  • 9. Performance  Hardware  Safe Clean Environment  Software  Enhancement in parameter improvements can compensate and improve older hardware performance  Avoid a GUI  At least unload the GUI after using it
  • 10. Server Optimization  Fine Tuning  Services  Hardware  Kernel  Network  Security  Database  Storage  Memory
  • 11. Recommendations  Custom installs  Only load the essentials  Partitioning Planning  Know the purpose of your server
  • 12. Performance Monitoring  CPU  Network  I/O  Memory
  • 13. CPU Performance Metrics  Context Switch  Run Queue  CPU Utilization  Load Average
  • 14. Context Switch  Context Switch - CPU moves from one thread to another  During context switch, the kernel stores current thread state in memory  Simultaneously, the kernel retrieves previously stored thread state from memory & loads it to the CPU  Context switching affords multitasking of CPU  High levels of context switching can cause performance degradation  Example: pidstat 2 5  Display five reports of CPU statistics for every active task in the system at two second intervals.
  • 15. Run Queue  Run Queue – total number of active processes in current queue for CPU  Processes in sleep state of I/O wait state are not in the run queue  High number of processes in the run queue can cause performance degradation  Example: vmstat  The r column in the table represents run queue processes
  • 16. CPU Utilization  CPU Utilization – percentage that the CPU is being used  Higher percentage of CPU utilization can cause performance degradation  Example: top  Real time view of cpu utilization
  • 17. Load Average  Load Average – average CPU load over a specified time period  Load average is displayed for the last 1 minute, 5 minutes, and 15 minutes  Easy monitoring for overall load  Load Average is calculated by combining the total number of processes in the run queue and the total number of processes in the uninterruptable task status  Example: uptime  “0.25 1.20 1.90” – System load coming down  .25 - Load average for last 1 minute  1.20 – Load average for last 5 minutes  1.90 – Load average for last 15 minutes
  • 18. Disk I/O Optimization  4 different I/O schedulers  CFQ (default) – distributes all I/O bandwidth evenly among all processes requesting I/O  NOOP – acts as a basic FIFO queue expecting the hardware controller to handle the performance operations of the requests; attempts to use as little CPU as possible  Anticipatory – designed to increase performance on systems that have slow disks; reorders all disk I/O operations to optimize disk seeks  Deadline – places I/O requests in a priority queue so each is guaranteed to run within a certain time; often used in real-time operating
  • 19. Changing Schedulers  Which schedules do you have compiled  /sys/block/sda/queue # cat scheduler  anticipatory deadline [cfq]  Compile noop  /sys/block/sda/queue # modprobe noop-iosched  anticipatory deadline [cfq] noop  Change  /sys/block/sda/queue # echo anticipatory > scheduler  http://www.linuxhowtos.org/System/iosched.htm
  • 20. Scheduler  Agility  Changing schedulers on the fly allows for benchmark testing of your specific applications and hardware  Notes  The change will not be instant. All current processes in run queue must complete first.  Once you find the optimal scheduler for your specific situation, apply the change for subsequent reboots
  • 21. Scheduler Suggestions  Use NOOP or Deadline on SSD drives  Benchmark each scheduler to determine your optimal solution  CFQ is not always the best scheduler for your system  Example: Your system is running a raid
  • 22. I/O Optimization  Consistent high I/O wait indicates an issue with the disk subsystem  Monitor BI & BO (Block in & Block out)  Reads/second & writes/second can also identify trouble areas  Check TPS (transactions/second) – total of BI & BO  Example: vmstat
  • 23. vmstat  Procs  r: The number of processes waiting for run time.  b: The number of processes in uninterruptible sleep.  Memory  swpd: the amount of virtual memory used.  free: the amount of idle memory.  buff: the amount of memory used as buffers.  cache: the amount of memory used as cache.  inact: the amount of inactive memory. (-a option)  active: the amount of active memory. (-a option)  Swap  si: Amount of memory swapped in from disk (/s).  so: Amount of memory swapped to disk (/s).  IO  bi: Blocks received from a block device (blocks/s).  bo: Blocks sent to a block device (blocks/s).  System  in: The number of interrupts per second, including the clock.  cs: The number of context switches per second.  CPU  These are percentages of total CPU time.  us: Time spent running non- kernel code. (user time, including nice time)  sy: Time spent running kernel code. (system time)  id: Time spent idle. Prior to Linux 2.5.41, this includes IO- wait time.  wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.  st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
  • 24. Disk I/O Optimization File System Max File Size Max Partition Size Journaling Notes Fat16 2 GB 2 GB No Legacy Fat32 4 GB 8 TB No Legacy NTFS 2 TB 256 TB Yes (For Windows Compatibility) NTFS-3g is installed by default in Ubuntu, allowing Read/Write support ext2 2 TB 32 TB No Legacy ext3 2 TB 32 TB Yes Standard linux filesystem for many years. Best choice for super-standard installation. ext4 16 TB 1 EB Yes Modern iteration of ext3. Best choice for new installations where super-standard isn't necessary. reiserFS 8 TB 16 TB Yes No longer well-maintained. JFS 4PB 32PB Yes (metadata) Created by IBM - Not well maintained. XFS 8 EB 8 EB Yes (metadata) Created by SGI. Best choice for a mix of stability and advanced journaling.
  • 25. Disk I/O Optimization  Disk Cache Policy  hdparm -a /dev/sda  Readahead value at least 1024  Write Policy  Writeback  Read Policy  Adaptive readahead  Penalties  Calculate the IOPS
  • 26. Disk Optimization  Solutions  Bonnie++  Hdparm  Upgrades  BIOS  Firmware
  • 27. Network  Monitoring  Total number of packets  Received  Sent  Dropped
  • 28. TCP Optimization – Large Production Servers  Port Availability  Echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range  Memory Allocation with Socket Buffers  Echo 262143 > /proc/sys/net/core/rmem_max  Echo 262143 > /proc/sys/net/core/rmem_default  TCP Stack Workload Reduction  Echo 0 >/proc/sys/net/ipv4/tcp_sack  Echo 0 > /proc/sys/net/ipv4/tcp_timestamps
  • 29. Memory Optimization  Virtual Memory – swap space available on the disk & physical memory (user space & kernel space)  Kernel’s file system cache takes advantage of the unused RAM  During a swap, Linux writes the least used memory pages from the physical memory to the swap space on the disk  High levels of swapping will degrade performance, because the disk is much slower  Vmstat command  Recommendation  Benchmark tests prove that ECC RAM is faster
  • 30. Additional Helpful Commands  Netstat – lists network sockets  Ps – snapshot of current processes  Atop – interactive monitor for the load averages  Mtop – displays mysql threads  Iostat – reports cpu & I/O statistics  Xosview – displays CPU usage, load average, memory usage, swap space usage, network usage, interrupts, and serial port status
  • 31. Kernel Optimization  The first thing to get loaded is the kernel. Keep in mind that no operating system exists in memory at this point, and PCs (by their unfortunate design) have no easy way to access all of their memory. Thus, the kernel must load completely into the first megabyte of available random access memory (RAM). In order to accomplish this, the kernel is compressed. The head of the file contains the code necessary to bring the CPU into protected mode (thereby removing the memory restriction) and decompress the remainder of the kernel.  Kernel Execution. With the kernel in memory, it can begin executing. It knows only whatever functionality is built into it, which means any parts of the kernel compiled as modules are useless at this point. At the very minimum, the kernel must have enough code to set up its virtual memory subsystem and root file system (usually, the ext3 file system). Once the kernel has started, a hardware probe determines what device drivers should be initialized. From here, the kernel can mount the root file system. (You could draw a parallel of this process to that of Windows being able to recognize and access its C drive.) The kernel mounts the root file system and starts a program called init.
  • 32. Boot Loaders  MBR – starting on page 142 of Linux Administration  GRUB  Modify boot record & kernel initiation  Splash screen  Hidden menus  Title  Root  Initrd – preload modules in kernel  LILO
  • 33. Database Optimization  MySQL – use MySQL tuning scripts  Optimize table
  • 34. OpenLDAP Optimization  Important Decision – Which attributes will you build indexes on  Optimal Parameters – change before data entry  /etc/openldap.conf  Cachesize 10000  Dbcachesize 100000  Sizelimit 10000  Loglevel 0  dbcacheNoWsync  Index cn,uid  Index uidnumber  Index gid  Index gidnumber  Index mail
  • 35. Apache Optimization  Good Benchmark Scores – many initial daemons  Example  MinSpareServers 20  MaxSpareServers 80  StartServers 32  If Apache is recompiled  MaxClients 256  MaxRequestsPerChild 10000  Notes – A high number of max servers and an honest number of spare servers will work fine. For the most part the StartServers help with the instant load that benchmarks generate.
  • 36. Apache Management  Default Directory - /var/www/html  Apache Config File - /etc/httpd/httpd.conf  /etc/httpd/conf.d/phpMyAdmin.conf  PHP Config File - /etc/php.ini  /etc/init.d/httpd start|stop|restart  Service httpd start|stop|restart  /var/log/httpd/error_log  /var/log/httpd/access_log
  • 37. Poor Performance Website  Consider  Optimizers  Memcache  Adjusting Apache  Minimizing Apache modules  Alternative to apache - nginx
  • 38. Benchmarking  Benchmarking is helping; HOWEVER,  Its impossible to duplicate real world situations  Understand the GOAL for benchmarking  Measuring the performance of ONE particular element very accurately  Benchmarks are excellent tools if you understand what they are doing and trying to accomplish
  • 39. Benchmark Tools  Bonnie++ - file system benchmarking tool  Dbench – I/O workload generator to a file system or networked CIFS or NFS server  Http_load – throughput tester for a web server  Dkftpbench – FTP download benchmark analyzer  Tiobench – multi-threaded I/O benchmark tool  Ttcp – network throughput measuring tool  Netperf – network performance tester
  • 40. More Helpful Tools  Lsof – list open files  Tcpdump – network packet analyzer  Htop – process monitoring  Iotop – monitors disk I/O  IPTraf – real time IP LAN monitoring  Psacct – monitor user activity  Monit – process & services monitoring  Nethogs – monitor per process network bandwidth  Iftop – network bandwidth monitoring  Monitorix – system & network monitoring
  • 41. Troubleshooting Methodology  Clearly understand the problem  Monitor & collect data  Eliminate and narrow issues  Make one change at a time & OBSERVE  Document everything!
  • 42. References  Davor Guttierrez - @dguttierrez  Soyinka, W. (2008). Linux Administration: A Beginner's Guide. McGraw-Hill, Inc..  http://www.tecmint.com/command-line-tools-to-monitor-linux- performance/  http://www.thegeekstuff.com/2011/07/iostat-vmstat-mpstat- examples/