13.06.2015 Views

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

Introduction to the Apache Web Server - ApacheCon

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.

Make sure that everyone runs this, ponders <strong>the</strong> results, compares it <strong>to</strong> o<strong>the</strong>r students’ output, and so on.<br />

Make sure that <strong>the</strong>y look at all <strong>the</strong> fields, and know what <strong>the</strong>y mean. This may seem like a silly exercise at<br />

<strong>the</strong> time, but most of this stuff will come in useful throughout <strong>the</strong> rest of this section, and <strong>the</strong> rest of <strong>the</strong><br />

course.<br />

-k flag for KeepAlive.<br />

Can run this against o<strong>the</strong>r servers as well as your own. Try not <strong>to</strong> do this without <strong>the</strong> permission of <strong>the</strong><br />

server administra<strong>to</strong>r.<br />

Some sites will detect this as an attack, and block your address. That would be annoying.<br />

11.3 Perl<br />

use Benchmark;<br />

use LWP::Simple;<br />

time<strong>the</strong>se($count, {<br />

’Slow’ => ’$content = get("http://server/slow.cgi");’,<br />

’Fast’ => ’$content = get("http://server/fast.cgi")’,<br />

’EvenFaster’ => ’$content = get("http://server/mod perl handler")’,<br />

});<br />

• Gives comparative times for <strong>the</strong> two documents<br />

• Note that this includes network time<br />

• And, of course, this can be used <strong>to</strong> time any pieces of code that you are interested in comparing<br />

• It will be interesting <strong>to</strong> come back <strong>to</strong> this code after we have covered mod perl<br />

11.4 Optimizing hardware<br />

• More RAM<br />

• If you have <strong>to</strong> swap, all bets are off. When in doubt, buy more RAM.<br />

• Fast disk access. RAID is good.<br />

• Faster CPU<br />

• Pretty much <strong>the</strong> obvious stuff. <strong>Apache</strong> does not require any cus<strong>to</strong>m hardware.<br />

64

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

Saved successfully!

Ooh no, something went wrong!