Bookmark and Share

Thursday, July 16, 2009

Quick and Dirty Performance Testing With Apache Bench

If you need a quick and dirty way to throw some load onto a load balancer/ADC or web server, Apache comes with a great tool called Apache Bench.  Since it's an HTTP client, it will of course work with any server, not just Apache-based servers.

Typically, Apache Bench (ab) is installed with the base Apache install, from at least Apache 1.3 on.  This includes when Apache is installed on Windows.

You can check all of the available options on the ab documentation page, but here's a (very) quick reference to using it.

Two of the most important options are "-n" for the number of total connections, and "-c" for how many concurrent connections are done at the same time.

For instance, using the option "-n 1000″ will do 1,000 requests, one at a time, to a target URL.

ab -n 1000 http://website.com/

One at a time is rarely an effective test, so it's best to use the "-c" option to specify a high number of concurrent connections, such as 100.

ab -n 1000 -c 100 http://website.com/

If you use concurrency, ab will split the total number of requests up amongst the concurrent settings.  For instance, using the option "-n 1000″ will do 1,000 connections, but "-n 2000 -c 100″ will only do 20 requests from 100 different connections (2,000 / 100 = 20).  So it's best to use a much larger number of total connections if you're doing concurrency.

ab -n 100000 -c 100 http://website.com/

When ab is finished running, it will spit out a performance report, including such info as the time taken for tests, requests per second, wait time, etc.

Finished 1000 requests

Server Software: Apache/2.2.9
Server Hostname: localhost
Server Port: 80

Document Path: /
Document Length: 45 bytes

Concurrency Level: 10
Time taken for tests: 0.427 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 320640 bytes
HTML transferred: 45090 bytes
Requests per second: 2341.45 [#/sec] (mean)
Time per request: 4.271 [ms] (mean)
Time per request: 0.427 [ms] (mean, across all concurrent requests)
Transfer rate: 733.17 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 0.4 2 3
Processing: 0 2 0.5 2 7
Waiting: 0 2 0.5 2 6
Total: 0 4 0.7 4 8

Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 5
80% 5
90% 5
95% 5
98% 5
99% 5
100% 8 (longest request)

The ab utility defaults to one request per TCP connection (KeepAlive turned off).  If you want to use KeepAlive, where multiple requests are made through a TCP connection, use the "-K" option, open up as many TCP connections as you specify in concurrency ("-c") and make the total number of quests through those few open TCP connections.

The utility is a simple but power tool for testing load balancers and web servers.  It doesn't tend to reflect real-world usage, but it can be useful for baseline testing and troubleshooting.  I've found it quite useful over the years.

Free Web Design books

Free Web design and Development books

Outsourcing Web Projects: 6 Steps to a Smarter Business
Outsourcing Web Projects: 6 Steps to a Smarter Business provides you with tried and tested techniques that will ensure that you can deliver complex, high quality web projects using outsourced development resource, both on time and on budget!. (For visitors from USA, Canada, Mexico, United Kingdom only.)
Web Style Guide, 2nd edition
Free online book Web Style Guide covers all the basic elements of creating a Web site. The book begins the presentation of its helpful and forward-looking advice with a discussion of the overall process of defining the objectives and users of your Web site, as well as the goals you will use to measure your progress. The authors then use time-tested, traditional print concepts to clearly illustrate how to make your site interface welcoming and efficient. High-quality illustrations show how to design for overall style and professional appeal.
Building Accessible Websites
Topics covered in this online book include The structure of accessible pages, Text and links, Navigation, Type and colour, Tables and frames, Stylesheets, Forms and interaction and Multimedia.
Client vs. Developer Wars
Client vs. Developer Wars: Communicating the Web Development Experience is for anyone who has been, or will be, involved in developing a web site.
The Art and Science of Web Design
Free pdf book about web design. Topics covered: Technology history, Interface consistency, Site structure, Interactivity and self-aware content, Browsers, Performance, Web advertising, Database-driven content.
Software Engineering for Internet Applications
Free pdf book about web application development. Topics covered: Basics, Planning, Software Structure, User Registration and Management, Content Management, Software Modularity, Discussion, Adding Mobile Users To Your Community, Voice (VoiceXML), Scaling Gracefully, Search, Planning Redux, Distributed Computing with HTTP, XML, SOAP, and WSDL, Metadata, User Activity Analysis and Writeup.

Free C books

The New C Standard: An Economic and Cultural Commentary
The New C Standard: A Cultural and Economic Commentary can be downloaded in pdf format as a free download.
C Elements of Style
This is a free C book and it can be downloaded in pdf and html formats. The book contents are Style and Program Organization, File Basics, Comments, and Program Headings, Variable Names, Statement Formatting, Statement Details, Preprocessor, Directory Organization and Makefile Style, User-Friendly Programming and Rules.
The C Book
This is the online version of The C Book, second edition. The book contents are Introduction, Variables & arithmetic, Control flow, Functions, Arrays & pointers, Structures, Preprocessor, Specialized areas, Libraries, Complete Programs and Answers.  
Numerical Recipes in C
Numerical Recipes in C book can be accessed as individual chapters in pdf format.
Writing Bug-Free C Code
This free C book is online. Chapters are Understand Why Bugs Exist, Know Your Environment, Rock-Solid Base, The Class Methodology, A New Heap Manager, Designing Modules, General Tips, Style Guide.

Free C++ books

C++ In Action: Industrial-Strength Programming Techniques
C++ In Action: Industrial-Strength Programming Techniques is a free online C++ book by Bartosz Milewski. The contents are Introduction, Language, Techniques, Windows Techniques and Software Project. Source Code of sample projects is also available.
Thinking In C++ Second Edition Volume One: Introduction To Standard C++
This is a popular free C++ book by Bruce Eckel. It covers topics like Introduction to Objects, Making & Using Objects, Data Abstraction, Hiding the Implementation, Initialization & Cleanup, Function Overloading & Default Arguments, Operator Overloading, Dynamic Object Creation, Inheritance & Composition, Polymorphism & Virtual Functions and Introduction to Templates.
Thinking In C++ Second Edition Volume Two: Practical Programming
This is a popular free C++ book by Bruce Eckel and Chuck Allison. It covers topics like Exception handling, Strings in depth, Iostreams, Templates in depth, Runtime type identification, Multiple inheritance, Design patterns, Concurrency.
Optimizing C++
Free online book Optimizing C++ provides working programmers and those who intend to be working programmers with a practical, real-world approach to program optimization.
C++: A Dialog - Programming with C++ Standard Library
This book have free chapters - Introduction to Programming, Hardware Fundamentals, Basics of Programming, More Basics, Functional Literacy, Taking Inventory, Creating a Homegrown string class, Inheritance, Polymorphism and etc.

Free XML Books

Free XML Books

Sams Teach Yourself XML in 21 Days
Sams Teach Yourself XML in 21 Days, written by expert author Steve Holzner, offers hundreds of real-world examples demonstrating the uses of XML and the newest tools developers need to make the most of it. Read it online from sams reference library.
Essential XML Quick Reference
Essential XML Quick Reference: A Programmer's Reference to XML, XPath, XSLT, XML Schema, SOAP, and More is provided as a free download from theserverside.net.
XML Programming: Web Applications and Web Services With JSP and ASP
XML Programming: Web Applications and Web Services with JSP and ASP provides a fast-moving introduction to the XML family of technologies for programmers. It can be downloaded from Apress free book section.
Google, Amazon, and Beyond: Creating and Consuming Web Services
Based on the publicly available Google and Amazon Web Services, this book presents a variety of cross-platform examples showing how to create, provide, deploy, and consumer Web Services. It can be downloaded from Apress free book section.
XML 1.1 Bible
Access 5 sample chapters Chapter 15: XSL Transformations, Chapter 16: XSL Formatting Objects, Chapter 17: XLinks, Chapter 18: XPointers and Chapter 20: Schemas of XML 1.1 Bible.

Free Ajax books

Free Ajax EBooks and Online Books

Ajax in Action
Chapter 4 - The page as an application and Chapter 9 - Dynamic double combo are available in PDF format from Ajax in Action book.
Foundations of Ajax
Chapter 5 - Building the Ultimate Ajax Developer's Toolbox from Foundations of Ajax. It contain Documenting JavaScript Code with JSDoc, Validating HTML Content with Firefox Extensions, Searching for Nodes Using DOM Inspector and Performing JavaScript Syntax Checking with JSLint...
Ajax Patterns and Best Practices
Chapter 3 - Content Chunking Pattern of Ajax Patterns and Best Practices book. This book addresses the server side with the REST protocol. REST and Ajax blend elegantly together, but REST can also be used alone, with just a computer-to-computer solution.
Pro JSF and Ajax: Building Rich Internet Components
Chapter 4 - Using Rich Internet Technologies of Pro JSF and Ajax: Building Rich Internet Components. This book provides a blueprint for building custom JSF UI components and shows how to leverage the best browser technologies, such as AJAX, Mozilla XUL and Microsoft HTC, to deliver Rich Internet Applications.
Pragmatic Ajax : A Web 2.0 primer
Partial extracts from Google Maps Made Easy, Ajax Frameworks and Ajax UI, Part II chapters from Pragmatic Ajax : A Web 2.0 primer book.

Free Microsoft Office Books

Introduction to Microsoft Office 2003 10 Minute Guide
Get 10 Minute Guide to Microsoft Office 2003 from QUE publishing for free to quickly learn how to use Office task panes, customize your Office applications, use the Office web integration features, and migrate from your older version of Microsoft Office to the 2003 edition.
Sams Teach Yourself Microsoft Office 2003 in 24 Hours
For readers who are new to Office 11 and want to get up and running quickly, Sams Teach Yourself Microsoft Office 2003 in 24 Hours will do the trick. This book includes shortcuts and ways to accomplish the most common tasks in Office.
Microsoft Office Reference Guide
A reference guide from InformIT. It covers topics like working with Microsoft Word, accelerating your knowledge of Excel, presenting professionally with PowerPoint and posting a web site with FrontPage.  
Microsoft Office Live: Take Your Business Online
Learn how to use Microsoft Office Live and take your business online! In this tutorial, well-known author and columnist Katherine Murray gives you an insider's look at the features and capabilities of Microsoft Office Live offerings: Office Live Basics, Office Live Collaboration, and Office Live Essentials. With this practical tutorial, you ll discover how to create, manage, and track statistics for your business Web site; manage and store critical business information; and improve business processes. 30-day limited time offer!
The 20 Minute Guide to Using MS Access 2007
Free Microsoft Access 2007 book. This is a quick start guide to get you up and running with MS Access 2007. It takes you through some of the new features of the product as well as how to create a database from scratch. The 20 Minute Guide to Using MS Access 2007

More Magazines