27.10.2014 Views

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

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.

<strong>Solutions</strong> to Chapter 12 | Testing<br />

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

SOLUTION<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 <strong>and</strong> <strong>the</strong><br />

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

»»<br />

response time<br />

»»<br />

throughput<br />

»»<br />

resource utilization<br />

»»<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 thous<strong>and</strong>s of virtual users. We would write a<br />

multi-threaded program with thous<strong>and</strong>s 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 <strong>and</strong> compare<br />

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

CareerCup.com<br />

2 1 2

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

Saved successfully!

Ooh no, something went wrong!