25.03.2013 Views

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Solutions to Chapter 12 | Testing<br />

12 4 How would you load test a webpage without using any test tools?<br />

SOLUTION<br />

CareerCup com<br />

pg 70<br />

Load testing helps to identify a web application’s maximum operating capacity, as well as<br />

any bottlenecks that may interfere with its performance Similarly, it can check how an application<br />

responds to variations in load<br />

To perform load testing, we must first identify <strong>the</strong> performance-critical scenarios and <strong>the</strong><br />

metrics which fulfill our performance objectives Typical criteria include:<br />

» response time<br />

» throughput<br />

» resource utilization<br />

» maximum load that <strong>the</strong> system can bear<br />

Then, we design tests to simulate <strong>the</strong> load, taking care to measure each of <strong>the</strong>se criteria<br />

In <strong>the</strong> absence of formal testing tools, we can basically create our own For example, we<br />

could simulate concurrent users by creating thousands of virtual users We would write a<br />

multi-threaded program with thousands of threads, where each thread acts as a real-world<br />

user loading <strong>the</strong> page For each user, we would programmatically measure response time,<br />

data I/O, etc<br />

We would <strong>the</strong>n analyze <strong>the</strong> results based on <strong>the</strong> data ga<strong>the</strong>red during <strong>the</strong> tests and compare<br />

it with <strong>the</strong> accepted values<br />

2 1 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!