Apache Performance Tuning Part 1: Scaling Up Sander Temme.

Slides:



Advertisements
Similar presentations
Web Hosting for Fame and Fortune
Advertisements

In Production Juan Marin. Agenda Introduction Reliability Availability Performance Data optimizations Runtime optimizations Measuring your environment.
Apache Performance Tuning Part 2: Scaling Out Sander Temme.
Apache Performance Tuning Part 1: Scaling Up Sander Temme.
Apache Performance Tuning Part 1: Scaling Up Sander Temme.
Apache Performance Tuning Part 2: Scaling Out Sander Temme.
Dan Fleck.  WAMP – Windows Apache MySQL PHP -  LAMP – Linux Apache MySQL PHP ◦ There are.
Michelle J. Gosselin, Jennifer Schommer Guanzhong Wang.
ManageEngine TM Applications Manager 8 Monitoring Custom Applications.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Analysis and Performance Information Systems 337 Prof. Harry Plantinga.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
APACHE WEBSERVER.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Apache Performance Tuning Part 1: Scaling Up Sander Temme.
Apache Jakarta Tomcat Suh, Junho. Road Map Tomcat Overview Tomcat Overview History History What is Tomcat? What is Tomcat? Servlet Container.
SquirrelMail for Webmail AfNOG 2012 Scalable Internet Services (SS-E) Presented by Michuki Mwangi Serrekunda, Gambia (Original Materials by Joelja)
Chapter 22 Web Hosting and Internet Servers Xuanxuan Su.
Shoehorning Apache Onto Your Box System Sizing Tips Sander Temme.
Apache Architecture. How do we measure performance? Benchmarks –Requests per Second –Bandwidth –Latency –Concurrency (Scalability)
Linux Operations and Administration
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Apache Tomcat Web Server SNU OOPSLA Lab. October 2005.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 24 – Web Servers (PWS, IIS, Apache, Jigsaw) Outline 24.1Introduction 24.2Microsoft Personal.
Lighttpd & Modcache 2009/06/28. Basic lighttpd info Event-driven, single process Event-driven, single process Uses non-block io (network) + writev (memory)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
1 Shoehorning Apache Onto Your Box System Sizing Tips Sander Temme.
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
Shoehorning Apache Onto Your Box System Sizing tips Sander Temme.
Web Services CSCI N321 – System and Network Administration Copyright © 2007,2008 by Scott Orr and the Trustees of Indiana University.
Information & Decision Management Dept West Texas A&M University
1 Apache. 2 Module - Apache ♦ Overview This module focuses on configuring and customizing Apache web server. Apache is a commonly used Hypertext Transfer.
Ideas to Improve SharePoint Usage 4. What are these 4 Ideas? 1. 7 Steps to check SharePoint Health 2. Avoid common Deployment Mistakes 3. Analyze SharePoint.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG 11 Kigali, Rwanda May 2010 Dorcas Muthoni Courtesy: Hervey Allen.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building Assignment.
2440: 141 Web Site Administration Web Server Monitoring and Analysis Instructor: Enoch E. Damson.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building.
3108 Getting the Most out of StarTeam Web Edition John Sileski Senior Program Manager Borland.
Running Jakarta/Tomcat CIT304/CSE301 University of Sunderland Harry R. Erwin, PhD.
Installing, Configuring And Troubleshooting Coldfusion Mark A Kruger CFG Ryan Stille CF Webtools.
Apache Web Server. Aim of this section –Introduce you to workings of the most common webserver –Give you a little experience in role of webmaster Configuring.
Proxy Server PROXY SERVER. What is a Web Proxy? Proxy Server A proxy is a host which relays web access requests from clients Used when clients do not.
Module 9: Implementing Caching. Overview Caching Overview Configuring General Cache Properties Configuring Cache Rules Configuring Content Download Jobs.
Apache Web Server Administration Syed Iqbal Syed Iqbal.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
1 Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG X Cairo, Egypt May 2009 Hervey Allen.
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
1 PUPPET AND DSC. INTRODUCTION AND USAGE IN CONTINUOUS DELIVERY PROCESS. VIKTAR VEDMICH PAVEL PESETSKIY AUGUST 1, 2015.
Multi-Domain Hosting Hosting multiple domains on one server using Apache John Beckett 1/16/2013.
Apache HTTP Server from 10,000 feet An open source Apache feature overview and discussion.
Accelerating PHP Applications Ilia Alshanetsky O’Reilly Open Source Convention August 3rd, 2005.
Apache Web Server Architecture Chaitanya Kulkarni MSCS rd April /23/20081Apache Web Server Architecture.
NJIT 1 Apache Tomcat (Version 6.0) THETOPPERSWAY.COM.
IBM Http Server Basic Administration. CONTENTS Web server IHS How does IHS differ from Apache Basic configurations Advanced Configurations Performance.
Web Cache. What is Cache? Cache is the storing of data temporarily to improve performance. Cache exist in a variety of areas such as your CPU, Hard Disk.
Web Server Administration Chapter 11 Monitoring and Analyzing the Web Environment.
NWCLUG 04/06/2010 Jared Moore L A M P.
Web and Proxy Server.
GlassFish Performance Tuning: Tips from the Field
Apache web server Quick overview.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess
Relational database and SQL MySQL LAMP SQL queries
Shoehorning Apache Onto Your Box
Processes The most important processes used in Web-based systems and their internal organization.
PHP / MySQL Introduction
Apache Performance Tuning
Moodle Scalability What is Scalability?
ColdFusion Performance Troubleshooting and Tuning
Presentation transcript:

Apache Performance Tuning Part 1: Scaling Up Sander Temme

2 “Apache is a general webserver, which is designed to be correct first, and fast second. Even so, its performance is quite satisfactory. Most sites have less than 10Mbits of outgoing bandwidth, which Apache can fill using only a low end Pentium- based webserver.” says:

3

The Silver Bullet “Make my web server go fast, please”

5

Sorry There is No Silver Bullet

7 No Silver Bullet Every site is different –Dynamic Content –Static Content Different Traffic Patterns SSL or Plaintext No Cookie Cutter Approach

8 Performance Tuning Ready Aim Fire Aim some more Understand Aim even more Fire

9 In practice Setup for analysis Monitor and analyse Tune configuration Lather, rinse, repeat

10 Monitoring Your Server

11 Purposes of Monitoring Observation Extrapolation Signals/Alerts Testing

12 Monitoring Apache

13 Monitoring Solaris: SE Toolkit Lightweight Programmable Alive

14 Other Monitoring Tools vmstat iostat top free

15 Web Server Logs ErrorLog –LogLevel: debug, info, notice, warn, error, crit Access Log: TransferLog or CustomLog –Common Log Format

16 Common Log Format [16/Nov/2003:15:23: ] "GET /~sctemme/ HTTP/1.1" [16/Nov/2003:15:23: ] "GET /~sctemme/css/doc.css HTTP/1.1" [16/Nov/2003:15:23: ] "GET /~sctemme/css/menu.css HTTP/1.1" [16/Nov/2003:15:23: ] "GET /favicon.ico HTTP/1.1" [16/Nov/2003:15:23: ] "GET /~sctemme/index.html HTTP/1.1" Client IP RFC 1413 ident- username- timestamp[16/Nov/2003:15:23: ] Request"GET /favicon.ico HTTP/1.1" Status Code404 Content Bytes283

17 Analysis Analyse Apache log files Periodically run vmstat, iostat –Set up a script Watch for Trends –Tells you when to buy new kit Watch for Peaks –And how your system behaves

18 Configuring for Performance Configuring Apache Tuning the Operating System

19 Apache Configuration Process/Thread Management DNS Lookups Avoid.htaccess Files Disable unused modules Tune your App Tier

20 DNS Lookups HostnameLookups Access Control –Bad: Deny from example.com –Good: Deny from

21.htaccess Files Per-directory configuration files Accessed for every request Best performance: AllowOverride none GET /dir1/dir2/restricted.html HTTP/1.0

22 MaxClients Configuration file directive Maximum number of workers Apache 1.3, 2 Prefork: processes Apache 2 Worker: threads * processes Limit according to resources (memory)

23 Server-side Includes We Love Them! –Easy to implement –Easy to manage We Hate Them! –They break sendfile() –They may break cacheability

24 SSI on SSI Enabled

25 Sizing MaxClients Take total RAM Subtract OS allowance –look at free value without Apache, etc. Subtract external program allowance –JVM, cgi programs, MySQL? Divide by httpd process size –Read process size from top

26 Top

27 Selecting Your MPM Processes and Threads Differences between platforms Thread-safety issues

28 Processes and Threads Process: –Own copy of data structures –Shares: program code, shared memory –Context switches expensive Thread: –Runs within process –Shares process environment –No context switch

29 Platforms and Threading Context switches expensive on Solaris, AIX Context switches cheaper on Linux Solaris uses M:N threading Linux uses 1 process per thread LinuxThreads implementation is old –Replaced by Native Posix Thread Library (NPTL) in 2.6 –NTPL already in RH 9, RHAS 3

30 Thread-safety Third-party modules and libraries –mod_perl: experimental threading in Perl 5.6; more mature in Perl 5.8 –PHP: uses many third-party libraries FreeBSD: threading not reliable until 5.x –Apache 2.2 Worker MPM runs on FreeBSD

31 Tune your App Tier Tomcat –Edit server.xml, tune minProcessors, maxProcessors –Use APR -> Persistent connections –Tune JVM (Heap, Garbage Collection) MySQL –Ships with various scenarios in support-files: my-{small,medium,large,huge}.conf –PHP & prefork: every child makes a connection –Tune max_connections variable in my.cnf

32 System Tuning Tips RAM and swap space ulimit: files and processes Turn off unused services and modules

33 RAM and Swap Swap is disk-based Extension of RAM Excessive swapping kills performance Tune MaxClients Never have more memory than swap –Upgrade RAM -> add more swap space

34 ulimit Per-process resource limits Built-in command of sh, bash Important limits: – processes (-u) –open files (-n) Set in invoking shell Code in Apache 2.0 startup script –ulimit -S -n `ulimit -H -n` Linux: /etc/security/limits.conf

35 Caching Content Dynamic Content is Expensive Static Content Relatively Cheap Several Approaches: –Dynamic caching –Pre-rendering popular pages (index.rss…)

Case Study This is happening right now

37 DVD Key Suppression Snafu

38 mod_cache Configuration CacheRoot /raid1/cacheroot CacheEnable disk / # A page modified 100 min. ago will expire in 10 min. CacheLastModifiedFactor.1 # Always check again after 6 hours CacheMaxExpire 21600

39 Make Popular Pages Static RSS Feeds Popular catalog queries … (Check your access log)

40 Static Page Substitution Options +Indexes Order allow,deny Allow from all RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /cgi-bin/blosxom.cgi/$1 [L,QSA]

41 Tips Observe Before You Act Act on Monitoring Results Don’t Overload Your System

Q&A

43 Conference Roadmap Apache Web Server Cookbook Apache Performance Tuning Part 2: Scaling Out Fronting Apache Tomcat with Apache Httpd Apache MINA - The high-performance protocol construction toolkit

Current Version

Thank You

46 Further Reading Ryan B. Bloom, Apache Server 2.0: The Complete Reference, 2002 McGraw Hill Osborne; ISBN Ben Laurie and Peter Laurie, Apache: The Definitive Guide (3rd Edition), 2002 O’Reilly & Associates; ISBN Patrick Killelea, Web Performance Tuning, 2nd Edition, 2002 O’Reilly & Associates; ISBN X Adrian Cockcroft, Richard Pettit and Sun Microsystems Press, Sun Performance and Tuning: Java and the Internet (2nd Edition), 1998 Prentice Hall PTR; ISBN Ken Coar and Rich Bowen, Apache Cookbook, 2003 O’Reilly & Associates; ISBN