Linux Tools for Monitoring and Performance. Khalid Baheyeldin November 2009 KWLUG http://2bits.com



Similar documents
20 Command Line Tools to Monitor Linux Performance

Drupal Performance Tuning

Performance Tuning and Optimization for high traffic Drupal sites. Khalid Baheyeldin Drupal Camp, Toronto May 11 12, 2007

CIT 668: System Architecture. Performance Testing

Example of Standard API

W3Perl A free logfile analyzer

Web Application s Performance Testing

OS Observability Tools

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney

Red Hat Enterprise Linux (RHEL 6) Courses

Volume SYSLOG JUNCTION. User s Guide. User s Guide

making drupal run fast

Monitoring MySQL. Presented by, MySQL & O Reilly Media, Inc. A quick overview of available tools

Optimizing Linux Performance

Benchmarking and monitoring tools

1 How to Monitor Performance

Replacing a Laptop Hard Disk On Linux. Khalid Baheyeldin KWLUG, September 2015

OS Thread Monitoring for DB2 Server

CIT 470: Advanced Network and System Administration. Topics. Performance Monitoring. Performance Monitoring

User Guide Zend Server Community 4.0.3

Linux System Administration on Red Hat

Monitoring, Tracing, Debugging (Under Construction)

PHP on IBM i: What s New with Zend Server 5 for IBM i

MAGENTO HOSTING Progressive Server Performance Improvements

How to create a load testing environment for your web apps using open source tools by Sukrit Dhandhania

Operating System Structures

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

Achieving High Throughput. Fernando Castano Sun Microsystems

Stress Testing for Performance Tuning. Stress Testing for Performance Tuning

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

Security Correlation Server Quick Installation Guide

Accelerating Rails with

Web Hosting: Pipeline Program Technical Self Study Guide

Network Probe User Guide

VMware vcenter Log Insight Security Guide

TRACE PERFORMANCE TESTING APPROACH. Overview. Approach. Flow. Attributes

Configuring Apache Derby for Performance and Durability Olav Sandstå

NTT Web Hosting Service [User Manual]

New Relic & JMeter - Perfect Performance Testing

Assignment # 1 (Cloud Computing Security)

Davor Guttierrez 3 Gen d.o.o. Optimizing Linux Servers

Intro to Docker and Containers

CS3600 SYSTEMS AND NETWORKS

Oracle Linux 7: System Administration Ed 1 NEW

System Resources. To keep your system in optimum shape, you need to be CHAPTER 16. System-Monitoring Tools IN THIS CHAPTER. Console-Based Monitoring

Chapter 3 Operating-System Structures

Java DB Performance. Olav Sandstå Sun Microsystems, Trondheim, Norway Submission ID: 860

Install Cacti Network Monitoring Tool on CentOS 6.4 / RHEL 6.4 / Scientific Linux 6.4

MEASURING WORKLOAD PERFORMANCE IS THE INFRASTRUCTURE A PROBLEM?

Scalability of web applications. CSCI 470: Web Science Keith Vertanen

Cloud Performance Benchmark Series

1 How to Monitor Performance

ELIXIR LOAD BALANCER 2

Runtime Monitoring & Issue Tracking

HARFORD COMMUNITY COLLEGE 401 Thomas Run Road Bel Air, MD Course Outline CIS INTRODUCTION TO UNIX

PERFORMANCE TUNING ORACLE RAC ON LINUX

How to Troubleshoot Server Load and Processes

Module I-7410 Advanced Linux FS-11 Part1: Virtualization with KVM

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues

Architecting ColdFusion For Scalability And High Availability. Ryan Stewart Platform Evangelist

Command Line Interface User Guide for Intel Server Management Software

This presentation explains how to monitor memory consumption of DataStage processes during run time.

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Oracle Linux Advanced Administration

Virtually Secure. a journey from analysis to remote root 0day on an industry leading SSL-VPN appliance

Serving 4 million page requests an hour with Magento Enterprise

Introduction to Operating Systems

ELEC 377. Operating Systems. Week 1 Class 3

SAIP 2012 Performance Engineering

Improved metrics collection and correlation for the CERN cloud storage test framework

RPC and TI-RPC Test Suite Test Plan Document

Ubuntu Sever Administration

Advanced Linux System Administration Knowledge GNU/LINUX Requirements

CS 188/219. Scalable Internet Services Andrew Mutz October 8, 2015

SMB a protocol example

Chapter 2 System Structures

About Forum Howtos & FAQs Low graphics Shell Scripts RSS/Feed. nixcraft - insight into linux admin work Home > CentOS. by Vivek Gite 134 comments

The Monitis Monitoring Agent ver. 1.2

Managed Appliance Installation Guide

Advanced Linux System Administration on Red Hat

Lesson 7 - Website Administration

The System Monitor Handbook. Chris Schlaeger John Tapsell Chris Schlaeger Tobias Koenig

Hands-On Microsoft Windows Server 2008

PostgreSQL on Windows

readme_asm.txt README.TXT

Simple Tips to Improve Drupal Performance: No Coding Required. By Erik Webb, Senior Technical Consultant, Acquia

CYAN SECURE WEB APPLIANCE. User interface manual

Security Correlation Server Quick Installation Guide

IBM Tivoli Composite Application Manager for Microsoft Applications: Microsoft Internet Information Services Agent Version Fix Pack 2.

Secure Web. Hardware Sizing Guide

GL254 - RED HAT ENTERPRISE LINUX SYSTEMS ADMINISTRATION III

Review Quiz 1. What is the stateful firewall that is built into Mac OS X and Mac OS X Server?

Ensuring scalability and performance with Drupal as your audience grows

Container-based operating system virtualization: a scalable, high-performance alternative to hypervisors

Setting up PostgreSQL

Network Monitoring Tool with LAMP Architecture

Transcription:

Linux Tools for Monitoring and Performance Khalid Baheyeldin November 2009 KWLUG http://2bits.com

Agenda Introduction Definitions Tools, with demos Focus on command line, servers, web Exclude GUI tools (Gnome/KDE) Questions, discussion

About Khalid 25 years in software development and consulting Sinclair ZX Spectrum, mainframe, then UNIX since 1987 Linux discovered 1990, using it regularly since 1995, LAMP since 1999 Open source developer, contributor since 2003 Full time open source consulting

About 2bits.com Founded in 1999, based in Waterloo, Ontario. Using and contributing to Drupal since 2003 Full time consulting Services Drupal development LAMP performance optimization and tuning Server provisioning for performance and uptime Manage huge sites for various clients http://2bits.com

Definitions Faster/Speed Ability to handle a given request fast, taking the least time possible Scalable Ability to handle more requests per unit of time They are related, but not the same. Resource utilization matters

powertop Not really performance, but just wanted to mention it... Created by Intel Useful for laptops (maximize battery life). Shows wakeups from idle per second, preventing power savings

powertop Demo...

top A process, CPU, memory viewer Curses based Comprehensive (and hard to remember) options Use the? to get help

top Demo...

htop A better top alternative Color coded Shows multiple CPUs Help on the screen (Function keys) More configurable (columns to show, meters,...etc.)

htop Demo...

vmstat System wide view of resource utilization Processes (runnable, blocked) Memory (free, buffers, cache) Swap (swap ins, swap outs) I/O (blocks in, blocks out) Interrupts and context switches CPU (system, user, idle, wait for I/O) First row is since boot!

vmstat Demo... (CPU and disk)

netstat Network connections t tcp, u udp, n no DNS Mainly for aggregates How many ESTABLISHED connections? How many FIN_WAIT/CLOSE_WAIT nestat tunp grep :80 grep EST nestat tunp grep :80 grep WAIT

ntop Daemon that reports network activity Opens a port, and you can connect a browser to it Lots of options, and lots of info

vnstat Network adapter traffic (in/out) By hour, day, week, month Initialize by: vnstat u i eth0 Hourly: vnstat h Daily: vnstat d Monthly: vnstat m tr : sample traffic and display l : Live real time traffic

vnstat Demo...

iostat Disk reads and writes Also some CPU info Can also report on NFS First row is since boot!

iostat Disk characteristics (approximate) 7200RPM SATA drives ~ 100 IOPS 15,000RPM SAS drives ~ 180 IOPS Mainly for: Which disk is being hit hardest? Can I move stuff to another less used disk? e.g. Web server: Operating system, MySQL, files, and logs

iostat Example: iostat t x 15 sda sdb

iostat Demo...

sar/atsar System Activity Report UNIX System V origin (sar) Samples taken at cron Reports produced on demand Many types of reports

atop Advanced Top Daemon as well as interactive Screen is loaded with info... interpretation is the key...

strace Single process tracer Can trace from command line Can also trace running processes Timing option See what system calls are done, and what arguments are passed Under the hood calls over the network, e.g. Trying to cache a javascript file for Google Analytics

strace example strace tt f v s 128 o /tmp/k.txt p 123 tt Timestamp, with microsecond f follow forks v verbose output(some syscalls) s show 128 bytes of strings o output file p process ID to trace

strace output 17386 14:57:40.266864 read(3, "\17\23HTTP_USER_AGENTw3m/0.5.1+cvs 1.968\v8HTTP_ACCEPTtext/html, text/*;q=0.5, image/*, application/*, audio/*\24$http_accept_encodingg"..., 749) = 749 17386 14:57:40.302662 write(3, "\1\6\0\1\22\350\0\0X Powered By: PHP/5.2.4 2ubuntu5.7\r\nSet Cookie: SESSd2d9a1cda25904d4196f2913e45db14b=b4 c7592ffee7764d61082594f35b01d4; e"..., 4864) = 4864 35.79 milliseconds. Fast because Drupal's cache is enabled.

DTrace Solaris technology by Sun Microsystems Dynamic tracing framework Not available for Linux

systemtap DTrace like tool for Linux An interpreter for a special language Works with systemwide probes that you set Requires kernel symbols (Not Ubuntu) Site: http://sourceware.org/systemtap/wiki Lots of examples, e.g. List Executables Reading and Writing the Most Data Track Cumulative I/O Activity by Process Name

systemtap example Watch all opens, and print which process is opening what file probe syscall.open { printf ("%s(%d) open (%s)\n", execname(), pid(), argstr) } probe timer.ms(4000) { # after 4 seconds } exit()

oprofile Systemwide profiler Kernel driver + daemon for collecting data Does not require symbols for some things it does Symbols will help in certain cases (callgraphs)

oprofile workflow Start profiling, excluding the kernel opcontrol no vmlinux opcontrol start Do what you want profiled opcontrol shutdown View the report (next slide) Remember to reset the data between runs opcontrol reset

oprofile Report full file names opreport f Limit report to a minimum percentage opreport t 5

Valgrind & friends Tool for memory debugging, memory leak detection, and profiling Useful for C/C++ programmers for memory leaks Virtual Machine with Just In Time compiler Built for Linux and x86, but found its way elsewhere (MacOS/X, and some BSDs) Related tool: Cachegrind Related tool: Callgrind, and Kcachegrind

Xdebug (PHP) PHP remote debugger Local IDE or editor can interact with a program being debugged on another server Over the network protocol for debugging Hard to configure, but worth it for PHP apps Has profiling feature Outputs defacto standard profiling format Can be analyzed using valgrind/kcachegrind front end

Xdebug configuration For profiling, you need to add the following to your php.ini, or /etc/php5/conf.d directory: xdebug.profiler_append=0 xdebug.profiler_enable_trigger=1 xdebug.profiler_enable=1 xdebug.profiler_output_dir=/tmp xdebug.profiler_output_name=cachegrind.out

Xdebug and Cachegrind Demo...

MySQL processlist Shows queries running now and how long they take Shows only seconds, not milli or micro seconds SHOW PROCESSLIST; SHOW FULL PROCESSLIST; mysqladmin processlist mysqladmin v processlist

MySQL Processlist Demo...

ApacheTop Reports how many requests per second Apache is doing Can monitor URLs, IP addresses, referrers Type? for commands apachetop f /var/log/apache2/access.log Options: T seconds

ApacheTop Demo...

Munin Graphical presentation of resource usage data over time Extensible framework, via scripts (perl, shell, python,...) Number of FastCGI PHP processes Memcached customizations Browser based for data display By day, week, month, up to one year of data

Munin monitors CPU (system, user, idle, wait for I/O) Disk Memory, Swapping Context switches, interrupts Network Load average

Munin monitors Postfix / Exim Apache (number processes, bytes,...etc.) MySQL (number of queries, connections, bytes) Many in your distro's package More on their web site Custom Memcached PHP processes

Munin Demo...

awstats A web log analysis tool, e.g. Apache's access log Shows many things Hits (every HTTP request, whether.css,.png,.gif,.ico,.jpg,...etc.) Page views Unique visitors 404s Search engine keywords

awstats Top requesting IP addresses (bots, leechers,...etc.) Operating system Browser information By month, day Keeps history Bandwidth usage

Awstats Demo...

Google Analytics Similar to Awstats in purpose, but operates differently and shows different results Uses Javascripts, so shows less figures Mainly humans Excludes bots, crawlers More marketing oriented

Google Analytics Demo...

Benchmarking Web benchmarking Apache Bench (ab) Siege httperf autobench (wrapper around httperf) OpenWebLoad Jmeter (Java application, with a GUI)

Other Benchmarking Quick and dirty For CPU hogging bzip2 c < /dev/urandom > /dev/null For Disk I/O hogging cd /; grep r blah.

Conclusion Questions? Comments? Discussions?