You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by sb...@hyperreal.org on 1999/06/19 23:15:24 UTC
cvs commit: modperl-site/guide mod_perl_guide.ps.gz CHANGES advocacy.html all.html browserbugs.html config.html control.html databases.html dbm.html debug.html download.html frequent.html guide-src.tar.gz guide.tar.gz hardware.html help.html index.html install.html intro.html modules.html multiuser.html obvious.html performance.html perl.html porting.html scenario.html security.html snippets.html start.html status.html strategy.html warnings.html
sbekman 99/06/19 14:15:23
Modified: guide CHANGES advocacy.html all.html browserbugs.html
config.html control.html databases.html dbm.html
debug.html download.html frequent.html
guide-src.tar.gz guide.tar.gz hardware.html
help.html index.html install.html intro.html
modules.html multiuser.html obvious.html
performance.html perl.html porting.html
scenario.html security.html snippets.html
start.html status.html strategy.html warnings.html
Added: guide mod_perl_guide.ps.gz
Log:
* While working on presentation discovered a wonderfull 'html2ps'
utility (http://www.tdb.uu.se/~jan/html2psug.html) - so now we have
a real mod_perl book in PostScript !!! (cross references aren't
working yet)
* hardware: added a reference to eddieware
* performance.pod: extended the Apache::Resource section (Doug)
* performance.pod: Added a reference to httperf benchmark tool.
* I made many little changes all over the guide, while preparing a
subset of material for the upcoming apache/perl conference tutorial
* performance.pod: added some clarifications to "Preload Perl modules
at server startup" section - regarding CGI::compile
* advocacy.pod: A complete rewrite to communicate the ideas
differently. Now it displays a positive, motivational and
concise perspective on the same ideas. (by Randy Harmon)
* strategy.pod: modifications related to memory sharing with Apache,
mod_proxy section (Ask Bjoern Hansen)
* scenario.pod: Added the missing implementation of "Standalone
mod_perl Enabled Apache Server"+configuration, which is temporarely
located at the same chapter.
* More pods have been purified by Steve Reppucci (performance.pod).
Revision Changes Path
1.13 +32 -0 modperl-site/guide/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/CHANGES,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- CHANGES 1999/06/05 17:47:06 1.12
+++ CHANGES 1999/06/19 21:14:58 1.13
@@ -1,5 +1,37 @@
This is a CHANGES file for mod_perl guide
+06.19.99 ver 1.13
+
+* While working on presentation discovered a wonderfull 'html2ps'
+ utility (http://www.tdb.uu.se/~jan/html2psug.html) - so now we have
+ a real mod_perl book in PostScript !!! (cross references aren't
+ working yet)
+
+* hardware: added a reference to eddieware
+
+* performance.pod: extended the Apache::Resource section (Doug)
+
+* performance.pod: Added a reference to httperf benchmark tool.
+
+* I made many little changes all over the guide, while preparing a
+ subset of material for the upcoming apache/perl conference tutorial
+
+* performance.pod: added some clarifications to "Preload Perl modules
+ at server startup" section - regarding CGI::compile
+
+* advocacy.pod: A complete rewrite to communicate the ideas
+ differently. Now it displays a positive, motivational and
+ concise perspective on the same ideas. (by Randy Harmon)
+
+* strategy.pod: modifications related to memory sharing with Apache,
+ mod_proxy section (Ask Bjoern Hansen)
+
+* scenario.pod: Added the missing implementation of "Standalone
+ mod_perl Enabled Apache Server"+configuration, which is temporarely
+ located at the same chapter.
+
+* More pods have been purified by Steve Reppucci (performance.pod).
+
06.05.99 ver 1.12
* install.pod: added "Should I rebuild mod_perl if I have upgraded my
1.2 +66 -65 modperl-site/guide/advocacy.html
Index: advocacy.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/advocacy.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- advocacy.html 1999/06/05 17:47:06 1.1
+++ advocacy.html 1999/06/19 21:14:58 1.2
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl Advocacy</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -29,8 +26,8 @@
<P><B><FONT SIZE=-1>Table of Contents:</FONT></B></P>
<UL>
- <LI><A HREF="#Thoughts_about_scalability">Thoughts about scalability</A>
- <LI><A HREF="#The_boss_and_the_developer">The boss and the developer</A>
+ <LI><A HREF="#Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A>
+ <LI><A HREF="#The_boss_the_developer_and_advo">The boss, the developer and advocacy</A>
</UL>
<!-- INDEX END -->
@@ -48,66 +45,70 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<P>
-<CENTER><H1><A NAME="Thoughts_about_scalability">Thoughts about scalability</A></H1></CENTER>
+<CENTER><H1><A NAME="Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A></H1></CENTER>
<P>
-It depends on what you ought to do on the web. If all you want is a simple
-guest book or very simple DB gateway you can get away with any of
-EASY_AND_FAST_TO_DEVELOP_TOOLS (Exchange, MS IIS, Lotus Notes, etc). The
-problem is that as my experience shows, in short terms you will want more
-functionality, so you start looking for really creative ways to get this
-functionalily from these _easy_ tools, and when you make it if at all, your
-boss asks for even more functionality and then you understand that you have
-got no scalability and you have to port all your code to mod_perl or
-another powerful equivalent. Then you look back and see how much time and
-money was wasted with that EASY_AND_FAST_TO_DEVELOP_TOOLS.
-
-<P>
-The point is that if you are serious about Internet and script driven
-sites, sooner or later you will need a lot of flexibility and functionality
-from your script/code base. So you better choose a development platform
-with power of doing things your way at first place. While you might spend a
-little more time and money to learn the language and its concepts, and to
-code the basic skeleton, later code extension and modifications would be a
-snap.
+Your need for scalability and flexibility depends on your needs from the
+web. If you want only a simple guest book or Database gateway with no
+feature headroom, you can get away with any EASY_AND_FAST_TO_DEVELOP_TOOL
+(Exchange, MS IIS, Lotus Notes, etc).
+
+<P>
+Experience shows that you will soon want more functionality, that you'll
+start spending time learning the limitations of these ``easy'' tools.
+Gradually, your boss will ask for increasing functionality and at some
+point you'll realize that the tool lacks flexibility and/or scalability.
+Then your boss will either buy another EASY_AND_FAST_TO_DEVELOP_TOOL and
+repeat the process (with different unforseen problems), or you'll start
+investing time learning how to use a powerful, flexible tool to make the
+long-term development cycle easier.
+
+<P>
+If you and your company are serious about delivering flexible Internet
+functionality, do your homework. Then urge your boss to invest a little
+extra time and resources to choose the right tool for the job. Your
+long-term Internet site will prove the results.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="The_boss_and_the_developer">The boss and the developer</A></H1></CENTER>
+<CENTER><H1><A NAME="The_boss_the_developer_and_advo">The boss, the developer and advocacy</A></H1></CENTER>
<P>
-While there is a known factor of boss character in the life of developer,
-the developer should make an investigation work before he goes to ask for
-an approval to go with mod_perl. Personally, when I discovered mod_perl I
-did a lot of testing and coding at home and at work. Once I have had a
-working heavy application, I came to my boss with 2 URLs - one for the
-plain CGI server and the other for mod_perl enabled server. It took about
-30 secs for my boss to say: ``Go with it''. Of course the moment I did it,
-I have had to provide all the support for other developers, that is why I
-took my time to learn it in first place (that is how this guide was born!).
-
-<P>
-Most chances that you are doomed to failure if you are showing some very
-fast working site, and persuade your boss to give it a try but the moment
-you start to code/port the scripts your are getting stuck cause you are
-unfamiliar with mod_perl pecularities. If your boss follows your
-development process closely and sees you not making any progress, he might
-say - forget it, we fall back to old foo platform. And if this happens, you
-made the mistake twice - you are not developing under mod_perl and chances
-that your boss will give you and mod_perl a second chances are very little.
-
-<P>
-I am not here to discourage you to advocate mod_perl at your working place.
-I am here to warn you that if you want to advocate something, you cannot
-start doing this based on the naked facts. You have to learn the technology
-in subject in first place, get acquanted with the ways you can get helped
-in case of trouble. The ideal scenario would be to show your boss a heavy
-CGI which is running much faster under mod_perl, and when she gets
-impressed, ask for an evaluation time (I know that the chances you get it
-are not very high, that is why I called it ideal), argument the need for
-evaluation and studying time with an enormous time save-up in the future.
-When this time is out make sure you can provide the support for mod_perl or
-at least to be a connecting bridge between your organization and the
-mod_perl community.
-
+Each developer has a boss who participates in the decision-making process.
+Remember that the boss considers input from sales people, developers, the
+media and associates before handing down large decisions. Of course,
+results count! A sales brochure makes very little impact compared to a
+working demonstration, and demonstrations of company-specific and
+developer-specific results count big!
+
+<P>
+Personally, when I discovered mod_perl I did a lot of testing and coding at
+home and at work. Once I had a working heavy application, I came to my boss
+with 2 URLs - one for the plain CGI server and the other for mod_perl
+enabled server. It took about 30 secs for my boss to say: `Go with it''. Of
+course the moment I did it, I have had to provide all the support for other
+developers, that is why I took my time to learn it in first place (that is
+how this guide was born!).
+
+<P>
+Chances are that if you've done your homework, you've learned the tools and
+you can deliver results, you'll have a successful project. If you convince
+your boss to try a tool that you don't know very well, your results may
+suffer. If your boss follows your development process closely and sees much
+worse than expected progress, he might say ``forget it'' and wish never to
+give mod_perl a second chance.
+
+<P>
+Advocacy is a great thing for the open-source software movement, but it's
+best done quietly until you have confidence that you can show productivity.
+If you can demonstrate to your boss a heavy CGI which is running much
+faster under mod_perl, that may be a strong argument for further
+evaluation. Your company may even sponsor a portion of your learning
+process.
+
+<P>
+Learn the technology by working on sample projects. Learn how to support
+yourself and learn how to get support from the community; then advocate
+your ideas to your boss. Then you'll have the knowledge; your company will
+have the benefit; and mod_perl will have the reputation it deserves.
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
The <a href="http://www.modperl.com/">
<B>Writing Apache Modules with Perl and C</B></a>
@@ -131,7 +132,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.14 +1107 -832 modperl-site/guide/all.html
Index: all.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/all.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- all.html 1999/06/05 17:47:07 1.13
+++ all.html 1999/06/19 21:14:59 1.14
@@ -30,8 +30,8 @@
<CENTER><P><B>Deploying mod_perl technology to give a rocket speed
to your CGI/perl scripts.</B></P></CENTER>
-<CENTER><P><B>Version 1.12
- Jun, 5 1999</B></P></CENTER>
+<CENTER><P><B>Version 1.13
+ Jun, 19 1999</B></P></CENTER>
<P>
<HR WIDTH="100%"></P>
@@ -73,6 +73,14 @@
<UL>
<LI><A HREF="scenario.html#Before_you_dive_into_the_gory_de">Before you dive into the gory details</A>
+ <LI><A HREF="scenario.html#Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A>
+ <UL>
+
+ <LI><A HREF="scenario.html#Installation_in_10_lines">Installation in 10 lines</A>
+ <LI><A HREF="scenario.html#Installation_in_10_paragraphs">Installation in 10 paragraphs</A>
+ <LI><A HREF="scenario.html#Configuration_Process">Configuration Process</A>
+ </UL>
+
<LI><A HREF="scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
<UL>
@@ -211,19 +219,15 @@
<LI><A HREF="porting.html#Turning_warnings_ON">Turning warnings ON</A>
<LI><A HREF="porting.html#diagnostics_pragma">diagnostics pragma</A>
<LI><A HREF="porting.html#Global_Variables">Global Variables</A>
+ <LI><A HREF="porting.html#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="porting.html#Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A>
<LI><A HREF="porting.html#Memory_leakage">Memory leakage</A>
</UL>
- <LI><A HREF="porting.html#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="porting.html#Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A>
- <UL>
-
- <LI><A HREF="porting.html#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
- <LI><A HREF="porting.html#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
- <LI><A HREF="porting.html#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
- </UL>
-
+ <LI><A HREF="porting.html#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
+ <LI><A HREF="porting.html#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
+ <LI><A HREF="porting.html#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
<LI><A HREF="porting.html#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="porting.html#Finding_the_line_number_the_erro">Finding the line number the error/warning has been triggered at</A>
<LI><A HREF="porting.html#Forking_subprocesses_from_mod_pe">Forking subprocesses from mod_perl</A>
@@ -238,12 +242,10 @@
<LI><A HREF="performance.html#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A>
</UL>
- <LI><A HREF="performance.html#Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A>
- <LI><A HREF="performance.html#Memory_sharing">Memory sharing</A>
<LI><A HREF="performance.html#Preload_Registry_Scripts">Preload Registry Scripts</A>
+ <LI><A HREF="performance.html#Sharing_Memory">Sharing Memory</A>
<LI><A HREF="performance.html#Avoid_Importing_Functions">Avoid Importing Functions</A>
- <LI><A HREF="performance.html#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
- <LI><A HREF="performance.html#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
+ <LI><A HREF="performance.html#How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="performance.html#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="performance.html#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -267,8 +269,10 @@
<LI><A HREF="performance.html#Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A>
</UL>
+ <LI><A HREF="performance.html#Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A>
<LI><A HREF="performance.html#Persistent_DB_Connections">Persistent DB Connections</A>
<LI><A HREF="performance.html#Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A>
+ <LI><A HREF="performance.html#More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A>
<LI><A HREF="performance.html#Profiling">Profiling</A>
<LI><A HREF="performance.html#CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A>
<LI><A HREF="performance.html#Sending_plain_HTML_as_a_compress">Sending plain HTML as a compressed output</A>
@@ -337,7 +341,7 @@
<LI><A HREF="control.html#Starting_a_personal_server_for_e">Starting a personal server for each developer</A>
<LI><A HREF="control.html#Wrapper_to_emulate_the_server_en">Wrapper to emulate the server environment</A>
<LI><A HREF="control.html#Log_Rotation">Log Rotation</A>
- <LI><A HREF="control.html#Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A>
+ <LI><A HREF="control.html#Preventing_from_modperl_process_">Preventing from modperl process from going wild</A>
</UL>
<P><LI><A HREF="security.html"><B><FONT SIZE=+1>Protecting Your Site</FONT></B></A></LI><P>
<UL>
@@ -493,8 +497,8 @@
<P><LI><A HREF="advocacy.html"><B><FONT SIZE=+1>mod_perl Advocacy</FONT></B></A></LI><P>
<UL>
- <LI><A HREF="advocacy.html#Thoughts_about_scalability">Thoughts about scalability</A>
- <LI><A HREF="advocacy.html#The_boss_and_the_developer">The boss and the developer</A>
+ <LI><A HREF="advocacy.html#Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A>
+ <LI><A HREF="advocacy.html#The_boss_the_developer_and_advo">The boss, the developer and advocacy</A>
</UL>
<P><LI><A HREF="help.html"><B><FONT SIZE=+1>Getting Helped and Further Learning</FONT></B></A></LI><P>
<UL>
@@ -518,6 +522,9 @@
<LI><A HREF="download.html#Squid_Internet_Object_Cache">Squid - Internet Object Cache</A>
<LI><A HREF="download.html#thttpd_tiny_turbo_throttling_H">thttpd - tiny/turbo/throttling HTTP server</A>
<LI><A HREF="download.html#mod_proxy_add_forward">mod_proxy_add_forward</A>
+ <LI><A HREF="download.html#httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A>
+ <LI><A HREF="download.html#ab_ApacheBench">ab - ApacheBench</A>
+ <LI><A HREF="download.html#Eddieware">Eddieware</A>
</UL>
<P>
@@ -533,9 +540,13 @@
<LI><A HREF="#search"><B>Search perl.apache.org along with this guide</B></A></LI>
-<LI><B>Download all files <A HREF="guide.tar.gz">guide.tar.gz</A>
-or sources and build scripts
-<A HREF="guide-src.tar.gz">guide-src.tar.gz</A></B></LI>
+<LI><B>Download</B>
+ <UL>
+ <LI> All HTML files (<A HREF="guide.tar.gz">guide.tar.gz</A>)
+ <LI> Postscript Book (<A HREF="mod_perl_guide.ps.gz">mod_perl_guide.ps.gz</A>)
+ <LI> POD sources and build scripts (<A HREF="guide-src.tar.gz">guide-src.tar.gz</A>)
+ </UL>
+</LI>
</UL>
@@ -576,7 +587,7 @@
<TR ALIGN=CENTER VALIGN=TOP>
<TD ALIGN=CENTER VALIGN=CENTER><B><FONT SIZE=-1>Written by <A
-HREF="help.html#This_document_s_Author">Stas Bekman</A>.<BR> Last Modified at 06/05/1999
+HREF="help.html#This_document_s_Author">Stas Bekman</A>.<BR> Last Modified at 06/19/1999
</FONT></B></TD>
<TD><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl2.jpg" BORDER=0 ALT="Mod Perl Icon" BORDER=0 HEIGHT=59 WIDTH=150></A>
@@ -598,13 +609,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Introduction. Incentives. Credits.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -858,7 +866,7 @@
<P><LI><STRONG><A NAME="item_Tzvetan">Tzvetan Stoyanov</A></STRONG>
<P><LI><STRONG><A NAME="item_Ulrich">Ulrich Pfeifer</A></STRONG>
<P><LI>
-<P><LI><STRONG><A NAME="item_Did">Did I miss you? Tell me!</A></STRONG>
+<P><LI><STRONG><A NAME="item_Did">Did I miss your name? Tell me!</A></STRONG>
</UL>
<P>
I want to thank all the people who donated their time and efforts to make
@@ -890,7 +898,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -918,13 +926,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Guide's Overview</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -1136,13 +1141,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Choosing the Right Strategy</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -1191,7 +1193,8 @@
<CENTER><H1><A NAME="Do_it_like_me_">Do it like me?!</A></H1></CENTER>
<P>
There is no such a thing as a single <STRONG>RIGHT</STRONG> strategy in web server business, though there are many wrong ones. Never
-believe a person who says: <EM>"Do it this way, this is the best!"</EM>. As the old saying goes: <EM>"Trust but verify"</EM>. There are too many technologies out there to choose from, and it would
+believe a person who says: <EM>"Do it this way, this is the best!"</EM>. As the old saying goes:
+<EM>"Trust but verify"</EM>. There are too many technologies out there to choose from, and it would
take an enormous investment of time and money to try to validate each one
before deciding which is the best choice for your situation. Keeping this
idea in mind, I will present some different combinations of mod_perl and
@@ -1245,12 +1248,15 @@
more state-of-the-art-yet-suspiciously-new DSO system, or to the forth
option which gives you even more power.
+<OL>
+<P><LI>
<P>
The first option will kill your production site if you serve a lot of
static data with ~2-12 MB webserver processes. On the other hand, while
testing you will have no other server interaction to mask or add to your
errors.
+<P><LI>
<P>
The second option allows you to seriously tune the two servers for maximum
performance. On the other hand you have to deal with proxying or fancy site
@@ -1258,6 +1264,7 @@
need to choose between running the two servers on multiple ports, multiple
IPs, etc... This adds the burden of administrating more than one server.
+<P><LI>
<P>
The third option (DSO) -- as mentioned above -- means playing with the
bleeding edge. In addition <CODE>mod_so</CODE> (the DSO module) adds size and complexity to your binaries. With DSO,
@@ -1265,16 +1272,16 @@
modules are even shared among multiple servers. Again, it is bleeding edge
and still somewhat platform specific, but your milegue may vary. See <A HREF="././scenario.html#mod_perl_server_as_DSO">mod_perl server as DSO</A>.
+<P><LI>
<P>
The fourth option (proxy in http accelerator mode), once correctly
configured and tuned, improves performance by caching and buffering page
results.
+</OL>
<P>
The rest of this chapter discusses the pros and the cons of each of these
-presented configurations.
-<A HREF="././scenario.html#">Real World Scenarios Implementaion</A>
-describes the implementation techniques of these schemas.
+presented configurations. <A HREF="././scenario.html#">Real World Scenarios Implementaion</A> describes the implementation techniques of these schemas.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -1361,12 +1368,11 @@
started.
<P>
-And of course, if your site is serving only mod_perl scripts, this might be
-the perfect choice for you!
+And of course, if your site is serving only mod_perl scripts (close to zero
+static objects, like images), this might be the perfect choice for you!
<P>
-For implementation notes see :
-<A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+For implementation notes see : <A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
@@ -1463,9 +1469,12 @@
</UL>
<P>
-For implementation notes see :
-<A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+Before you go on with this solution you really want to look at the
+<A HREF="././strategy.html#Adding_a_Proxy_Server_in_http_Ac">Adding a Proxy Server in http Accelerator Mode</A> section.
+<P>
+For implementation notes see : <A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+
<P>
@@ -1496,6 +1505,13 @@
uses only 260k - 100 times less! You could use the saved 30M to run more
mod_perl servers.
+<P>
+Note that this is not true if your OS supports memory sharing and you
+configured apache to use it (it is a DSO approach. There is no memory
+sharing if apache modules are being statically compiled into httpd). If you
+do allow memory sharing -- 30 light apache servers ought to use about 3-4Mb
+only, because most of it will be shared. Than the save-ups with <STRONG>thttpd</STRONG> are much smaller.
+
<P><LI>
<P>
Reported to be about 5 times faster then plain apache serving static
@@ -1509,7 +1525,7 @@
<P><LI>
<P>
Lacks some of apache's features, like access control, error redirection,
-customizable logfile formats, and so on.
+customizable logfile formats, and so on.
</UL>
<P>
@@ -1538,7 +1554,7 @@
<P><LI>
<P>
Allow serving of static objects from the proxy's cache (objects that
-previously were entirely served by the httpd_docs server).
+previously were entirely served by the httpd_docs server).
<P><LI>
<P>
@@ -1598,6 +1614,11 @@
allows for only your public ``bastion'' accelerating www server to get
hosed in a successful attack, while leaving your internal data safe.
+<P><LI>
+<P>
+You can have the <CODE>mod_proxy</CODE> process serve your static documents from disk to ``kill two birds with one
+stone''.
+
</UL>
<P>
The disadvantages are:
@@ -1809,7 +1830,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -1837,13 +1858,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Real World Scenarios Implementaion</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -1865,6 +1883,14 @@
<UL>
<LI><A HREF="#Before_you_dive_into_the_gory_de">Before you dive into the gory details</A>
+ <LI><A HREF="#Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A>
+ <UL>
+
+ <LI><A HREF="#Installation_in_10_lines">Installation in 10 lines</A>
+ <LI><A HREF="#Installation_in_10_paragraphs">Installation in 10 paragraphs</A>
+ <LI><A HREF="#Configuration_Process">Configuration Process</A>
+ </UL>
+
<LI><A HREF="#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
<UL>
@@ -1927,6 +1953,223 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A></H1></CENTER>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Installation_in_10_lines">Installation in 10 lines</A></H2></CENTER>
+<P>
+The Installation is very very simple (example from Linux OS):
+
+<P>
+<PRE> % cd /usr/src
+ % lwp-download <A HREF="http://www.apache.org/dist/apache_x.x.x.tar.gz">http://www.apache.org/dist/apache_x.x.x.tar.gz</A>
+ % lwp-download <A HREF="http://perl.apache.org/dist/mod_perl-x.xx.tar.gz">http://perl.apache.org/dist/mod_perl-x.xx.tar.gz</A>
+ % tar zvxf apache_x.xx.tar.gz
+ % tar zvxf mod_perl-x.xx.tar.gz
+ % cd mod_perl-x.xx
+ % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \
+ USE_APACI=1 DO_HTTPD=1 PERL_MARK_WHERE=1 ALL_HOOKS=1
+ % make && make test && make install
+ % cd ../apache_x.x.x/src
+ % make install
+</PRE>
+<P>
+That's all!
+
+<P>
+Notes: Replace x.x.x with the real version numbers of mod_perl and apache.
+gnu tar uncompresses as well (with z flag).
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Installation_in_10_paragraphs">Installation in 10 paragraphs</A></H2></CENTER>
+<P>
+First download the sources of both packages, e.g. you can use
+<CODE>lwp-download</CODE> utility to do it. <CODE>lwp-download</CODE> is a part of the LWP (or libwww) package, you will need to have it
+installed in order for mod_perl's <CODE>make test</CODE> to pass. Once you install this package unless it's already installed, <CODE>lwp-download</CODE> will be available for you as well.
+
+<P>
+<PRE> % lwp-download <A HREF="http://www.apache.org/dist/apache_x.x.x.tar.gz">http://www.apache.org/dist/apache_x.x.x.tar.gz</A>
+ % lwp-download <A HREF="http://perl.apache.org/dist/mod_perl-x.xx.tar.gz">http://perl.apache.org/dist/mod_perl-x.xx.tar.gz</A>
+</PRE>
+<P>
+Extract both sources. Generally I open all the sources in
+<CODE>/usr/src/</CODE>, your mileage may vary. So move the sources and cd to the directory you
+want to put the sources in. Gnu <CODE>tar</CODE> utility knows to uncompress too with z flag, if you have a non-gnu <CODE>tar</CODE> utility, it will be incapable to decompress, so you would do it in 2 steps,
+first uncompressing the packages with <CODE>gzip -d apache_x.xx.tar.gz</CODE> and
+<CODE>gzip -d mod_perl-x.xx.tar.gz</CODE>. And untarring them with <CODE>tar xvf
+apache_x.xx.tar</CODE> and <CODE>tar xvf mod_perl-x.xx.tar</CODE>.
+
+<P>
+<PRE> % cd /usr/src
+ % tar zvxf apache_x.xx.tar.gz
+ % tar zvxf mod_perl-x.xx.tar.gz
+</PRE>
+<P>
+Change to the mod_perl source directory.
+
+<P>
+<PRE> % cd mod_perl-x.xx
+</PRE>
+<P>
+Now build the make file, for a basic work and first time installation the
+parameters in the example below are the only ones you would need. <CODE>APACHE_SRC</CODE> tells where the apache <src> directory is. If you have followed my
+advice and extracted the sources under the same directory (e.g.
+</usr/src>), the following is correct.
+
+<P>
+<PRE> % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \
+ USE_APACI=1 DO_HTTPD=1 PERL_MARK_WHERE=1 ALL_HOOKS=1
+</PRE>
+<P>
+There are many additional parameters. You can find some of them in the
+configuration dedicated chapter and other sections where any of them
+becomes relevant. While running <CODE>perl Makefile.PL ...</CODE> the process will check for prerequisites and tell you if something is
+missing, If you are missing some of the perl packages or other software you
+will have to install these before you proceed.
+
+<P>
+Now we <STRONG>make</STRONG> the project (by building the mod_perl extension and calling <CODE>make</CODE> in apache source directory to build a <CODE>httpd</CODE>),
+<STRONG>make test</STRONG> it (by running various tests) and install the mod_perl modules.
+
+<P>
+<PRE> % make && make test && make install
+</PRE>
+<P>
+Note that if <CODE>make</CODE> fails, non of the <CODE>make test</CODE> and <CODE>make
+install</CODE> will be not executed. If <CODE>make test</CODE> fails, <CODE>make install</CODE>
+will be not executed.
+
+<P>
+Now change to apache source directory and run <CODE>make install</CODE> to install apache's headers, default configuration files, build apache
+directory tree and put the <CODE>httpd</CODE> there.
+
+<P>
+<PRE> % cd ../apache_x.x.x/src
+ % make install
+</PRE>
+<P>
+When you execute the above command, apache installation process will tell
+you how can you start the webserver (the path of the <apachectl>,
+more about it later) and where the configuration files are. Remember (or
+even better write down) both for you will need this information very soon.
+On my machine they 2 important paths are:
+
+<P>
+<PRE> /usr/local/apache/bin/apachectl
+ /usr/local/apache/conf/httpd.conf
+</PRE>
+<P>
+Now the build and the installation processes are completed. Just configure <CODE>httpd.conf</CODE> and start the webserver.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Configuration_Process">Configuration Process</A></H2></CENTER>
+<P>
+A basic configuration is a simple one. First configure the apache as you
+always do (like setting a correct <CODE>Port</CODE>, <CODE>User</CODE>, <CODE>Group</CODE>, log-file and other file paths and etc), start the server and make sure it
+works. One of the ways to start and stop the server is to use
+<CODE>apachectl</CODE> utility:
+
+<P>
+<PRE> /usr/local/apache/bin/apachectl start
+ /usr/local/apache/bin/apachectl stop
+</PRE>
+<P>
+Put the server down, open the <CODE>httpd.conf</CODE> in your favorite editor and scroll to the end of the file, where we will
+add the mod_perl configuration directives (of course you can place them
+anywhere in the file).
+
+<P>
+Add the following configuration directives:
+
+<P>
+<PRE> Alias /perl/ /home/httpd/perl/
+</PRE>
+<P>
+Assuming that you put all your scripts that should be executed under
+mod_perl into <CODE>/home/httpd/perl/</CODE> directory.
+
+<P>
+<PRE> PerlModule Apache::Registry
+ <Location /perl>
+ SetHandler perl-script
+ PerlHandler Apache::Registry
+ Options ExecCGI
+ PerlSendHeader On
+ allow from all
+ </Location>
+</PRE>
+<P>
+Now put a test script into <CODE>/home/httpd/perl/</CODE> directory:
+
+<P>
+<PRE> test.pl
+ -------
+ #!/usr/bin/perl -w
+ use strict;
+ print "Content-type: text/html\r\n\r\n";
+ print "It worked!!!\n";
+ -------
+</PRE>
+<P>
+Make it executable and readable by server, if your server is running as
+user <CODE>nobody</CODE> (hint see <CODE>User</CODE> directive in <CODE>httpd.conf</CODE> file), do the following:
+
+<P>
+<PRE> chown nobody /home/httpd/perl/test.pl
+ chmod u+rx /home/httpd/perl/test.pl
+</PRE>
+<P>
+Test that the script is running from the command line, by executing it:
+
+<P>
+<PRE> /home/httpd/perl/test.pl
+</PRE>
+<P>
+You should see:
+
+<P>
+<PRE> Content-type: text/html
+
+ It worked!!!
+</PRE>
+<P>
+Now it is a time to test our mod_perl server, assuming that your config
+file includes <CODE>Port 80</CODE>, go to your favorite Netscape browser and fetch the following URL:
+
+<P>
+<PRE> <A HREF="http://localhost/perl/test.pl">http://localhost/perl/test.pl</A>
+</PRE>
+<P>
+(Assuming that you have a loop-back device configured, if not use the real
+server name for this test (e.g. <CODE>http://www.nowhere.com/perl/test.pl</CODE>)
+
+<P>
+You should see:
+
+<P>
+<PRE> It worked!!!
+</PRE>
+<P>
+If something went wrong, go through the installation process again, and
+make sure you didn't make a mistake. If that doesn't help, read the <CODE>INSTALL</CODE> pod document (<CODE>perlpod INSTALL</CODE>) in the mod_perl distribution directory.
+
+<P>
+Now migrate your CGI scripts into a <CODE>/home/httpd/perl/</CODE> directory and see them working much much faster, from the newly configured
+base URL (<CODE>/perl/</CODE>). Not all of your scripts will work unchanges, but many will.
+
+<P>
+The above setup is very basic, it will help you to have a mod_perl enabled
+server running.
+
+<P>
+As with <STRONG>perl</STRONG> you can start benefit from <STRONG>mod_perl</STRONG> from the very first moment you try it. When you become more familiar with
+mod_perl you will want to start writing apache handlers and deploy more of
+the mod_perl power.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A></H1></CENTER>
<P>
Since we run two apache servers we will need two different configuration
@@ -2783,7 +3026,9 @@
</PRE>
<P>
<CODE>PPR</CODE> is the saving grace here, that makes Apache a win over Squid. That cleans
-up redirects and stuff to remove the :81 from the URIs. Very nice.
+up redirects and stuff to remove the :81 from the URIs. Very nice. If you
+want to use mod_proxy to proxy pass more than one port, you probably want
+to take a look at mod_rewrite.
<P>
You can control the buffering feature with <CODE>ProxyReceiveBufferSize</CODE>
@@ -2825,39 +3070,22 @@
. Basically, that module adds an extra HTTP header to proxying requests.
You can access that header in the mod_perl-enabled server, and set the IP
of the remote server. You won't need to compile anything into the back-end
-server, just put something like the following into your mod_perl handler:
-
-<P>
-<PRE> my $real_client;
- if (defined($real_client = $::r->header_in('X-Forwarded-For'))) {
- $::r->connection->remote_ip($real_client);
- }
-</PRE>
-<P>
-See how it works? From that point on, the remote IP address is correct.You
-should be able to access REMOTE_ADDR as usual.
-
-<P>
-If you are using <CODE>Apache::{Registry,PerlRun}</CODE> - do it like this:
-
-<P>
-in startup.pl:
+server, if you are using <CODE>Apache::{Registry,PerlRun}</CODE> just put something like the following into <CODE>start-up.pl</CODE>:
<P>
-<PRE> sub My::ProxyRemoteAddr ($) {
- my $r = shift;
-
+<PRE> sub My::ProxyRemoteAddr ($) {
+ my $r = shift;
+
# we'll only look at the X-Forwarded-For header if the requests
# comes from our proxy at localhost
return OK unless ($r->connection->remote_ip eq "127.0.0.1");
-
- my @ip = split(/,\s*/, $r->header_in('X-Forwarded-For'));
- if (my $ip = pop(@ip)) {
- $r->connection->remote_ip($ip);
+
+ if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
+ $r->connection->remote_ip($ip);
}
return OK;
- }
+ }
</PRE>
<P>
And in <CODE>httpd.conf</CODE>:
@@ -2866,6 +3094,19 @@
<PRE> PerlPostReadRequestHandler My::ProxyRemoteAddr
</PRE>
<P>
+Different sites have different needs. If you're using the header to set the
+ip address Apache believes it is dealing with (in the logging and stuff)
+you really don't want anyone but your own system to set the header.
+
+<P>
+That's why the above ``recommanded code'' includes a check for where the
+request really is coming from before we change remote_ip.
+
+<P>
+From that point on, the remote IP address is correct. You should be able to
+access <CODE>REMOTE_ADDR</CODE> as usual.
+
+<P>
You could do the same thing with other environment variables (though I
think several of them are preserved, you will want to run some tests to see
which ones).
@@ -2940,7 +3181,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -2968,13 +3209,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Installation Notes</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -3133,14 +3371,19 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Testing_by_checking_the_error_lo">Testing by checking the error_log file</A></H2></CENTER>
<P>
-<PRE> [Thu Dec 3 17:27:52 1998] [notice] Apache/1.3.1 (Unix) mod_perl/1.15 configured -- resuming normal operations
+When starting the server, just check the <CODE>error_log</CODE> file for this:
+
+<P>
+<PRE> [Thu Dec 3 17:27:52 1998] [notice] Apache/1.3.1 (Unix) mod_perl/1.15 configured
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ -- resuming normal operations
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Testing_by_viewing_perl_status">Testing by viewing /perl-status</A></H2></CENTER>
<P>
-Assuming that you have configured the <CODE><Location /perl-status</CODE>> Section in the server configuration file (refer to
+Assuming that you have configured the <<CODE>Location /perl-status</CODE>>
+Section in the server configuration file (refer to
<A HREF="././config.html#">ModPerlConfiguration</A>), fetch: <A
HREF="http://www.yourserver.com/perl-status">http://www.yourserver.com/perl-status</A>
using your favorite Netscape browser :-)
@@ -3185,8 +3428,8 @@
<P>
However, just because you have got mod_perl linked in there, that does not
-meant that you have your server configured to use mod_perl to handle Perl
-scripts. You will find the configuration assistance at
+mean that you have configured your server to handle Perl scripts with
+mod_perl. You will find the configuration assistance at
<A HREF="././config.html#">ModPerlConfiguration</A>
@@ -3464,7 +3707,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/12/1999
</FONT>
</B>
</TD>
@@ -3492,13 +3735,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Server Configuration</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -4421,13 +4661,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Frequent mod_perl problems</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -4542,13 +4779,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: CGI to mod_perl Porting. mod_perl Coding guidelines.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -4596,19 +4830,15 @@
<LI><A HREF="#Turning_warnings_ON">Turning warnings ON</A>
<LI><A HREF="#diagnostics_pragma">diagnostics pragma</A>
<LI><A HREF="#Global_Variables">Global Variables</A>
+ <LI><A HREF="#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="#Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A>
<LI><A HREF="#Memory_leakage">Memory leakage</A>
</UL>
- <LI><A HREF="#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="#Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A>
- <UL>
-
- <LI><A HREF="#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
- <LI><A HREF="#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
- <LI><A HREF="#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
- </UL>
-
+ <LI><A HREF="#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
+ <LI><A HREF="#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
+ <LI><A HREF="#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
<LI><A HREF="#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="#Finding_the_line_number_the_erro">Finding the line number the error/warning has been triggered at</A>
<LI><A HREF="#Forking_subprocesses_from_mod_pe">Forking subprocesses from mod_perl</A>
@@ -5272,6 +5502,16 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A></H2></CENTER>
+<P>
+To pass an environment variable from a configuration file, add to it:
+
+<P>
+<PRE> PerlSetEnv key val
+ PerlPassEnv key
+</PRE>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A></H2></CENTER>
<P>
Files pulled in via <STRONG>use</STRONG> or <STRONG>require</STRONG> statements are not automatically reloaded when changed on disk. See <A HREF="././obvious.html#Reloading_Modules_and_Required_F">Reloading Modules and Required Files</A> for more info.
@@ -5550,16 +5790,6 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A></H1></CENTER>
-<P>
-To pass an environment variable from a configuration file, add to it:
-
-<P>
-<PRE> PerlSetEnv key val
- PerlPassEnv key
-</PRE>
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A></H1></CENTER>
<P>
At the beginning there was:
@@ -5602,7 +5832,7 @@
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A></H2></CENTER>
+<CENTER><H1><A NAME="Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A></H1></CENTER>
<P>
When you start running your scripts under mod_perl, you might find yourself
in situation where a script seems to work, but sometimes it screws up. And
@@ -5614,7 +5844,7 @@
<P>
Generally the problem you have is using global variables. Since global
variables don't change from one script invocation to another unless you
-change it, you can find your scripts do ``fancy'' things.
+change them, you can find your scripts do ``fancy'' things.
<P>
The first example is amazing -- Web Services. Imagine that you enter some
@@ -5686,7 +5916,7 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A></H2></CENTER>
+<CENTER><H1><A NAME="The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A></H1></CENTER>
<P>
You still can win from using mod_perl.
@@ -5726,7 +5956,7 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A></H2></CENTER>
+<CENTER><H1><A NAME="Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A></H1></CENTER>
<P>
Apache::PerlRun gives you a benefit of preloaded perl and its modules. This
module's handler emulates the CGI environment, allowing programmers to
@@ -6098,7 +6328,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/12/1999
</FONT>
</B>
</TD>
@@ -6126,13 +6356,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Performance. Benchmarks.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -6159,12 +6386,10 @@
<LI><A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A>
</UL>
- <LI><A HREF="#Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A>
- <LI><A HREF="#Memory_sharing">Memory sharing</A>
<LI><A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>
+ <LI><A HREF="#Sharing_Memory">Sharing Memory</A>
<LI><A HREF="#Avoid_Importing_Functions">Avoid Importing Functions</A>
- <LI><A HREF="#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
- <LI><A HREF="#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
+ <LI><A HREF="#How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -6188,8 +6413,10 @@
<LI><A HREF="#Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A>
</UL>
+ <LI><A HREF="#Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A>
<LI><A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>
<LI><A HREF="#Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A>
+ <LI><A HREF="#More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A>
<LI><A HREF="#Profiling">Profiling</A>
<LI><A HREF="#CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A>
<LI><A HREF="#Sending_plain_HTML_as_a_compress">Sending plain HTML as a compressed output</A>
@@ -6212,20 +6439,35 @@
<P>
<CENTER><H1><A NAME="Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A></H1></CENTER>
<P>
-Use the PerlRequire and PerlModule directives to load commonly used modules
-such as CGI.pm, DBI, etc., when the server is started. On most systems,
-server children will be able to share this space.
+Use the <CODE>PerlRequire</CODE> and <CODE>PerlModule</CODE> directives to load commonly used modules such as <CODE>CGI.pm</CODE>, <CODE>DBI</CODE> and etc., when the server is started. On most systems, server children will
+be able to share the code space used by these modules. Just add the
+following directives into <CODE>httpd.conf</CODE>:
<P>
-You can also put the standard <CODE>use Foo;</CODE> into the startup-file.
+<PRE> PerlModule CGI;
+ PerlModule DBI;
+</PRE>
+<P>
+But even better to create a separate startup file (with regular perl code)
+and put there things like:
+
+<P>
+<PRE> use DBI;
+ use Carp;
+</PRE>
+<P>
+Then you <CODE>require()</CODE> this file with help of <CODE>PerlRequire</CODE> directive from <CODE>httpd.conf</CODE>, before the rest of the mod_perl configuration directives:
<P>
-CGI.pm is a special one. Ordinarily CGI.pm autoloads most of its functions
-on an as-needed basis. This speeds up the loading time by deferring the
-compilation phase. However, if you are using mod_perl, FastCGI or another
-system that uses a persistent Perl interpreter, you will want to precompile
-the methods at initialization time. To accomplish this, call the package
-function <CODE>compile()</CODE> like this:
+<PRE> PerlRequire /path/to/start-up.pl
+</PRE>
+<P>
+<CODE>CGI.pm</CODE> is a special case. Ordinarily <CODE>CGI.pm</CODE> autoloads most of its functions on an as-needed basis. This speeds up the
+loading time by deferring the compilation phase. However, if you are using
+mod_perl, FastCGI or another system that uses a persistent Perl
+interpreter, you will want to precompile the methods at initialization
+time. To accomplish this, call the package function <CODE>compile()</CODE>
+like this:
<P>
<PRE> use CGI ();
@@ -6233,7 +6475,7 @@
</PRE>
<P>
The arguments to <CODE>compile()</CODE> are a list of method names or sets, and are identical to those accepted by
-the use operator.
+the use operator. Note that in most cases you will want to replace <CODE>':all'</CODE> with the tags' names you really use in your code.
<P>
You can also preload the Registry scripts. See <A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>.
@@ -6243,37 +6485,17 @@
<CENTER><H2><A NAME="Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A></H2></CENTER>
<P>
I have conducted a few tests to benchmark the memory usage when some
-modules are preloaded. First set of tests checks the memory use with
-Library Perl Module preload (only CGI.pm). The second set checks the
-compile method of CGI.pm. The third test checks benefit the the Library
-Perl Module preload but a few of them (too see more memory saved) and also
-the effect of precompiling the Registry modules with
-Apache::RegistryLoader.
-
-<P>
-Summary:
-
-<P>
-1. Library Perl Modules Preloading gave a good results everywhere.
+modules are preloaded. The first set of tests checks the memory use with
+Library Perl Module preload (only <CODE>CGI.pm</CODE>). The second set checks the compile method of <CODE>CGI.pm</CODE>. The third test checks the benefit of Library Perl Module preload but a
+few of them (to see more memory saved) and also the effect of precompiling
+the Registry modules with <CODE>Apache::RegistryLoader</CODE>.
<P>
-2. compile method of CGI seems to make things worse (may be the speed is
-better?)
-
-<P>
-3. Apache::RegistryLoader might made the script load faster on the first
-request after the child has just started but the memory usage was worse!!!
-See the numbers by yourself.
-
-<P>
-HW/SW: The server is apache 1.3.2, mod_perl 1.16 running on AIX 4.1.5
-
-<P>
--------------------------------------------------------------------------------
<P>
-1. In the first test was used a script:
+1. In the first test, the following script was used:
<P>
<PRE> use strict;
@@ -6286,7 +6508,7 @@
<Server restarted>
<P>
-Before the CGI.pm preload: (No other modules preloaded)
+Before the <CODE>CGI.pm</CODE> preload: (No other modules preloaded)
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6308,7 +6530,7 @@
<Server restarted>
<P>
-After the CGI.pm preload:
+After the <CODE>CGI.pm</CODE> preload:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6331,7 +6553,7 @@
<Server restarted>
<P>
-After CGI.pm preloaded and compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> preloaded and compiled with CGI->compile(':all');
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6348,8 +6570,10 @@
</PRE>
<P>
Observation: child httpd has grown up by 1172K No change! So what does
-CGI->compile(':all') helps? I guess it helps if you import the symbols
-(subs) rather you use the methods
+CGI->compile(':all') help? I think it's because we never use all of the
+methods CGI provides - so in real use it's faster. So you might want to
+compile only the tags you are about to use - then you will benefit for
+sure.
<P>
--------------------------------------------------------------------------------
@@ -6359,14 +6583,15 @@
2. I have tried the second test to find it. I run the script:
<P>
-use strict; use CGI <CODE>qw(:all);</CODE> print
-header,start_html,p(``Hello'');
-
+<PRE> use strict;
+ use CGI qw(:all);
+ print header,start_html,p("Hello");
+</PRE>
<P>
<Server restarted>
<P>
-After CGI.pm preloaded and NOT compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> was preloaded and NOT compiled with CGI->compile(':all'):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6374,7 +6599,7 @@
httpd 86904 0.0 0.0 1688 1800 - A 18:02:49 0:00 httpd
</PRE>
<P>
-After running a script which imports symbols, all of them
+After running a script which imports symbols (all of them):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6388,7 +6613,7 @@
<Server restarted>
<P>
-After CGI.pm preloaded and compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> was preloaded and compiled with CGI->compile(':all'):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6396,7 +6621,7 @@
httpd 99104 0.0 0.0 3064 1768 - A 17:59:52 0:00 httpd
</PRE>
<P>
-After running a script which imports symbols, all of them
+After running a script which imports symbols (all of them):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6404,29 +6629,32 @@
httpd 99104 0.0 1.0 4884 3636 - A 17:59:52 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 1868K. Why? Isn't
-CGI->compile(':all') supposed to make children to share the compiled
-code with parent?
+Observation: child httpd has grown by 1868K. Why? Isn't
+<CODE>CGI::compile(':all')</CODE> supposed to make children to share the compiled code with parent? It does
+works as advertised, but if you pay attention in the code we have called
+only three <CODE>CGI.pm</CODE>'s methods - just saying <CODE>use CGI qw(:all)</CODE> doesn't mean we compile the all available methods - we just import their
+names. So actually this test is misleading. Execute <CODE>compile()</CODE> only on the methods you are actually using and then you will see the
+difference.
<P>
--------------------------------------------------------------------------------
<P>
-3. The third script
+3. The third script:
<P>
<PRE> use strict;
use CGI;
use Data::Dumper;
- use Storable;
+ use Storable;
[and many lines of code, lots of globals - so the code is huge!]
</PRE>
<P>
<Server restarted>
<P>
-Nothing preloaded at startup
+Nothing preloaded at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6434,7 +6662,7 @@
httpd 86870 0.0 0.0 1304 1784 - A 17:16:45 0:00 httpd
</PRE>
<P>
-Script using CGI (methods), Storable, Data::Dumper called
+Script using CGI (methods), Storable, Data::Dumper called:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6442,13 +6670,13 @@
httpd 86870 0.0 1.0 4024 4548 - A 17:16:45 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 2764K
+Observation: child httpd has grown by 2764K
<P>
<Server restarted>
<P>
-Preloaded CGI (compiled), Storable, Data::Dumper at startup
+Preloaded CGI (compiled), Storable, Data::Dumper at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6464,15 +6692,14 @@
httpd 91052 0.0 1.0 6568 5040 - A 17:19:21 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 3276K. Great different: 512K
-less!!!
+Observation: child httpd has grown by 3276K. Great difference: 512K less!!!
<P>
<Server restarted>
<P>
All the above modules + the above script PreCompiled with
-Apache::RegistryLoader at startup
+<CODE>Apache::RegistryLoader</CODE> at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6480,7 +6707,7 @@
httpd 26844 0.0 0.0 3488 1776 - A 17:23:12 0:00 httpd
</PRE>
<P>
-Script using CGI (methods), Storable, Data::Dumper called
+Script using CGI (methods), Storable, Data::Dumper called:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -6491,73 +6718,39 @@
Observation: child httpd has grown even more 3316K ! Does not seem to be
good!
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A></H1></CENTER>
<P>
-If you use DBI for DB connections, you can preopen a connections to DB for
-each child with Apache::DBI.
+<STRONG>Summary</STRONG>:
-<P>
-<PRE> use Apache::DBI ();
- Apache::DBI->connect_on_init("DBI:mysql:test", 'login','passwd',
- {
- RaiseError => 1,
- PrintError => 1,
- AutoCommit => 1,
- };
-</PRE>
<P>
-See also <A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>
-
+1. Library Perl Modules Preloading gave good results everywhere.
-
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Memory_sharing">Memory sharing</A></H1></CENTER>
<P>
-Another important point is memory sharing. If you OS supports this, and
-most of systems do, you might save more memory by sharing it between child
-processes. This is only possible when you preload code at the server
-startup. However during child process' life its memory pages becomes
-unshared and there is no way we can control perl to make it allocate memory
-so (dynamic) variables land on different memory pages than constants so the
-copy-on-write effect will hit almost at random. If you are pre-loading many
-modules you might be able to balance the memory that stays shared against
-the time for an occasional fork by tuning the <CODE>MaxRequestsperChild</CODE> to a point where you restart before too much becomes unshared. In this case
-the
-<CODE>MaxRequestsPerChild</CODE> is very specific to your scenario. You should do some measurements and you
-might see if this really makes a difference and what a reasonable number
-might be. Each time a child reaches this upper limit and restarts it should
-release the unshared copies and the new child will inherit pages that are
-shared until it scribbles on them.
+2. <CODE>CGI.pm</CODE>'s <CODE>compile()</CODE> method seems to use even more memory. It's because we never use all of the
+methods CGI provides. Do <CODE>compile()</CODE>
+only the tags that you are going to use and you will save the overhead of
+the first call for each has not yet been called method, and the memory -
+since compiled code will be shared across all the children.
<P>
-It is very important to understand that your goal is not to have
-<CODE>MaxRequestsperChild</CODE> to be of 10000. Having a child to serve 300 requests on precompiled code is
-already a huge speedup, so if it is 100 or 10000 it does not really matter
-if it saves you the RAM by sharing. Do not forget that if you preload most
-of your code at the server startup, the fork to spawn a new child will be
-very very fast, cause it inherits most of the preloaded code and the perl
-interpreter from the parent process.
-
-<P>
-The conclusion is that <CODE>MaxRequestsperChild</CODE> should not be too big, otherwise you loose the benefits of the memory
-sharing.
+3. <CODE>Apache::RegistryLoader</CODE> might make scripts load faster on the first request after the child has
+just started but the memory usage is worse!!! See the numbers by yourself.
<P>
-See <A HREF="././performance.html#Choosing_MaxRequestsPerChild">Choosing MaxRequestsPerChild</A> for more about tuning the <CODE>MaxRequestsperChild</CODE> parameter.
+HW/SW used : The server is apache 1.3.2, mod_perl 1.16 running on AIX 4.1.5
+RS6000 1G RAM.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Preload_Registry_Scripts">Preload Registry Scripts</A></H1></CENTER>
<P>
-Apache::RegistryLoader compiles Apache::Registry scripts at server startup.
-It can be a good idea to preload these as well. So the code will be shared
-among the child servers.
+<CODE>Apache::RegistryLoader</CODE> compiles Apache::Registry scripts at server startup. It can be a good idea
+to preload these as well. So the code will be shared among the child
+servers.
<P>
-example of use at modperl.com in a PerlRequire'd file:
+Here is an example of the use of this technique. This code is included in a <CODE>PerlRequire</CODE>'d file, and walks the directory tree under which all registry scripts are
+installed. For each <CODE>.pl</CODE> file encountered, it calls the <CODE>Apache::RegistryLoader::handler()</CODE> method to preload the script in the parent server (before preforking the
+child processes):
<P>
<PRE> use File::Find 'finddepth';
@@ -6578,15 +6771,14 @@
}
</PRE>
<P>
-Note that we don't use here the second argument to the
-<CODE>handler().</CODE> You might need to provide a <CODE>trans()</CODE>
-method, since it's very dependent on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE> for the complete information.
+Note that we don't use the second argument to <CODE>handler()</CODE> here. You might need to provide a <CODE>trans()</CODE> method, since it's very dependent on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE>
+for the complete information.
<P>
-You have to check whether it makes any good for you though, I did some
-testing [ <A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A> ], and it seems that it takes more memory than when the scripts is being
+You have to check whether this makes any improvement for you though, I did
+some testing [ <A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A> ], and it seems that it takes more memory than when the scripts are being
called from the child - This is only a first impression and needs better
-investigation. If you aren't concerned about few scripts invocations which
+investigation. If you aren't concerned about few script invocations which
will take some time to respond while they load the code, you might not need
it all!
@@ -6596,53 +6788,61 @@
<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Avoid_Importing_Functions">Avoid Importing Functions</A></H1></CENTER>
-<P>
-When possible, avoid importing of a module functions into your name space.
-The aliases which are created can take up quite a bit of space. Try to use
-method interfaces and fully qualified Package::function names instead.
-
-<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Reducing_the_Memory_Usage">Reducing the Memory Usage</A></H1></CENTER>
+<CENTER><H1><A NAME="Sharing_Memory">Sharing Memory</A></H1></CENTER>
<P>
-One of the important issues in improving the performance is memory usage
-reduce - the less memory server uses - the more server processes you can
-start - the more performance you have (from the user point of view - the
-respond speed )
+Another important point is the sharing of memory. If your OS supports this
+(and most sane systems do), you might save more memory by sharing it
+between child processes. This is only possible when you preload code at
+server startup. However during a child process' life, its memory pages
+becomes unshared and there is no way we can control perl to make it
+allocate memory so (dynamic) variables land on different memory pages than
+constants so the copy-on-write effect will hit almost at random. If you are
+pre-loading many modules you might be able to balance the memory that stays
+shared against the time for an occasional fork by tuning the <CODE>MaxRequestsperChild</CODE> to a point where you restart before too much becomes unshared. In this case
+the
+<CODE>MaxRequestsPerChild</CODE> is very specific to your scenario. You should do some measurements and you
+might see if this really makes a difference and what a reasonable number
+might be. Each time a child reaches this upper limit and restarts it should
+release the unshared copies and the new child will inherit pages that are
+shared until it scribbles on them.
<P>
-See <A HREF="././porting.html#Global_Variables">Global Variables</A>
-
-
+It is very important to understand that your goal is not to have
+<CODE>MaxRequestsperChild</CODE> to be 10000. Having a child serve 300 requests on precompiled code is
+already a huge speedup, so if it is 100 or 10000 it does not really matter
+if it saves you the RAM by sharing. Do not forget that if you preload most
+of your code at the server startup, the fork to spawn a new child will be
+very very fast, because it inherits most of the preloaded code and the perl
+interpreter from the parent process. But then during the work of the child,
+its memory pages (which aren't really its yet, it uses the parent's pages)
+are getting dirty (originally inherited and shared variables are getting
+updated) and the copy-on-write happens, which reduce the sharing number of
+memory pages - thus enlarging the memory usage. Killing the child and
+spawning a new one allows to get the pristine shared memory from the parent
+process again.
<P>
-See <A HREF="././porting.html#Memory_leakage">Memory "leakages"</A>
-
-
+The conclusion is that <CODE>MaxRequestsperChild</CODE> should not be too big, otherwise you loose the benefits of the memory
+sharing.
<P>
-Joel Wagner reports that calling an undefined subroutine in a module can
-cause a tight loop that consumes all memory. Here is a way to catch such
-errors. Define an autoload subroutine:
+See <A HREF="././performance.html#Choosing_MaxRequestsPerChild">Choosing MaxRequestsPerChild</A> for more about tuning the <CODE>MaxRequestsperChild</CODE> parameter.
<P>
-<PRE> sub UNIVERSAL::AUTOLOAD {
- my $class = shift;
- warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
- }
-</PRE>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Avoid_Importing_Functions">Avoid Importing Functions</A></H1></CENTER>
<P>
-It will produce a nice error in error_log, giving the line number of the
-call and the name of the undefined subroutine.
+When possible, avoid importing a module's functions into your name space.
+The aliases which are created can take up quite a bit of space. Try to use
+method interfaces and fully qualified
+<CODE>Package::function</CODE> or <CODE>$Package::variable</CODE> like names instead.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
+<CENTER><H1><A NAME="How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
<P>
-Apache::Leak (derived from Devel::Leak) should help you with this task.
-Example:
+<CODE>Apache::Leak</CODE> (derived from <CODE>Devel::Leak</CODE>) should help you with this task. Example:
<P>
<PRE> use Apache::Leak;
@@ -6655,12 +6855,11 @@
};
</PRE>
<P>
-The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can
-just throw it around any code you suspect might be leaking. beware, it will
-run the code twice, because the first time in, new SVs are created, but
-does not mean you are leaking, the second pass will give better evidence.
-you do not need to be inside mod_perl to use it, from the command line, the
-above script outputs:
+The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can just throw it around any code you suspect
+might be leaking. beware, it will run the code twice, because the first
+time in, new <CODE>SV</CODE>s are created, but does not mean you are leaking, the second pass will give
+better evidence. you do not need to be inside mod_perl to use it, from the
+command line, the above script outputs:
<P>
<PRE> ENTER: 1482 SVs
@@ -6672,34 +6871,69 @@
!!! 2 SVs leaked !!!
</PRE>
<P>
-Build a debuggable perl to see dumps of the SVs. the simple way to have
-both a normal perl and debuggable perl, is to follow hints in the SUPPORT
-doc for building libperld.a, when that is built copy the `perl' from that
-directory to your perl bin directory, but name it `dperl'.
+Build a debuggable perl to see dumps of the <CODE>SV</CODE>s. the simple way to have both a normal perl and debuggable perl, is to
+follow hints in the
+<CODE>SUPPORT</CODE> doc for building <CODE>libperld.a</CODE>, when that is built copy the
+<CODE>perl</CODE> from that directory to your perl bin directory, but name it
+<CODE>dperl</CODE>.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_size_of_the_process">Limiting the size of the processes</A></H1></CENTER>
<P>
-Apache::SizeLimit allows you to kill off Apache httpd processes if they
-grow too large. see perldoc Apache::SizeLimit for more details.
+<CODE>Apache::SizeLimit</CODE> allows you to kill off Apache httpd processes if they grow too large. see
+perldoc <CODE>Apache::SizeLimit</CODE> for more details.
<P>
By using this module, you should be able to discontinue using the Apache
-configuration directive MaxRequestsPerChild, although for some folks, using
-both in combination does the job.
+configuration directive <CODE>MaxRequestsPerChild</CODE>, although for some folks, using both in combination does the job.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A></H1></CENTER>
<P>
-Apache::Resource uses the BSD::Resource module, which uses the C function
-setrlimit to set limits on system resources such as memory and cpu usage.
+<CODE>Apache::Resource</CODE> uses the <CODE>BSD::Resource</CODE> module, which uses the C function <CODE>setrlimit</CODE> to set limits on system resources such as memory and cpu usage.
<P>
-See perldoc Apache::Resource for more info.
+To configure use:
<P>
+<PRE> PerlModule Apache::Resource
+ # set child memory limit in megabytes
+ # (default is 64 Meg)
+ PerlSetEnv PERL_RLIMIT_DATA 32:48
+
+ # set child cpu limit in seconds
+ # (default is 360 seconds)
+ PerlSetEnv PERL_RLIMIT_CPU 120
+
+ PerlChildInitHandler Apache::Resource
+</PRE>
+<P>
+The following limit values are in megabytes: <CODE>DATA</CODE>, <CODE>RSS</CODE>,
+<CODE>STACK</CODE>, <CODE>FSIZE</CODE>, <CODE>CORE</CODE>, <CODE>MEMLOCK</CODE>; all others are treated as their natural unit. Prepend <CODE>PERL_RLIMIT_</CODE> for each one you want to use. Refer to <CODE>setrlimit</CODE> man page on your OS for other possible resources.
+
+<P>
+If the value of the variable is of the form <CODE>S:H</CODE>, <CODE>S</CODE> is treated as the soft limit, and <CODE>H</CODE> is the hard limit. If it is just a single number, it is used for both soft
+and hard limits.
+
+<P>
+To debug add:
+
+<P>
+<PRE> <Perl>
+ $Apache::Resource::Debug = 1;
+ require Apache::Resource;
+ </Perl>
+ PerlChildInitHandler Apache::Resource
+</PRE>
+<P>
+and look in the error_log to see what it's doing.
+
+<P>
+Refer to <CODE>perldoc Apache::Resource</CODE> and <CODE>man 2 setrlimit</CODE> for more info.
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A></H1></CENTER>
<P>
@@ -6710,7 +6944,7 @@
such robots, you'll have to be more sophisticated.
<P>
-Apache::SpeedLimit comes for you to help, see:
+<CODE>Apache::SpeedLimit</CODE> comes for you to help, see:
<P>
<A
@@ -6726,16 +6960,15 @@
directory of mod_perl dist for more examples.
<P>
-If you write a benchmarks from your own for heavy scripts use
-<CODE>Benchmark</CODE> and for very fast scripts use <CODE>Time::HiRes</CODE> modules.
+If you write a benchmark for your own, use <CODE>Benchmark</CODE> for heavy scripts or use <CODE>Time::HiRes</CODE> for very fast scripts where you need better precision.
<P>
-There is no need to write a special benchmark, if you want to impress your
-boss or colleagues, just take the heaviest cgi script you have, open 2
-xterms and call the same script in mod_perl mode in one xterm and in
-mod_cgi mode in the other. You can use lwp-get from LWP package to emulate
-the web agent (browser). (benchmark/ directory of mod_perl dist includes
-such an example)
+There is no need to write a special benchmark though. If you want to
+impress your boss or colleagues, just take the heaviest cgi script you
+have, open 2 xterms and call the same script in mod_perl mode in one xterm
+and in mod_cgi mode in the other. You can use lwp-get from
+<CODE>LWP</CODE> package to emulate the web agent (browser). (benchmark/ directory of
+mod_perl dist includes such an example)
<P>
See also 2 tools for benchmarking:
@@ -6805,10 +7038,11 @@
access module from yet another.
<P>
-I think the Apache::ASP module looks very promising. It has very easy to
-use and adequately powerful state maintenance, a good embedding system, and
-a sensible object model (that emulates the Microsoft ASP one). It doesn't
-replicate MS's ADO for data access, but DBI is fine for that.
+I think the <CODE>Apache::ASP</CODE> module looks very promising. It has very easy to use and adequately
+powerful state maintenance, a good embedding system, and a sensible object
+model (that emulates the Microsoft ASP one). It doesn't replicate MS's ADO
+for data access, but
+<CODE>DBI</CODE> is fine for that.
<P>
I have always found that the developers available make the greatest impact
@@ -6850,20 +7084,20 @@
perl: 299 secs (32.51 usr 23.98 sys = 56.49 cpu)
</PRE>
<P>
-We don't know what server configurations was used for these testing, but I
-guess the numbers talks for themselves.
+We don't know what server configurations was used for these tests, but I
+guess the numbers speak for themselves.
<P>
-The source code of the script at <A
+The source code of the script is available at <A
HREF="http://www.realtime.net/~parkerm/perl/conf98/sld006.htm">http://www.realtime.net/~parkerm/perl/conf98/sld006.htm</A>
-
+.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Benchmarking_scripts_with_execut">Benchmarking scripts with execution times below 1 second :)</A></H2></CENTER>
<P>
-As noted before for very fast scripts you will have to use Time::HiRes
-module, it's usage is similar to the Benchmark's.
+As noted before, for very fast scripts you will have to use the Time::HiRes
+module, its usage is similar to the Benchmark's.
<P>
<PRE> use Time::HiRes qw(gettimeofday tv_interval);
@@ -6882,38 +7116,49 @@
<P>
At <A
HREF="http://perl.apache.org/dist/contrib/">http://perl.apache.org/dist/contrib/</A>
-you will find Apache::Timeit package which does PerlHandler's Benchmarking.
+you will find
+<CODE>Apache::Timeit</CODE> package which does PerlHandler's Benchmarking.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Tuning_the_Apache_s_configuratio">Tuning the Apache's configuration variables for the best performance</A></H1></CENTER>
<P>
It's very important to make a correct configuration of the
-<CODE>MinSpareServers MaxSpareServers StartServers MaxClients
-MaxRequestsPerChild</CODE> parameters. There are no defaults, the values of these variable are very
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE>, <CODE>StartServers</CODE>,
+<CODE>MaxClients</CODE>, and <CODE>MaxRequestsPerChild</CODE> parameters. There are no defaults, the values of these variable are very
important, as if too ``low'' you will not use the system for its full
ability, and if too ``high'' chances your server will bring the machine to
-its knees.
+its knees.
<P>
All the above parameters should be specified on the basis of the resources
-you have. While with plain apache server, there is no big deal if you run
+you have. While with a plain apache server, there is no big deal if you run
too many servers (not too many of course) since the processes are of ~1Mb
and aren't eating a lot of your RAM. The situation is different with
-mod_perl. I have seen mod_perl processes of 20Mb and more. Now if you have
-MaxClients set to 50: 50x20Mb = 1Gb - do you have 1Gb of RAM? Probably not.
-So how do you tune these numbers? Generally by trying different
-combinations and testing the server.
+mod_perl. I have seen mod_perl processes of 20Mb and more. Now if you have <CODE>MaxClients</CODE> set to 50: 50x20Mb = 1Gb - do you have 1Gb of RAM? Probably not. So how do
+you tune these numbers? Generally by trying different combinations and
+testing the server.
<P>
Before you start this task you should be armed with the proper weapon. You
-need a crashme script, which will load your server with all kinds of
-mod_perl scripts you can think you have in your repository. There are
-commercial solutions for that, when you have free ones that do the same job
-(but for free :). You can use an
-<A HREF="././performance.html#Tuning_with_ab_ApacheBench">ApacheBench</A> <STRONG><CODE>ab</CODE></STRONG> utility that comes with apache distribution or use a <A HREF="././performance.html#Tuning_with_crashme_script">crashme test</A> which uses LWP::Parallel::UserAgent. You need these to have an ability to
-emulate multiuser environment and to generate multiply clients which will
-call the mod_perl scripts at your server simultaneously.
+need a crashme utility, which will load your server with mod_perl scripts
+you possess. While there are commercial solutions, you can get away with
+free ones who do the same job. You can use an
+<A HREF="././performance.html#Tuning_with_ab_ApacheBench">ApacheBench</A> <STRONG><CODE>ab</CODE></STRONG> utility that comes with apache distribution, a <A HREF="././performance.html#Tuning_with_crashme_script">crashme script</A> which uses
+<CODE>LWP::Parallel::UserAgent</CODE> or <CODE>httperf</CODE> (see <A HREF="././download.html#">Download page</A>). You need these to have an ability to emulate a multiuser environment and
+to emulate multiple clients behaviour which will call the mod_perl scripts
+at your server simultaneously.
+
+<P>
+Another important issue is to make sure to run testing client (load
+generator) on a system that is more powerful than the system being tested.
+After all we are trying to simulate the Internet users, where many users
+are trying to reach your service at once -- since a number of concurrent
+users can be quite big, your testing machine much be very powerful and
+capable to generate a big load. Of course you should not run the clients
+and server on the same machine. If you do -- your testing results would be
+incorrect, since clients will eat a CPU and a memory that have to be
+dedicated to the server, and vice versa.
<P>
See also 2 tools for benchmarking:
@@ -6927,12 +7172,12 @@
<P>
<STRONG>ab</STRONG> is a tool for benchmarking your Apache HTTP server. It is designed to give
you an impression on how much performance your current Apache installation
-can give. Particularly it shows you how much requests per secs your Apache
-server is capable to serve. The
-<STRONG>ab</STRONG> comes bundled with apache source distribution (and it's free :).
+can give. In particular, it shows you how many requests per secs your
+Apache server is capable of serving. The
+<STRONG>ab</STRONG> tool comes bundled with apache source distribution (and it's free :).
<P>
-Lets try it. We will simulate 10 users concurrently requesting the script <CODE>www.you.com:81/test/test.pl</CODE> which a very light one. Each one does it for 10 times.
+Lets try it. We will simulate 10 users concurrently requesting the script <CODE>www.you.com:81/test/test.pl</CODE> which is a very light one. Each one makes 10 requests.
<P>
<PRE> % ./ab -n 100 -c 10 www.you.com:81/test/test.pl
@@ -6962,7 +7207,7 @@
Requests per second: 139.86
</PRE>
<P>
-Lets rise the load of requests to 100 x 10 (10 users each 100 requests
+Let's raise the load of requests to 100 x 10 (10 users each 100 requests)
<P>
<PRE> % ./ab -n 1000 -c 10 www-pais:81/perl/access/access.cgi
@@ -6973,7 +7218,7 @@
</PRE>
<P>
As expected nothing changes (Since the situation didn't changed, we have
-the same 10 concurrent users). Now lets rise the number of concurrent
+the same 10 concurrent users). Now let's raise the number of concurrent
users:
<P>
@@ -6983,8 +7228,8 @@
Requests per second: 133.01
</PRE>
<P>
-We see that the server is capable to serve 50 concurrent users at amazing
-133 req/sec! Lets find the upper bound. Using <CODE>-n 10000 -c
+We see that the server is capable of serving 50 concurrent users at an
+amazing 133 req/sec! Lets find the upper bound. Using <CODE>-n 10000 -c
1000</CODE> failed to get results (Broken Pipe?). Using <CODE>-n 10000 -c
500</CODE> derived 94.82 req/sec. It went down with the high load.
@@ -7012,16 +7257,16 @@
<PRE> % ./ab -n 1000 -c 50 www-pais:81/perl/access/access.cgi
</PRE>
<P>
-The benchmark time outed with the above configuration.... I watched the
-output of ps as I run it, the parent process just wasn't capable to respawn
-the killed children in that rate...When I raised the MaxRequestsPerChild to
-10 I've got 8.34 req/sec - very bad (18 times slower!) (You can't benchmark
-the importance of the MinSpareServers, MaxSpareServers and StartServers
-with this kind of test).
+The benchmark timed out with the above configuration.... I watched the
+output of ps as I ran it, the parent process just wasn't capable of
+respawning the killed children at that rate...When I raised the
+<CODE>MaxRequestsPerChild</CODE> to 10 I've got 8.34 req/sec - very bad (18 times slower!) (You can't
+benchmark the importance of the
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE> and <CODE>StartServers</CODE> with this kind of test).
<P>
-Now let's try to return MaxRequestsPerChild to 1500, but to lower the
-MaxClients to 10 and run the same test:
+Now let's try to return <CODE>MaxRequestsPerChild</CODE> to 1500, but to lower the
+<CODE>MaxClients</CODE> to 10 and run the same test:
<P>
<PRE> MinSpareServers 8
@@ -7031,58 +7276,57 @@
MaxRequestsPerChild 1500
</PRE>
<P>
-I have got 27.12 req/sec, which is better but still 4-5 times slower (133
-with MaxClients of 50)
+I got 27.12 req/sec, which is better but still 4-5 times slower (133 with <CODE>MaxClients</CODE> of 50)
<P>
-<STRONG>Summary:</STRONG> I have tested a few combinations of server configuration variables
-(MinSpareServers MaxSpareServers StartServers MaxClients
-MaxRequestsPerChild). And the results we have received are as follows:
+<STRONG>Summary:</STRONG> I have tested a few combinations of server configuration variables (<CODE>MinSpareServers</CODE> <CODE>MaxSpareServers</CODE> <CODE>StartServers</CODE>
+
+<CODE>MaxClients</CODE> <CODE>MaxRequestsPerChild</CODE>). And the results we have received are as follows:
<P>
-MinSpareServers, MaxSpareServers and StartServers are only important for
-user respond times (sometimes user will have to wait a bit).
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE> and <CODE>StartServers</CODE> are only important for user response times (sometimes user will have to
+wait a bit).
<P>
-The important parameters are MaxClients and MaxRequestsPerChild. MaxClients
-should be not to big so it will not abuse your machine's memory resources
+The important parameters are <CODE>MaxClients</CODE> and
+<CODE>MaxRequestsPerChild</CODE>. <CODE>MaxClients</CODE> should be not to big so it will not abuse your machine's memory resources
and not too small, when users will be forced to wait for the children to
-become free to come serve them. MaxRequestsPerChild should be as big as
-possible, to take the full benefit of the mod_perl, but watch your server
-at the beginning to make sure your scripts are not leaking memory causing
-your server (and your service) to die very fast.
+become free to come serve them. <CODE>MaxRequestsPerChild</CODE> should be as big as possible, to take the full benefit of mod_perl, but
+watch your server at the beginning to make sure your scripts are not
+leaking memory, thereby causing your server (and your service) to die very
+fast.
<P>
-Also it is important to understand that we didn't test the respond times in
-the tests above, but the ability of the server to respond. If the script
+Also it is important to understand that we didn't test the response times
+in the tests above, but the ability of the server to respond. If the script
that was used to test was heavier, the numbers would be different but the
conclusions are very similar.
<P>
-The benchmarks were run at:
+The benchmarks were run with:
<P>
<PRE> HW: RS6000, 1Gb RAM
SW: AIX 4.1.5 . mod_perl 1.16, apache 1.3.3
- Machine running only mysql service, httpd docs and mod_perl servers.
- Machine was completely unloaded during the benchmarking.
+ Machine running only mysql, httpd docs and mod_perl servers.
+ Machine was _completely_ unloaded during the benchmarking.
</PRE>
<P>
-After each server restart when I did changes to server's configurations, I
-made sure the scripts were preloaded by fetching a script at least one time
-by each child.
+After each server restart when I did changes to the server's
+configurations, I made sure the scripts were preloaded by fetching a script
+at least one time by each child.
<P>
-It is important to notice that None of requests time outed even if was kept
-in server's queue form more than 1 minute! (That is the way <STRONG>ab</STRONG>
-works, which is OK for the test but will not for the real world - user will
-not wait for more than 5-10 secs for a request to complete, and the browser
-will timeout in a 30 secs or so)
+It is important to notice that none of requests timed out, even if was kept
+in server's queue for more than 1 minute! (That is the way <STRONG>ab</STRONG>
+works, which is OK for the test but will not for the real world - users
+will not wait for more than 5-10 secs for a request to complete, and the
+browser will timeout in 30 secs or so.)
<P>
-Now let me take a real code whose execution time is bigger than a few
-msecs. Will will do real testing and collect the data in tables for easier
-view.
+Now let's take a look at some real code whose execution time is more than a
+few msecs. We will do real testing and collect the data in tables for
+easier viewing.
<P>
I will use the following abbreviations
@@ -7108,19 +7352,20 @@
<P>
<PRE> NR NC RPS comment
------------------------------------------------
- 10 10 3.33 # not a reliable stats
+ 10 10 3.33 # not a reliable stat
100 10 3.94
1000 10 4.62
1000 50 4.09
</PRE>
<P>
-Conclusions: Here I wanted to show that when the application is slow not
-because of perl loading, script compiling and execution, but bounded to
-some external operation like mysqld querying which made the bottleneck - it
-almost does not matter what is the load we make - the RPS (Requests per
-second) is almost the same (taken that all the requested has been served,
-you have an ability to queue the clients, but be aware that something that
-goes to queue means a waiting client and browser can get time outed!)
+Conclusions: Here I wanted to show that when the application is slow -- not
+due to perl loading, script compiling and execution, but bounded to some
+external operation like mysqld querying which made the bottleneck -- it
+almost does not matter what load we place on the server. The RPS (Requests
+per second) is almost the same (given that all the requests have been
+served, you have an ability to queue the clients, but be aware that
+something that goes to queue means a waiting client and browser can time
+out!)
<P>
Now we will benchmark the same script without using the mysql (perl only
@@ -7136,7 +7381,7 @@
<P>
<PRE> NR NC RPS comment
------------------------------------------------
- 10 10 26.95 # not a reliable stats
+ 10 10 26.95 # not a reliable stat
100 10 30.88
1000 10 29.31
1000 50 28.01
@@ -7145,19 +7390,18 @@
100000 400 24.95
</PRE>
<P>
-Conclusions: This time the script we executed was a pure perl (not bounded
-to I/O or mysql), so we see that the server serves the requests much
-faster. You can see the RequestPerSecond (RPS) is almost the same for any
-load, but goes lower when the number of concurrent clients goes beyond the
-MaxClients. With 25 RPS, the client in load of 400 concurrent clients will
+Conclusions: This time the script we executed was pure perl (not bounded to
+I/O or mysql), so we see that the server serves the requests much faster.
+You can see the RequestPerSecond (RPS) is almost the same for any load, but
+goes lower when the number of concurrent clients goes beyond the <CODE>MaxClients</CODE>. With 25 RPS, the client supplying a load of 400 concurrent clients will
be served in 16 secs. But to get more realistic and assume the max
concurrency of 100, with 30 RPS, the client will be served in 3.5 secs,
which is pretty good for a highly loaded server.
<P>
-Now we will use the server for its full capacity, by keeping all MaxClients
-alive all the time and having a big MaxRequestsPerChild, so no server will
-be killed during the benchmarking.
+Now we will use the server for its full capacity, by keeping all
+<CODE>MaxClients</CODE> alive all the time and having a big
+<CODE>MaxRequestsPerChild</CODE>, so no server will be killed during the benchmarking.
<P>
<PRE> MinSpareServers 50
@@ -7175,13 +7419,12 @@
10000 200 31.60
</PRE>
<P>
-Conclusion: In this scenario there is no overhead for parent server to load
-new children, all the servers are available, and the only bottleneck is a
-rival over the CPU
+Conclusion: In this scenario there is no overhead involving the parent
+server loading new children, all the servers are available, and the only
+bottleneck is contention for the CPU.
<P>
-Now we will try to change the MaxClients and to watch the results: Let's
-reduce MC to 10.
+Now we will try to change the <CODE>MaxClients</CODE> and to watch the results: Let's reduce MC to 10.
<P>
<PRE> MinSpareServers 8
@@ -7203,14 +7446,15 @@
<P>
Conclusions: Very little difference! Almost no change! 10 servers were able
to serve almost with the same throughput as 50 servers. Why? My guess it's
-because of CPU , Seems that 10 servers were serving 5 times faster the
-requests then when in the test above we worked with 50 servers. In the case
-above each child received its CPU time slice 5 times less frequently. So
-having a big value for MaxClients, doesn't mean that the performance will
-be better. You have just saw the numbers!
+because of CPU throttling. It seems that 10 servers were serving requests 5
+times faster than when in the test above we worked with 50 servers. In the
+case above each child received its CPU time slice 5 times less frequently.
+So having a big value for
+<CODE>MaxClients</CODE>, doesn't mean that the performance will be better. You have just seen the
+numbers!
<P>
-Now we will start to reduce drastically the MaxRequestsPerClient
+Now we will start to drastically reduce the MaxRequestsPerClient:
<P>
<PRE> MinSpareServers 8
@@ -7228,9 +7472,8 @@
1000 100 10 6.51
</PRE>
<P>
-Conclusions: When we reduce drastically the MaxRequestsPerClient, the
-performance starts to become closer to the plain mod_cgi. Just for compare
-with mod_cgi, here are the numbers of run with mod_cgi:
+Conclusions: When we drastically reduce the <CODE>MaxRequestsPerClient</CODE>, the performance starts to become closer to the plain mod_cgi. Just for
+comparison with mod_cgi, here are the numbers of this run with mod_cgi:
<P>
<PRE> MinSpareServers 8
@@ -7248,7 +7491,7 @@
Conclusion: mod_cgi is much slower :) in test NReq/NClients 100/10 the RPS
in mod_cgi 1.12 and in mod_perl 32 => 30 times faster !!! In the first
test each child waited about 100 secs to be served. In the second and third
-1000 secs!
+1000 secs!
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -7258,14 +7501,15 @@
located at <A
HREF="http://www.linux-magazin.de/ausgabe.1998.08/Pounder/pounder.html">http://www.linux-magazin.de/ausgabe.1998.08/Pounder/pounder.html</A>
. I did a few modifications (mostly adding <CODE>my()</CODE> ops :). I also
-allowed it to accept more then one url, since sometimes you want to test
+allowed it to accept more than one url, since sometimes you want to test an
overall and not just one script.
<P>
The tool provides the same results as <STRONG>ab</STRONG> above but it also allows you to set the timeout value, so requests will
-fail if not served before time outed. You also get Latency (secs/Request)
-and Throughput (Requests/sec) numbers. It can give you a better picture and
-make a complete simulation of your favorite Netscape browser :)
+fail if not served within the time out period. You also get Latency
+(secs/Request) and Throughput (Requests/sec) numbers. It can give you a
+better picture and make a complete simulation of your favorite Netscape
+browser :)
<P>
I have noticed while running these 2 benchmarking suites - <STRONG>ab</STRONG> gave me results 2.5-3.0 times better. Both suites run on the same machine
@@ -7438,27 +7682,27 @@
supported; not more than this number of child server processes will be
created. To configure more than 256 clients, you must edit the
HARD_SERVER_LIMIT entry in httpd.h and recompile. In our case we want to
-set this variable to as little as possible number, this way we can
-virtually bound the resources used by the server children. If we know that
-we have X Mb of RAM, each child consumes a maximum of Y Mb of RAM (we can
-restrict each child See
-<A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>) and we have the all these X Mb dedicated for the webserver. Then
-calculation of
+set this variable as small as possible, this way we can virtually bound the
+resources used by the server children. If we know that we have X Mb of RAM,
+each child consumes a maximum of Y Mb of RAM (we can restrict each child.
+See
+<A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>) and we have all these X Mb dedicated for the webserver. Then calculation
+of
<CODE>MaxClients</CODE> is pretty straightforward :
<P>
<PRE> MaxClients = Total Available to the webserver RAM / MAX child's size
</PRE>
<P>
-So If I have 400Mb left for the the webserver to run . I can set the
+So if I have 400Mb left for the webserver to run in, I can set the
<CODE>MaxClients</CODE> to be of 40 if I know that each child is bounded to the 10Mb of memory
-(with Apache::SizeLimit, See the reference above)
+(with <CODE>Apache::SizeLimit</CODE>, See the reference above.)
<P>
-Certainly you will wander what happens to your server if there are more
+Certainly you will wonder what happens to your server if there are more
than <CODE>MaxClients</CODE> concurrent users at some moment. This situation is accompanied by the
-following warning message into the <CODE>error.log</CODE>
-file:
+following warning message into the
+<CODE>error.log</CODE> file:
<P>
<PRE> [Sun Jan 24 12:05:32 1999] [error] server reached MaxClients setting,
@@ -7477,9 +7721,9 @@
children. The best thing is not to have this condition reached at all.
<P>
-It's important to understand what is child's memory size? If your children
-can share some memory (when OS supports that and you worry to let the
-sharing happen - See <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A>). If this is the case chances that your <CODE>MaxClients</CODE> can be even higher. But seems that it's not so simple to calculate the
+It's important to understand how much memory a child occupies. If your
+children can share some memory (when the OS supports that and you take
+action to allow the sharing happen - See <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A>). If this is the case, chances are that your <CODE>MaxClients</CODE> can be even higher. But it seems that it's not so simple to calculate the
absolute number. (If you come up with solution please let me know)
<P>
@@ -7492,57 +7736,59 @@
<CODE>MaxRequestsPerChild</CODE> is 0, then the process will never expire.
<P>
-Setting <CODE>MaxRequestsPerChild</CODE> to a non-zero limit has two beneficial effects: solves memory leakages and
-helps reduce the number of processes when the server load reduces.
+Setting <CODE>MaxRequestsPerChild</CODE> to a non-zero limit has two beneficial effects: it solves memory leakages
+and helps reduce the number of processes when the server load reduces.
<P>
-The first reason is the most crucial for mod_perl, since dirty programming
+The first reason is the most crucial for mod_perl, since sloppy programming
will cause a child process to consume more memory after each request. If
-left unbounded after a certain number of requests children will it up all
-the available memory and leave the server to die in memory starvation :).
-Note, that sometimes some standard modules leaks memory, on OSes where
-memory managements is bad (Solaris 2.5 on x86 ?)
-
-<P>
-If this is your case you can set <CODE>MaxRequestsPerChild</CODE> to a small number, which will allow the parent to kill the memory greedy
-son after <CODE>MaxRequestsPerChild</CODE> requests. But then you loose all the speed bonuses you receive with
-mod_perl, and you better fall back to run in plain mod_cgi, since the
-overhead of reloading the script and the perl on each request will be too
-high. Consider using Apache::PerlRun if this is your case. Also setting
-MaxSpareServers to number close to
-<CODE>MaxClients</CODE>, will make the respond time faster (but your parent process will be busy
-to respawn new children all the time!)
+left unbounded, then after a certain number of requests the children will
+use up all the available memory and leave the server to die from memory
+starvation :). Note, that sometimes some standard modules leak memory,
+especially on OSes where memory managements is bad (Solaris 2.5 on x86 ?)
+
+<P>
+If this is your case you can set <CODE>MaxRequestsPerChild</CODE> to a small number, which will allow the system to reclaim the memory,
+greedy child process consumed, when it exits after <CODE>MaxRequestsPerChild</CODE>
+requests. But beware -- if you set this number too low, you will lose the
+speed bonus you receive with mod_perl, so maybe you should consider falling
+back to plain mod_cgi, since the overhead of reloading the script and the
+perl interpreter for each request will be too high. Consider using <CODE>Apache::PerlRun</CODE> if this is the case. Also setting <CODE>MaxSpareServers</CODE> to a number close to <CODE>MaxClients</CODE>, will improve the response time (but your parent process will be busy
+respawning new children all the time!)
<P>
-Another approach is to use Apache::SizeLimit (See <A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>). By using this module, you should be able to discontinue using the
+Another approach is to use <CODE>Apache::SizeLimit</CODE> (See <A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>). By using this module, you should be able to discontinue using the
<CODE>MaxRequestsPerChild</CODE>, although for some folks, using both in combination does the job.
<P>
See also <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A> and
-<A HREF="././performance.html#Memory_sharing">Memory sharing</A>.
+<A HREF="././performance.html#Sharing_Memory">Sharing Memory</A>.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Choosing_MinSpareServers_MaxSpa">Choosing MinSpareServers, MaxSpareServers and StartServers</A></H2></CENTER>
<P>
-With mod_perl it might take up to a 30-50 secs before the new server is
-ready to serve the requests. It depends on OS, number of preloaded modules
-and the load of the machine. So you better set <CODE>StartServers</CODE>
-and <CODE>MinSpareServers</CODE> to a big numbers so if you get a high load after the server has been just
-restarted, the fresh servers will be ready to serve on the first demand.
-It's good for mod_perl to raise all 3 variables up, Since with mod_perl you
-don't want to kill the servers when not in use, on opposite you want them
-to stay up. (For the same reason of the heavy and slow load). I think an
-ideal configuration is with <CODE>MinSpareServers</CODE> and <CODE>MaxSpareServers</CODE> of similar values, even the same. Having the <CODE>MaxSpareServers</CODE> close to
-<CODE>MaxClients</CODE> will use completely all of your resources (if <CODE>MaxClients</CODE>
-has been chosen to take the full advantage of the resources), but it'll
-make sure that in any given moment your system will be capable of
-responding to request with the maximum speed (taken that number of
-concurrent requests is not higher then <CODE>MaxClients</CODE>)
+With mod_perl enabled, it might take as much as 3-30 seconds from the time
+you start the server until it is ready to serve incoming requests. This
+delay depends on the OS, the number of preloaded modules and the process
+load of the machine. So it's best to set
+<CODE>StartServers</CODE> and <CODE>MinSpareServers</CODE> to high numbers, so that if you get a high load just after the server has
+been restarted, the fresh servers will be ready to serve requests
+immediately. With mod_perl, it's usually a good idea to raise all 3
+variables higher than normal. In order to maximize the benefits of
+mod_perl, you don't want to kill servers when they are idle, rather you
+want them to stay up and available to immediately handle new requests. I
+think an ideal configuration is to set <CODE>MinSpareServers</CODE> and <CODE>MaxSpareServers</CODE> to similar values, maybe even the same. Having the <CODE>MaxSpareServers</CODE>
+close to <CODE>MaxClients</CODE> will completely use all of your resources (if
+<CODE>MaxClients</CODE> has been chosen to take the full advantage of the resources), but it'll
+make sure that at any given moment your system will be capable of
+responding to requests with the maximum speed (given that number of
+concurrent requests is not higher then
+<CODE>MaxClients</CODE>.)
<P>
-Let me try some numbers. For the heavily loaded web site and the dedicated
-machine I would think of (note 400Mb is just for the show case):
+Let's try some numbers. For a heavily loaded web site and a dedicated
+machine I would think of (note 400Mb is just for example):
<P>
<PRE> Available to webserver RAM: 400Mb
@@ -7553,8 +7799,8 @@
MaxSpareServers: 35
</PRE>
<P>
-However if I want to use the server for many other tasks but make it
-capable of the high load, I'd think of:
+However if I want to use the server for many other tasks, but make it
+capable of handling a high load, I'd think of:
<P>
<PRE> Available to webserver RAM: 400Mb
@@ -7565,77 +7811,100 @@
MaxSpareServers: 10
</PRE>
<P>
-(These numbers are taken from the head and it shouldn't be used as rule,
-but to show you some possible scenarios. Use this information wisely!)
+(These numbers are taken off the top of my head, and it shouldn't be used
+as a rule, but rather as examples to show you some possible scenarios. Use
+this information wisely!)
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A></H2></CENTER>
<P>
-OK, we run various benchmarks and what are the conclusions:
+OK, we've run various benchmarks let's summarize the conclusions:
<UL>
<P><LI><STRONG><A NAME="item_MaxRequestsPerChild">MaxRequestsPerChild</A></STRONG>
<P>
-If your scripts are clean and don't leak the memory set this variable to a
-number as big as possible (10000?). If you use Apache::SizeLimit, you can
-set this parameter to 0 (equal to infinity).
+If your scripts are clean and don't leak memory, set this variable to a
+number as large as possible (10000?). If you use
+<CODE>Apache::SizeLimit</CODE>, you can set this parameter to 0 (equal to infinity).
<P><LI><STRONG><A NAME="item_StartServers">StartServers</A></STRONG>
<P>
-If you keep a little number of servers most of the time, keep this number
-low. Especially if MaxSpareServers is low and it'll kill the just loaded
-servers before they were utilized at all (if there is no load). If your
-service is heavily loaded make this number close to
-<CODE>MaxClients</CODE> (and keep MaxSpareServers equal to <CODE>MaxClients</CODE> as well)
+If you keep a small number of servers active most of the time, keep this
+number low. Especially if <CODE>MaxSpareServers</CODE> is low as it'll kill the just loaded servers before they were utilized at
+all (if there is no load). If your service is heavily loaded, make this
+number close to
+<CODE>MaxClients</CODE> (and keep <CODE>MaxSpareServers</CODE> equal to <CODE>MaxClients</CODE> as well.)
<P><LI><STRONG><A NAME="item_MinSpareServers">MinSpareServers</A></STRONG>
<P>
-If your server performs other work except web serving, make it low so the
-memory will be freed when there is no big load. If you server's load is
-like a wave (you get a load in bursts) and you want a fast respond for all
-clients at any time you will want to make it high, so new children will be
-respawned in advance.
+If your server performs other work besides web serving, make this low so
+the memory of unused children will be freed when there is no big load. If
+your server's load varies (you get loads in bursts) and you want fast
+response for all clients at any time, you will want to make it high, so
+that new children will be respawned in advance and be waiting to handle
+bursts of requests.
<P><LI><STRONG><A NAME="item_MaxSpareServers">MaxSpareServers</A></STRONG>
<P>
-The logic is the same as of MinSpareServers - low if need the machine for
-other tasks, high if it's web dedicated and you want the minimal delay on
-responses.
+The logic is the same as of <CODE>MinSpareServers</CODE> - low if you need the machine for other tasks, high if it's a dedicated web
+host and you want a minimal response delay.
<P><LI><STRONG><A NAME="item_MaxClients">MaxClients</A></STRONG>
<P>
-Not too low, so you don't get a situation where clients are waiting for
-server to start serving them. (they might wait, but not too long). Don't
-make it high, since if you get a high load and all requests will be
-immediately granted your CPU will have a hard times and if child's size *
-number of running children is bigger than the total available RAM, your
-server will start swapping (which will slow down everything, which in turn
-will make things even more slower, until eventually your machine will die).
-It's important that you make sure that no swap will be normally used. Swap
-is an emergency pool, not a resource to be used on the constant basis. If
-you low on memory and you badly need it - buy it, the memory is amazingly
-cheap these days. But based on the test I conducted above, even if you have
-a plenty of memory like I have (1Gb), pulling <CODE>MaxClients</CODE> sometimes will give you no speedup. The more clients are running the more
-CPU will be utilized, the less CPU time slices each process will receive,
-the latency (the to process the request) will grow, so you didn't get an
-improve. The best approach is to find the minimum requirement for your kind
-of service and the maximum capability of your machine, then start at the
-minimum and start testing like I did, by raising this parameter, until you
-find the point where the curve on the latency or throughput graph stops to
-raise or the ramp becomes smaller. Stop there and use it. Of course when
-you use these parameters in production server, you will have the ability to
-tune them more precisely. Also don't forget that if you add more scripts,
-most probably that the parameters need to be recalculated, since the
-processes will grow in size as you compile in more code.
+Not too low, so you don't get into a situation where clients are waiting
+for the server to start serving them (they might wait, but not too long).
+Don't make it high, since if you get a high load and all requests will be
+immediately granted, your CPU will have a hard time keeping up, and if the
+child's size * number of running children is larger than the total
+available RAM, your server will start swapping (which will slow down
+everything, which in turn will make things even more slower, until
+eventually your machine could die). It's important that you take pains to
+ensure that swapping does not normally happen. Swap space is an emergency
+pool, not a resource to be used on a consistent basis. If you are low on
+memory and you badly need it - buy it, memory is amazingly cheap these
+days. But based on the test I conducted above, even if you have plenty of
+memory like I have (1Gb), increasing <CODE>MaxClients</CODE> sometimes will give you no speedup. The more clients that are running, the
+more CPU time will be required, the less CPU time slices each process will
+receive. The response latency (the time to respond to a request) will grow,
+so you won't see the expected improvement. The best approach is to find the
+minimum requirement for your kind of service and the maximum capability of
+your machine. Then start at the minimum and start testing like I did,
+successively raising this parameter until you find the point on the curve
+of the graph of the latency or throughput where the improvement becomes
+smaller. Stop there and use it. Of course when you use these parameters in
+production server, you will have the ability to tune them more precisely.
+Also don't forget that if you add more scripts, most probably that the
+parameters need to be recalculated, since the processes will grow in size
+as you compile in more code.
</UL>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A></H1></CENTER>
+<P>
+If you use DBI for DB connections, you can preopen connections to DB for
+each child with Apache::DBI.
+
+<P>
+<PRE> use Apache::DBI ();
+ Apache::DBI->connect_on_init("DBI:mysql:test", 'login','passwd',
+ {
+ RaiseError => 1,
+ PrintError => 1,
+ AutoCommit => 1,
+ };
+</PRE>
+<P>
+See also <A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Persistent_DB_Connections">Persistent DB Connections</A></H1></CENTER>
<P>
-Another popular use of mod_perl is to take advantage of it's persistence to
-maintain open database connections. The basic idea goes like so:
+Another popular use of mod_perl is to take advantage of its ability to
+maintain persistent open database connections. The basic approach is as
+follows:
<P>
<PRE> #Apache::Registry script
@@ -7645,37 +7914,34 @@
$dbh ||= SomeDbPackage->connect(...);
</PRE>
<P>
-Since <CODE>$dbh</CODE> is a global variable for the child, once the child
-has opened the connection it will use it over and over again, unless you
-perform <CODE>disconnect().</CODE>
+Since <CODE>$dbh</CODE> is a global variable for the child, once the child has opened the
+connection it will use it over and over again, unless you perform <CODE>disconnect()</CODE>.
<P>
Be careful to use different names for handlers if you open connection to
-different Databases!
+different databases!
<P>
-Apache::DBI - allows to make a persistent database connection. With this
-module enabled every connect request to plain DBI module will be forwarded
-to the Apache::DBI module. This looks if a database handle from a previous
-connect request is already stored and if this handle is still valid using
+<CODE>Apache::DBI</CODE> allows you to make a persistent database connection. With this module
+enabled, every connect request to the plain DBI module will be forwarded to
+the <CODE>Apache::DBI</CODE> module. This looks to see whether a database handle from a previous connect
+request has already been opened, and if this handle is still valid using
the ping method. If these two conditions are fulfilled it just returns the
database handle. If there is no appropriate database handle or if the ping
method fails, a new connection is established and the handle is stored for
-later re-use. <STRONG>There is no need to delete the disconnect statements from
-your code</STRONG>. They would not do anything because the Apache::DBI module overloads the
-disconnect method with a NOP. On child exit there is no explicit
-disconnect, the child dies and so does the database connection.
+later re-use. <STRONG>There is no need to delete the disconnect
+statements from your code</STRONG>. They will not do anything, as the
+<CODE>Apache::DBI</CODE> module overloads the disconnect method with a NOP. On child exit there is
+no explicit disconnect, the child dies and so does the database connection.
<P>
-The usage is simple:
+The usage is simple -- add to <CODE>httpd.conf</CODE>:
<P>
-<PRE> httpd.conf
- ----------
- PerlModule Apache::DBI
+<PRE> PerlModule Apache::DBI
</PRE>
<P>
-It is important, to load this module before any other ApacheDBI module !
+It is important, to load this module before any other <CODE>ApacheDBI*</CODE> module!
<P>
<PRE> a script.perl
@@ -7687,7 +7953,7 @@
{ autocommit => 0 }
) || die $DBI::errstr;
- ...rest of program
+ ...rest of the program
</PRE>
<P>
The module provides the additional method:
@@ -7698,41 +7964,40 @@
<P>
This can be used as a simple way to have apache children establish
connections on server startup. This call should be in a startup file
-(PerlModule, <Perl> or PerlRequire). It will establish a connection
-when a child is started in that child process. See the Apache::DBI manpage
-to see the requirements for this method.
+(PerlModule, <Perl> or PerlRequire). It will establish a connection when a child is
+started in that child process. See the <CODE>Apache::DBI</CODE>
+manpage to see the requirements for this method.
<P>
-However be warned that some old DBD drivers are not supporting this feature
-(ping method), so check the documentation of the driver you use.
+Beware however, as some old DBD drivers do not support this feature (ping
+method), so check the documentation of the driver you use.
<P>
-Another problem are timeouts: some databases disconnect the client after a
-certain time of inactivity. ping method ensures that this will not happen.
-Some DBD drivers don't have this method, check the Apache::DBI manpage to
-see how to write a ping method.
+Another problem is with timeouts: some databases disconnect the client
+after a certain time of inactivity. The ping method ensures that this will
+not happen. Some DBD drivers don't have this method, check the Apache::DBI
+manpage to see how to write a ping method.
<P>
-Also some folks at list suggested to change the timeout of the server (they
-talked specifically about mysql). So starting from 3.22.x you can set a
-wait_timeout option at mysqld server startup to change the default value,
-setting it to 24 hours probably will fix the timeout problem.
+Another approach is to change the client's connection timeout. Starting
+from mysql-3.22.x you can set a <CODE>wait_timeout</CODE>
+option at mysqld server startup to change the default value, setting it to
+36 hours probably would fix the timeout problem.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A></H1></CENTER>
<P>
-As you know <CODE>$|=1;</CODE> disables the buffering of the currently selected file handle (default is
-STDOUT). If you enable it, <CODE>ap_rflush()</CODE> is being called after
-each <CODE>print()</CODE>, unbuffering Apache's IO.
+As you know <CODE>$|=1;</CODE> disables the buffering of the currently selected file handle (default is <CODE>STDOUT</CODE>). If you enable it, <CODE>ap_rflush()</CODE>
+is called after each <CODE>print()</CODE>, unbuffering Apache's IO.
<P>
-If you are using a _bad_ style of output generating, which consist of
-multiply <CODE>print()</CODE> calls or you just have too many of them, you will experience a degradation
+If you are using a _bad_ style in generating output, which consist of
+multiple <CODE>print()</CODE> calls, or you just have too many of them, you will experience a degradation
in performance. The severity depends on the number of the calls.
<P>
-Many old CGIs were written in style of:
+Many old CGIs were written in the style of:
<P>
<PRE> print "<BODY BGCOLOR="black" TEXT="white">";
@@ -7743,9 +8008,9 @@
print "</BODY>";
</PRE>
<P>
-which reveals the following drawbacks: multiply <CODE>print()</CODE> calls - performance degradation with $|=1, backslashism which makes the
-code unreadable and difficulty to format the HTML to be easily readable as
-CGI's output. The code below solves them all:
+which reveals the following drawbacks: multiple <CODE>print()</CODE> calls - performance degradation with $|=1, backslashism which makes the
+code less readable and more difficult to format the HTML to be easily
+readable as CGI's output. The code below solves them all:
<P>
<PRE> print qq{
@@ -7758,7 +8023,7 @@
};
</PRE>
<P>
-I guess you see the difference. Be careful though, when printing the
+I guess you see the difference. Be careful though, when printing a
<CODE>&lt;HTML&gt;</CODE> tag. The correct way is:
<P>
@@ -7768,7 +8033,7 @@
}
</PRE>
<P>
-If you use the approach bellow:
+If you try the following:
<P>
<PRE> print qq{
@@ -7778,37 +8043,60 @@
}
</PRE>
<P>
-Some older browsers might not accept the output as HTML, and print it as a
-plain text, since they expect the first characters after the headers and
-empty line to be <CODE>&lt;HTML&gt;</CODE> and not spaces and/or additional newline and then <CODE>&lt;HTML&gt;</CODE>. Even if it works in your browser it might not work in other.
+Some older browsers might not accept the output as HTML, but rather print
+it as a plain text, since they expect the first characters after the
+headers and empty line to be <CODE>&lt;HTML&gt;</CODE> and not spaces and/or additional newline and then <CODE>&lt;HTML&gt;</CODE>. Even if it works with your browser, it might not work for others.
<P>
-Now let's go back to the <CODE>$|=1</CODE> topic. I still disable the buffering, for 2 reasons: I use few <CODE>print()</CODE> calls and I want my users to get the output immediately. So if I am about
+Now let's go back to the <CODE>$|=1</CODE> topic. I still disable buffering, for 2 reasons: I use few <CODE>print()</CODE> calls and I want my users to see the output immediately. So if I am about
to produce the results of the DB query, which might take some time to
-complete, I want user to get some headers which improves the usability of
-my site. Recall yourself - what do you like better: getting the output
-``slowly'' but steadily or having to watch the ``falling stars'' for awhile
-and then getting the whole output at once (if browser did not timeout till
-then).
+complete, I want users to get some titles ahead. This improves the
+usability of my site. Recall yourself:
+
+<P>
+What do you like better: getting the output ``slowly'' but steadily or
+having to watch the ``falling stars'' for awhile and then to receive the
+whole output at once (if the browser did not timeout till then).
+
+<P>
+Conclusion: Do not blindly follow suggestions, but think what is best for
+you in every given case.
<P>
-Conclusion: Do not follow blind suggestions but think what is best for you
-in every given case.
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A></H1></CENTER>
+<P>
+One of the important issues in improving the performance is reduction of
+memory usage - the less memory each server uses, the more server processes
+you can start, and thus the more performance you have (from the user's
+point of view - the response speed )
+
+<P>
+See <A HREF="././porting.html#Global_Variables">Global Variables</A>
+
+
+
+<P>
+See <A HREF="././porting.html#Memory_leakage">Memory "leakages"</A>
+
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Profiling">Profiling</A></H1></CENTER>
<P>
-Profiling will help you to determine which subroutines are using the most
-time and which subroutines are being called most often, then you will
-probably will want to optimize those, if your code is a way heavy.
+Profiling will help you to determine which subroutines or just snippets of
+code take the longest execution time and which subroutines are being called
+most often, then you will probably will want to optimize those, and to
+improve the code toward efficiency.
<P>
-It is possible to profile code run under mod_perl with the
-<CODE>Devel::DProf</CODE> module available on CPAN. However, you must have apache version 1.3b3 or
-higher and the PerlChildExitHandler enabled. When the server is started, <CODE>Devel::DProf</CODE> installs an END block to write the tmon.out file, which will be run when
-the server is shutdown. Here is how to start and stop a server with the
-profiler enabled:
+It is possible to profile code running under mod_perl with the
+<CODE>Devel::DProf</CODE> module, available on CPAN. However, you must have apache version 1.3b3 or
+higher and the <CODE>PerlChildExitHandler</CODE>
+enabled. When the server is started, <CODE>Devel::DProf</CODE> installs an
+<CODE>END</CODE> block to write the <CODE>tmon.out</CODE> file, which will be called at the server shutdown. Here is how to start and
+stop a server with the profiler enabled:
<P>
<PRE> % setenv PERL5OPT -d:DProf
@@ -7819,10 +8107,9 @@
% dprofpp
</PRE>
<P>
-The <CODE>Devel::DProf</CODE> package is a Perl code profiler. This will collect information on the
-execution time of a Perl script and of the subs in that script. This
-information can be used to determine which subroutines are using the most
-time and which subroutines are being called most often.
+The <CODE>Devel::DProf</CODE> package is a Perl code profiler. It will collect information on the
+execution time of a Perl script and of the subs in that script (remember
+that that <CODE>print()</CODE> and <CODE>map()</CODE> are subs as well, they come together with Perl!).
<P>
Another approach is to use <CODE>Apache::DProf</CODE>, which hooks
@@ -7841,7 +8128,7 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A></H1></CENTER>
<P>
-What approach is better?
+Which approach is better?
<P>
<PRE> use CGI;
@@ -7857,8 +8144,7 @@
</PRE>
<P>
There is not any performance benefit of using the object calls rather than
-the function calls, but there is a real memory hit when you import all of
-CGI.pm's function calls into the process memory. This can be significant,
+the function calls, but there is a real memory hit when you import all of <CODE>CGI.pm</CODE>'s function calls into your process memory. This can be significant,
particularly when there are many child daemons.
<P>
@@ -7896,7 +8182,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -7924,13 +8210,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Things obvious to others, but not to you</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -8754,13 +9037,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Runtime Warnings and Errors: Where and Why.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -8827,8 +9107,9 @@
<CENTER><H1><A NAME="Incorrect_line_number_reporting_">Incorrect line number reporting in error/warn log messages</A></H1></CENTER>
<P>
See <A HREF="././warnings.html#Use_of_uninitialized_value_at_e">Use of uninitialized value at (eval 80) line 12.</A>
-=head1 Incorrect line number reporting in error/warn log messages
+
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Value_of_x_will_not_stay_shared">Value of $x will not stay shared at - line 5</A></H1></CENTER>
@@ -9185,7 +9466,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -9213,13 +9494,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Controlling and Monitoring the Server</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -9249,7 +9527,7 @@
<LI><A HREF="#Starting_a_personal_server_for_e">Starting a personal server for each developer</A>
<LI><A HREF="#Wrapper_to_emulate_the_server_en">Wrapper to emulate the server environment</A>
<LI><A HREF="#Log_Rotation">Log Rotation</A>
- <LI><A HREF="#Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A>
+ <LI><A HREF="#Preventing_from_modperl_process_">Preventing from modperl process from going wild</A>
</UL>
<!-- INDEX END -->
@@ -10120,8 +10398,23 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A></H1></CENTER>
+<CENTER><H1><A NAME="Preventing_from_modperl_process_">Preventing from modperl process from going wild</A></H1></CENTER>
+<P>
+Sometimes calling an undefined subroutine in a module can cause a tight
+loop that consumes all memory. Here is a way to catch such errors. Define
+an autoload subroutine:
+
+<P>
+<PRE> sub UNIVERSAL::AUTOLOAD {
+ my $class = shift;
+ warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
+ }
+</PRE>
<P>
+It will produce a nice error in error_log, giving the line number of the
+call and the name of the undefined subroutine.
+
+<P>
Sometimes an error happens and causes the server to write millions of lines
into your error_log file and in a few minutes to put your server down on
its knees. For example I get an error <CODE>Callback called exit</CODE>
@@ -10183,7 +10476,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/15/1999
</FONT>
</B>
</TD>
@@ -10211,13 +10504,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Protecting Your Site</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -10480,13 +10770,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl and Relational Databases</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -10714,7 +11001,7 @@
Where 172800 secs equal to 48 hours. And it works.
<P>
-Note that starting from ver. <CODE>0.82</CODE>, <CODE>Apache::DBI</CODE> implements ping inside the <CODE>eval</CODE> block, so if the handle has been timouted, it should reconnect without
+Note that starting from ver. <CODE>0.82</CODE>, <CODE>Apache::DBI</CODE> implements ping inside the <CODE>eval</CODE> block, so if the handle has been timed out, it should reconnect without
creating the morning bug.
<P>
@@ -11642,7 +11929,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -11670,13 +11957,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl and dbm files</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -11915,7 +12199,7 @@
BEGIN {
# RCS/CVS complient: must be all one line, for MakeMaker
- $DB_File::Wrap::VERSION = do { my @r = (q$Revision: 1.13 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+ $DB_File::Wrap::VERSION = do { my @r = (q$Revision: 1.14 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
}
@@ -12163,13 +12447,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl for ISPs. mod_perl and Virtual Hosts.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -12426,13 +12707,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl Status. Peeking into the Server's Perl Innards</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -12618,13 +12896,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Debugging mod_perl</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -13007,13 +13282,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Workarounds for some known bugs in browsers.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -13131,13 +13403,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Apache::* modules</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -13190,11 +13459,11 @@
reference.
<P>
-What Apache::Session does is provide persistence to a data structure. The
-data structure has an ID number, and you can retrieve it by using the ID
-number. In the case of Apache, you would store the ID number in a cookie or
-the URL to associate it with one browser, but the method of dealing with
-the ID is completely up to you. The flow of things is generally:
+What <CODE>Apache::Session</CODE> does is provide persistence to a data structure. The data structure has an
+ID number, and you can retrieve it by using the ID number. In the case of
+Apache, you would store the ID number in a cookie or the URL to associate
+it with one browser, but the method of dealing with the ID is completely up
+to you. The flow of things is generally:
<P>
<PRE> Tie a session to Apache::Session.
@@ -13212,10 +13481,10 @@
End of Request 2.
</PRE>
<P>
-Using Apache::Session is easy: simply tie a hash to the session object,
-stick any data structure into the hash, and the data you put in
-automatically persists until the next invocation. Here is a quick example
-which uses cookies to track the user's session.
+Using <CODE>Apache::Session</CODE> is easy: simply tie a hash to the session object, stick any data structure
+into the hash, and the data you put in automatically persists until the
+next invocation. Here is a quick example which uses cookies to track the
+user's session.
<P>
<PRE> # Pull in the require packages
@@ -13248,27 +13517,27 @@
when the user invokes the next page.
<P>
-It is possible to write an Apache authen handler using Apache::Session. You
-can put your authentication token into the session. When a user invokes a
-page, you open their session, check to see if they have a valid token, and
-approve or deny their authorization based on that.
+It is possible to write an Apache authen handler using
+<CODE>Apache::Session</CODE>. You can put your authentication token into the session. When a user
+invokes a page, you open their session, check to see if they have a valid
+token, and approve or deny their authorization based on that.
<P>
As for IIS, let's compare. IIS's sessions are only valid on the same web
-server as the one that issued the session. Apache::Session's session
-objects can be shared amongst a farm of many machines running different
-operating systems, including even Win32. IIS stores session information in
-RAM. Apache::Session stores sessions in databases, file systems, or RAM.
-IIS's sessions are only good for storing scalars or arrays.
-Apache::Session's sessions allow you to store arbitrarily complex objects.
-IIS sets up the session and automatically tracks it for you. With
-Apache::Session, you setup and track the session yourself. IIS is
-proprietary. Apache::Session is open-source. Apache::Session::DBI can issue
-400+ session requests per second on light Celeron 300A running Linux. IIS?
+server as the one that issued the session.
+<CODE>Apache::Session</CODE>'s session objects can be shared amongst a farm of many machines running
+different operating systems, including even Win32. IIS stores session
+information in RAM. <CODE>Apache::Session</CODE>
+stores sessions in databases, file systems, or RAM. IIS's sessions are only
+good for storing scalars or arrays. <CODE>Apache::Session</CODE>'s sessions allow you to store arbitrarily complex objects. IIS sets up the
+session and automatically tracks it for you. With
+<CODE>Apache::Session</CODE>, you setup and track the session yourself. IIS is proprietary. <CODE>Apache::Session</CODE> is open-source.
+<CODE>Apache::Session::DBI</CODE> can issue 400+ session requests per second on light Celeron 300A running
+Linux. IIS?
<P>
-An alternative to Apache::Session is Apache::ASP, which has session
-tracking abilities. HTML::Embperl hooks into Apache::Session for you.
+An alternative to <CODE>Apache::Session</CODE> is Apache::ASP, which has session tracking abilities. HTML::Embperl hooks
+into <CODE>Apache::Session</CODE> for you.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -13296,13 +13565,11 @@
<P>
The Perl modules are simply a thin xs layer on top of libapreq, making them
-a lighter and faster alternative to CGI.pm and CGI::Cookie. See the
-Apache::Request and Apache::Cookie documentation for more details and
-eg/perl/ for examples.
+a lighter and faster alternative to CGI.pm and CGI::Cookie. See the <CODE>Apache::Request</CODE> and <CODE>Apache::Cookie</CODE> documentation for more details and eg/perl/ for examples.
<P>
-Apache::Request and the libapreq are tied tight to the Apache API, which
-there is no access to in a process running under mod_cgi.
+<CODE>Apache::Request</CODE> and the libapreq are tied tight to the Apache API, which there is no access
+to in a process running under mod_cgi.
<P>
Get it from CPAN at $CPAN/authors/id/DOUGM/libapreq-x.xx.tar.gz or from <A
@@ -13430,7 +13697,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/15/1999
</FONT>
</B>
</TD>
@@ -13458,13 +13725,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Perl Reference</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -13809,13 +14073,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Code Snippets</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -14107,13 +14368,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Choosing an Operating System and Hardware</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -14352,7 +14610,7 @@
<P><LI>
<P>
-Balance loading - users can remember only a name of one of your machines -
+Load balancing - users can remember only a name of one of your machines -
namely of your server, but it cannot stand the heavy load, so you use a
clustering approach, distributing the load over a number of machines. The
central server, the one users access when they type the name of the
@@ -14361,7 +14619,7 @@
users. One of the advantages is that you can take one of the machines down
for a repair or upgrade, and your service will still work - the main server
will not dispatch the requests to the machine that was taken down. I will
-just say that there are many load balancing techniques.
+just say that there are many load balancing techniques. (e.g. <A HREF="././download.html#">Eddieware</A>)
<P><LI>
<P>
@@ -14577,7 +14835,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -14605,13 +14863,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl Advocacy</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -14632,8 +14887,8 @@
<P><B><FONT SIZE=-1>Table of Contents:</FONT></B></P>
<UL>
- <LI><A HREF="#Thoughts_about_scalability">Thoughts about scalability</A>
- <LI><A HREF="#The_boss_and_the_developer">The boss and the developer</A>
+ <LI><A HREF="#Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A>
+ <LI><A HREF="#The_boss_the_developer_and_advo">The boss, the developer and advocacy</A>
</UL>
<!-- INDEX END -->
@@ -14650,67 +14905,71 @@
<HR>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<P>
+<CENTER><H1><A NAME="Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A></H1></CENTER>
<P>
-<CENTER><H1><A NAME="Thoughts_about_scalability">Thoughts about scalability</A></H1></CENTER>
+Your need for scalability and flexibility depends on your needs from the
+web. If you want only a simple guest book or Database gateway with no
+feature headroom, you can get away with any EASY_AND_FAST_TO_DEVELOP_TOOL
+(Exchange, MS IIS, Lotus Notes, etc).
+
+<P>
+Experience shows that you will soon want more functionality, that you'll
+start spending time learning the limitations of these ``easy'' tools.
+Gradually, your boss will ask for increasing functionality and at some
+point you'll realize that the tool lacks flexibility and/or scalability.
+Then your boss will either buy another EASY_AND_FAST_TO_DEVELOP_TOOL and
+repeat the process (with different unforseen problems), or you'll start
+investing time learning how to use a powerful, flexible tool to make the
+long-term development cycle easier.
+
<P>
-It depends on what you ought to do on the web. If all you want is a simple
-guest book or very simple DB gateway you can get away with any of
-EASY_AND_FAST_TO_DEVELOP_TOOLS (Exchange, MS IIS, Lotus Notes, etc). The
-problem is that as my experience shows, in short terms you will want more
-functionality, so you start looking for really creative ways to get this
-functionalily from these _easy_ tools, and when you make it if at all, your
-boss asks for even more functionality and then you understand that you have
-got no scalability and you have to port all your code to mod_perl or
-another powerful equivalent. Then you look back and see how much time and
-money was wasted with that EASY_AND_FAST_TO_DEVELOP_TOOLS.
-
-<P>
-The point is that if you are serious about Internet and script driven
-sites, sooner or later you will need a lot of flexibility and functionality
-from your script/code base. So you better choose a development platform
-with power of doing things your way at first place. While you might spend a
-little more time and money to learn the language and its concepts, and to
-code the basic skeleton, later code extension and modifications would be a
-snap.
+If you and your company are serious about delivering flexible Internet
+functionality, do your homework. Then urge your boss to invest a little
+extra time and resources to choose the right tool for the job. Your
+long-term Internet site will prove the results.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="The_boss_and_the_developer">The boss and the developer</A></H1></CENTER>
-<P>
-While there is a known factor of boss character in the life of developer,
-the developer should make an investigation work before he goes to ask for
-an approval to go with mod_perl. Personally, when I discovered mod_perl I
-did a lot of testing and coding at home and at work. Once I have had a
-working heavy application, I came to my boss with 2 URLs - one for the
-plain CGI server and the other for mod_perl enabled server. It took about
-30 secs for my boss to say: ``Go with it''. Of course the moment I did it,
-I have had to provide all the support for other developers, that is why I
-took my time to learn it in first place (that is how this guide was born!).
-
-<P>
-Most chances that you are doomed to failure if you are showing some very
-fast working site, and persuade your boss to give it a try but the moment
-you start to code/port the scripts your are getting stuck cause you are
-unfamiliar with mod_perl pecularities. If your boss follows your
-development process closely and sees you not making any progress, he might
-say - forget it, we fall back to old foo platform. And if this happens, you
-made the mistake twice - you are not developing under mod_perl and chances
-that your boss will give you and mod_perl a second chances are very little.
-
-<P>
-I am not here to discourage you to advocate mod_perl at your working place.
-I am here to warn you that if you want to advocate something, you cannot
-start doing this based on the naked facts. You have to learn the technology
-in subject in first place, get acquanted with the ways you can get helped
-in case of trouble. The ideal scenario would be to show your boss a heavy
-CGI which is running much faster under mod_perl, and when she gets
-impressed, ask for an evaluation time (I know that the chances you get it
-are not very high, that is why I called it ideal), argument the need for
-evaluation and studying time with an enormous time save-up in the future.
-When this time is out make sure you can provide the support for mod_perl or
-at least to be a connecting bridge between your organization and the
-mod_perl community.
+<CENTER><H1><A NAME="The_boss_the_developer_and_advo">The boss, the developer and advocacy</A></H1></CENTER>
+<P>
+Each developer has a boss who participates in the decision-making process.
+Remember that the boss considers input from sales people, developers, the
+media and associates before handing down large decisions. Of course,
+results count! A sales brochure makes very little impact compared to a
+working demonstration, and demonstrations of company-specific and
+developer-specific results count big!
+
+<P>
+Personally, when I discovered mod_perl I did a lot of testing and coding at
+home and at work. Once I had a working heavy application, I came to my boss
+with 2 URLs - one for the plain CGI server and the other for mod_perl
+enabled server. It took about 30 secs for my boss to say: `Go with it''. Of
+course the moment I did it, I have had to provide all the support for other
+developers, that is why I took my time to learn it in first place (that is
+how this guide was born!).
+<P>
+Chances are that if you've done your homework, you've learned the tools and
+you can deliver results, you'll have a successful project. If you convince
+your boss to try a tool that you don't know very well, your results may
+suffer. If your boss follows your development process closely and sees much
+worse than expected progress, he might say ``forget it'' and wish never to
+give mod_perl a second chance.
+
+<P>
+Advocacy is a great thing for the open-source software movement, but it's
+best done quietly until you have confidence that you can show productivity.
+If you can demonstrate to your boss a heavy CGI which is running much
+faster under mod_perl, that may be a strong argument for further
+evaluation. Your company may even sponsor a portion of your learning
+process.
+
+<P>
+Learn the technology by working on sample projects. Learn how to support
+yourself and learn how to get support from the community; then advocate
+your ideas to your boss. Then you'll have the knowledge; your company will
+have the benefit; and mod_perl will have the reputation it deserves.
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
The <a href="http://www.modperl.com/">
<B>Writing Apache Modules with Perl and C</B></a>
@@ -14734,7 +14993,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -14762,13 +15021,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Getting Helped and Further Learning</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -14820,13 +15076,12 @@
feel that your question is not yet answered, please ask the apache/mod_perl
mailing list to help you. But first try to browse the mailing list archive.
Most of the time you will find the answer for your question by searching
-the mailing archive, since there is a big chance someone else already have
-encountered the problem and found a solution for it. If you ignore this
-advice, do not be surprised if your question will be left unanswered - it
-bores people to answer the same question more than once. It does not mean
-that you should avoid asking questions. Just do not abuse the available
-help and <STRONG>RTFM</STRONG>
-before you call for <STRONG>HELP</STRONG>. (You have certainly heard the infamous fable of the shepherd boy and the
+the mailing archive, since there is a big chance someone else has already
+encountered the same problem and found a solution for it. If you ignore
+this advice, do not be surprised if your question will be left unanswered -
+it bores people to answer the same question more than once. It does not
+mean that you should avoid asking questions. Just do not abuse the
+available help and <STRONG>RTFM</STRONG> before you call for <STRONG>HELP</STRONG>. (You have certainly heard the infamous fable of the shepherd boy and the
wolves)
<P>
@@ -15104,7 +15359,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
@@ -15132,13 +15387,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Appendix A: Downloading software and documentation</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -15166,6 +15418,9 @@
<LI><A HREF="#Squid_Internet_Object_Cache">Squid - Internet Object Cache</A>
<LI><A HREF="#thttpd_tiny_turbo_throttling_H">thttpd - tiny/turbo/throttling HTTP server</A>
<LI><A HREF="#mod_proxy_add_forward">mod_proxy_add_forward</A>
+ <LI><A HREF="#httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A>
+ <LI><A HREF="#ab_ApacheBench">ab - ApacheBench</A>
+ <LI><A HREF="#Eddieware">Eddieware</A>
</UL>
<!-- INDEX END -->
@@ -15248,7 +15503,27 @@
HREF="ftp://ftp.netcetera.dk/pub/apache/">ftp://ftp.netcetera.dk/pub/apache/</A>
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A></H1></CENTER>
+<P>
+<A
+HREF="http://www.hpl.hp.com/personal/David_Mosberger/httperf.html">http://www.hpl.hp.com/personal/David_Mosberger/httperf.html</A>
+
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="ab_ApacheBench">ab - ApacheBench</A></H1></CENTER>
+<P>
+Comes within apache distribution.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Eddieware">Eddieware</A></H1></CENTER>
+<P>
+<A HREF="http://www.eddieware.org">http://www.eddieware.org</A>
+
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
The <a href="http://www.modperl.com/">
<B>Writing Apache Modules with Perl and C</B></a>
book can be purchased online from <a
@@ -15271,7 +15546,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.3 +4 -7 modperl-site/guide/browserbugs.html
Index: browserbugs.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/browserbugs.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- browserbugs.html 1999/05/17 20:47:31 1.2
+++ browserbugs.html 1999/06/19 21:15:02 1.3
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Workarounds for some known bugs in browsers.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.15 +4 -7 modperl-site/guide/config.html
Index: config.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/config.html,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- config.html 1999/06/05 17:47:11 1.14
+++ config.html 1999/06/19 21:15:02 1.15
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Server Configuration</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.15 +22 -10 modperl-site/guide/control.html
Index: control.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/control.html,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- control.html 1999/06/05 17:47:12 1.14
+++ control.html 1999/06/19 21:15:02 1.15
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Controlling and Monitoring the Server</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -38,7 +35,7 @@
<LI><A HREF="#Starting_a_personal_server_for_e">Starting a personal server for each developer</A>
<LI><A HREF="#Wrapper_to_emulate_the_server_en">Wrapper to emulate the server environment</A>
<LI><A HREF="#Log_Rotation">Log Rotation</A>
- <LI><A HREF="#Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A>
+ <LI><A HREF="#Preventing_from_modperl_process_">Preventing from modperl process from going wild</A>
</UL>
<!-- INDEX END -->
@@ -909,8 +906,23 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A></H1></CENTER>
+<CENTER><H1><A NAME="Preventing_from_modperl_process_">Preventing from modperl process from going wild</A></H1></CENTER>
<P>
+Sometimes calling an undefined subroutine in a module can cause a tight
+loop that consumes all memory. Here is a way to catch such errors. Define
+an autoload subroutine:
+
+<P>
+<PRE> sub UNIVERSAL::AUTOLOAD {
+ my $class = shift;
+ warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
+ }
+</PRE>
+<P>
+It will produce a nice error in error_log, giving the line number of the
+call and the name of the undefined subroutine.
+
+<P>
Sometimes an error happens and causes the server to write millions of lines
into your error_log file and in a few minutes to put your server down on
its knees. For example I get an error <CODE>Callback called exit</CODE>
@@ -972,7 +984,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/15/1999
</FONT>
</B>
</TD>
1.4 +6 -9 modperl-site/guide/databases.html
Index: databases.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/databases.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- databases.html 1999/06/05 17:47:12 1.3
+++ databases.html 1999/06/19 21:15:03 1.4
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl and Relational Databases</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -236,7 +233,7 @@
Where 172800 secs equal to 48 hours. And it works.
<P>
-Note that starting from ver. <CODE>0.82</CODE>, <CODE>Apache::DBI</CODE> implements ping inside the <CODE>eval</CODE> block, so if the handle has been timouted, it should reconnect without
+Note that starting from ver. <CODE>0.82</CODE>, <CODE>Apache::DBI</CODE> implements ping inside the <CODE>eval</CODE> block, so if the handle has been timed out, it should reconnect without
creating the morning bug.
<P>
@@ -1164,7 +1161,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.4 +4 -7 modperl-site/guide/dbm.html
Index: dbm.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/dbm.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dbm.html 1999/06/05 17:47:12 1.3
+++ dbm.html 1999/06/19 21:15:03 1.4
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl and dbm files</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -247,7 +244,7 @@
BEGIN {
# RCS/CVS complient: must be all one line, for MakeMaker
- $DB_File::Wrap::VERSION = do { my @r = (q$Revision: 1.3 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
+ $DB_File::Wrap::VERSION = do { my @r = (q$Revision: 1.4 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };
}
1.13 +4 -7 modperl-site/guide/debug.html
Index: debug.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/debug.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- debug.html 1999/06/05 17:47:13 1.12
+++ debug.html 1999/06/19 21:15:03 1.13
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Debugging mod_perl</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.3 +28 -8 modperl-site/guide/download.html
Index: download.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/download.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- download.html 1999/05/17 20:47:32 1.2
+++ download.html 1999/06/19 21:15:03 1.3
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Appendix A: Downloading software and documentation</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -36,6 +33,9 @@
<LI><A HREF="#Squid_Internet_Object_Cache">Squid - Internet Object Cache</A>
<LI><A HREF="#thttpd_tiny_turbo_throttling_H">thttpd - tiny/turbo/throttling HTTP server</A>
<LI><A HREF="#mod_proxy_add_forward">mod_proxy_add_forward</A>
+ <LI><A HREF="#httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A>
+ <LI><A HREF="#ab_ApacheBench">ab - ApacheBench</A>
+ <LI><A HREF="#Eddieware">Eddieware</A>
</UL>
<!-- INDEX END -->
@@ -118,6 +118,26 @@
HREF="ftp://ftp.netcetera.dk/pub/apache/">ftp://ftp.netcetera.dk/pub/apache/</A>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A></H1></CENTER>
+<P>
+<A
+HREF="http://www.hpl.hp.com/personal/David_Mosberger/httperf.html">http://www.hpl.hp.com/personal/David_Mosberger/httperf.html</A>
+
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="ab_ApacheBench">ab - ApacheBench</A></H1></CENTER>
+<P>
+Comes within apache distribution.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Eddieware">Eddieware</A></H1></CENTER>
+<P>
+<A HREF="http://www.eddieware.org">http://www.eddieware.org</A>
+
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
The <a href="http://www.modperl.com/">
<B>Writing Apache Modules with Perl and C</B></a>
@@ -141,7 +161,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.5 +4 -7 modperl-site/guide/frequent.html
Index: frequent.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/frequent.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- frequent.html 1999/05/08 17:46:30 1.4
+++ frequent.html 1999/06/19 21:15:03 1.5
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Frequent mod_perl problems</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.7 +803 -683 modperl-site/guide/guide-src.tar.gz
<<Binary file>>
1.8 +1298 -1295modperl-site/guide/guide.tar.gz
<<Binary file>>
1.3 +7 -10 modperl-site/guide/hardware.html
Index: hardware.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/hardware.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- hardware.html 1999/06/05 17:47:17 1.2
+++ hardware.html 1999/06/19 21:15:09 1.3
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Choosing an Operating System and Hardware</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -247,7 +244,7 @@
<P><LI>
<P>
-Balance loading - users can remember only a name of one of your machines -
+Load balancing - users can remember only a name of one of your machines -
namely of your server, but it cannot stand the heavy load, so you use a
clustering approach, distributing the load over a number of machines. The
central server, the one users access when they type the name of the
@@ -256,7 +253,7 @@
users. One of the advantages is that you can take one of the machines down
for a repair or upgrade, and your service will still work - the main server
will not dispatch the requests to the machine that was taken down. I will
-just say that there are many load balancing techniques.
+just say that there are many load balancing techniques. (e.g. <A HREF="././download.html#">Eddieware</A>)
<P><LI>
<P>
@@ -472,7 +469,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.14 +11 -15 modperl-site/guide/help.html
Index: help.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/help.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- help.html 1999/06/05 17:47:18 1.13
+++ help.html 1999/06/19 21:15:09 1.14
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Getting Helped and Further Learning</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -60,13 +57,12 @@
feel that your question is not yet answered, please ask the apache/mod_perl
mailing list to help you. But first try to browse the mailing list archive.
Most of the time you will find the answer for your question by searching
-the mailing archive, since there is a big chance someone else already have
-encountered the problem and found a solution for it. If you ignore this
-advice, do not be surprised if your question will be left unanswered - it
-bores people to answer the same question more than once. It does not mean
-that you should avoid asking questions. Just do not abuse the available
-help and <STRONG>RTFM</STRONG>
-before you call for <STRONG>HELP</STRONG>. (You have certainly heard the infamous fable of the shepherd boy and the
+the mailing archive, since there is a big chance someone else has already
+encountered the same problem and found a solution for it. If you ignore
+this advice, do not be surprised if your question will be left unanswered -
+it bores people to answer the same question more than once. It does not
+mean that you should avoid asking questions. Just do not abuse the
+available help and <STRONG>RTFM</STRONG> before you call for <STRONG>HELP</STRONG>. (You have certainly heard the infamous fable of the shepherd boy and the
wolves)
<P>
@@ -344,7 +340,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.17 +32 -21 modperl-site/guide/index.html
Index: index.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/index.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- index.html 1999/06/05 17:47:19 1.16
+++ index.html 1999/06/19 21:15:09 1.17
@@ -27,8 +27,8 @@
<CENTER><P><B>Deploying mod_perl technology to give a rocket speed
to your CGI/perl scripts.</B></P></CENTER>
-<CENTER><P><B>Version 1.12
- Jun, 5 1999</B></P></CENTER>
+<CENTER><P><B>Version 1.13
+ Jun, 19 1999</B></P></CENTER>
<P>
<HR WIDTH="100%"></P>
@@ -70,6 +70,14 @@
<UL>
<LI><A HREF="scenario.html#Before_you_dive_into_the_gory_de">Before you dive into the gory details</A>
+ <LI><A HREF="scenario.html#Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A>
+ <UL>
+
+ <LI><A HREF="scenario.html#Installation_in_10_lines">Installation in 10 lines</A>
+ <LI><A HREF="scenario.html#Installation_in_10_paragraphs">Installation in 10 paragraphs</A>
+ <LI><A HREF="scenario.html#Configuration_Process">Configuration Process</A>
+ </UL>
+
<LI><A HREF="scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
<UL>
@@ -208,19 +216,15 @@
<LI><A HREF="porting.html#Turning_warnings_ON">Turning warnings ON</A>
<LI><A HREF="porting.html#diagnostics_pragma">diagnostics pragma</A>
<LI><A HREF="porting.html#Global_Variables">Global Variables</A>
+ <LI><A HREF="porting.html#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="porting.html#Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A>
<LI><A HREF="porting.html#Memory_leakage">Memory leakage</A>
</UL>
- <LI><A HREF="porting.html#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="porting.html#Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A>
- <UL>
-
- <LI><A HREF="porting.html#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
- <LI><A HREF="porting.html#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
- <LI><A HREF="porting.html#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
- </UL>
-
+ <LI><A HREF="porting.html#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
+ <LI><A HREF="porting.html#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
+ <LI><A HREF="porting.html#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
<LI><A HREF="porting.html#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="porting.html#Finding_the_line_number_the_erro">Finding the line number the error/warning has been triggered at</A>
<LI><A HREF="porting.html#Forking_subprocesses_from_mod_pe">Forking subprocesses from mod_perl</A>
@@ -235,12 +239,10 @@
<LI><A HREF="performance.html#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A>
</UL>
- <LI><A HREF="performance.html#Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A>
- <LI><A HREF="performance.html#Memory_sharing">Memory sharing</A>
<LI><A HREF="performance.html#Preload_Registry_Scripts">Preload Registry Scripts</A>
+ <LI><A HREF="performance.html#Sharing_Memory">Sharing Memory</A>
<LI><A HREF="performance.html#Avoid_Importing_Functions">Avoid Importing Functions</A>
- <LI><A HREF="performance.html#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
- <LI><A HREF="performance.html#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
+ <LI><A HREF="performance.html#How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="performance.html#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="performance.html#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -264,8 +266,10 @@
<LI><A HREF="performance.html#Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A>
</UL>
+ <LI><A HREF="performance.html#Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A>
<LI><A HREF="performance.html#Persistent_DB_Connections">Persistent DB Connections</A>
<LI><A HREF="performance.html#Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A>
+ <LI><A HREF="performance.html#More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A>
<LI><A HREF="performance.html#Profiling">Profiling</A>
<LI><A HREF="performance.html#CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A>
<LI><A HREF="performance.html#Sending_plain_HTML_as_a_compress">Sending plain HTML as a compressed output</A>
@@ -334,7 +338,7 @@
<LI><A HREF="control.html#Starting_a_personal_server_for_e">Starting a personal server for each developer</A>
<LI><A HREF="control.html#Wrapper_to_emulate_the_server_en">Wrapper to emulate the server environment</A>
<LI><A HREF="control.html#Log_Rotation">Log Rotation</A>
- <LI><A HREF="control.html#Preventing_from_modperl_process_">Preventing from modperl process to eat up all the disk's space, when it goes wild.</A>
+ <LI><A HREF="control.html#Preventing_from_modperl_process_">Preventing from modperl process from going wild</A>
</UL>
<P><LI><A HREF="security.html"><B><FONT SIZE=+1>Protecting Your Site</FONT></B></A></LI><P>
<UL>
@@ -490,8 +494,8 @@
<P><LI><A HREF="advocacy.html"><B><FONT SIZE=+1>mod_perl Advocacy</FONT></B></A></LI><P>
<UL>
- <LI><A HREF="advocacy.html#Thoughts_about_scalability">Thoughts about scalability</A>
- <LI><A HREF="advocacy.html#The_boss_and_the_developer">The boss and the developer</A>
+ <LI><A HREF="advocacy.html#Thoughts_about_scalability_and_f">Thoughts about scalability and flexibility</A>
+ <LI><A HREF="advocacy.html#The_boss_the_developer_and_advo">The boss, the developer and advocacy</A>
</UL>
<P><LI><A HREF="help.html"><B><FONT SIZE=+1>Getting Helped and Further Learning</FONT></B></A></LI><P>
<UL>
@@ -515,6 +519,9 @@
<LI><A HREF="download.html#Squid_Internet_Object_Cache">Squid - Internet Object Cache</A>
<LI><A HREF="download.html#thttpd_tiny_turbo_throttling_H">thttpd - tiny/turbo/throttling HTTP server</A>
<LI><A HREF="download.html#mod_proxy_add_forward">mod_proxy_add_forward</A>
+ <LI><A HREF="download.html#httperf_webserver_Benchmarking">httperf - webserver Benchmarking tool</A>
+ <LI><A HREF="download.html#ab_ApacheBench">ab - ApacheBench</A>
+ <LI><A HREF="download.html#Eddieware">Eddieware</A>
</UL>
<P>
@@ -530,9 +537,13 @@
<LI><A HREF="#search"><B>Search perl.apache.org along with this guide</B></A></LI>
-<LI><B>Download all files <A HREF="guide.tar.gz">guide.tar.gz</A>
-or sources and build scripts
-<A HREF="guide-src.tar.gz">guide-src.tar.gz</A></B></LI>
+<LI><B>Download</B>
+ <UL>
+ <LI> All HTML files (<A HREF="guide.tar.gz">guide.tar.gz</A>)
+ <LI> Postscript Book (<A HREF="mod_perl_guide.ps.gz">mod_perl_guide.ps.gz</A>)
+ <LI> POD sources and build scripts (<A HREF="guide-src.tar.gz">guide-src.tar.gz</A>)
+ </UL>
+</LI>
</UL>
@@ -573,7 +584,7 @@
<TR ALIGN=CENTER VALIGN=TOP>
<TD ALIGN=CENTER VALIGN=CENTER><B><FONT SIZE=-1>Written by <A
-HREF="help.html#This_document_s_Author">Stas Bekman</A>.<BR> Last Modified at 06/05/1999
+HREF="help.html#This_document_s_Author">Stas Bekman</A>.<BR> Last Modified at 06/19/1999
</FONT></B></TD>
<TD><A HREF="http://perl.apache.org"><IMG SRC="images/mod_perl2.jpg" BORDER=0 ALT="Mod Perl Icon" BORDER=0 HEIGHT=59 WIDTH=150></A>
1.4 +14 -12 modperl-site/guide/install.html
Index: install.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/install.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- install.html 1999/06/05 17:47:19 1.3
+++ install.html 1999/06/19 21:15:10 1.4
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Installation Notes</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -167,14 +164,19 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Testing_by_checking_the_error_lo">Testing by checking the error_log file</A></H2></CENTER>
<P>
-<PRE> [Thu Dec 3 17:27:52 1998] [notice] Apache/1.3.1 (Unix) mod_perl/1.15 configured -- resuming normal operations
+When starting the server, just check the <CODE>error_log</CODE> file for this:
+
+<P>
+<PRE> [Thu Dec 3 17:27:52 1998] [notice] Apache/1.3.1 (Unix) mod_perl/1.15 configured
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ -- resuming normal operations
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Testing_by_viewing_perl_status">Testing by viewing /perl-status</A></H2></CENTER>
<P>
-Assuming that you have configured the <CODE><Location /perl-status</CODE>> Section in the server configuration file (refer to
+Assuming that you have configured the <<CODE>Location /perl-status</CODE>>
+Section in the server configuration file (refer to
<A HREF="././config.html#">ModPerlConfiguration</A>), fetch: <A
HREF="http://www.yourserver.com/perl-status">http://www.yourserver.com/perl-status</A>
using your favorite Netscape browser :-)
@@ -219,8 +221,8 @@
<P>
However, just because you have got mod_perl linked in there, that does not
-meant that you have your server configured to use mod_perl to handle Perl
-scripts. You will find the configuration assistance at
+mean that you have configured your server to handle Perl scripts with
+mod_perl. You will find the configuration assistance at
<A HREF="././config.html#">ModPerlConfiguration</A>
@@ -498,7 +500,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/12/1999
</FONT>
</B>
</TD>
1.11 +6 -9 modperl-site/guide/intro.html
Index: intro.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/intro.html,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- intro.html 1999/05/17 20:47:36 1.10
+++ intro.html 1999/06/19 21:15:10 1.11
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Introduction. Incentives. Credits.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -262,7 +259,7 @@
<P><LI><STRONG><A NAME="item_Tzvetan">Tzvetan Stoyanov</A></STRONG>
<P><LI><STRONG><A NAME="item_Ulrich">Ulrich Pfeifer</A></STRONG>
<P><LI>
-<P><LI><STRONG><A NAME="item_Did">Did I miss you? Tell me!</A></STRONG>
+<P><LI><STRONG><A NAME="item_Did">Did I miss your name? Tell me!</A></STRONG>
</UL>
<P>
I want to thank all the people who donated their time and efforts to make
@@ -294,7 +291,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 05/15/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.5 +33 -38 modperl-site/guide/modules.html
Index: modules.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/modules.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- modules.html 1999/06/05 17:47:20 1.4
+++ modules.html 1999/06/19 21:15:11 1.5
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Apache::* modules</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -61,11 +58,11 @@
reference.
<P>
-What Apache::Session does is provide persistence to a data structure. The
-data structure has an ID number, and you can retrieve it by using the ID
-number. In the case of Apache, you would store the ID number in a cookie or
-the URL to associate it with one browser, but the method of dealing with
-the ID is completely up to you. The flow of things is generally:
+What <CODE>Apache::Session</CODE> does is provide persistence to a data structure. The data structure has an
+ID number, and you can retrieve it by using the ID number. In the case of
+Apache, you would store the ID number in a cookie or the URL to associate
+it with one browser, but the method of dealing with the ID is completely up
+to you. The flow of things is generally:
<P>
<PRE> Tie a session to Apache::Session.
@@ -83,10 +80,10 @@
End of Request 2.
</PRE>
<P>
-Using Apache::Session is easy: simply tie a hash to the session object,
-stick any data structure into the hash, and the data you put in
-automatically persists until the next invocation. Here is a quick example
-which uses cookies to track the user's session.
+Using <CODE>Apache::Session</CODE> is easy: simply tie a hash to the session object, stick any data structure
+into the hash, and the data you put in automatically persists until the
+next invocation. Here is a quick example which uses cookies to track the
+user's session.
<P>
<PRE> # Pull in the require packages
@@ -119,27 +116,27 @@
when the user invokes the next page.
<P>
-It is possible to write an Apache authen handler using Apache::Session. You
-can put your authentication token into the session. When a user invokes a
-page, you open their session, check to see if they have a valid token, and
-approve or deny their authorization based on that.
+It is possible to write an Apache authen handler using
+<CODE>Apache::Session</CODE>. You can put your authentication token into the session. When a user
+invokes a page, you open their session, check to see if they have a valid
+token, and approve or deny their authorization based on that.
<P>
As for IIS, let's compare. IIS's sessions are only valid on the same web
-server as the one that issued the session. Apache::Session's session
-objects can be shared amongst a farm of many machines running different
-operating systems, including even Win32. IIS stores session information in
-RAM. Apache::Session stores sessions in databases, file systems, or RAM.
-IIS's sessions are only good for storing scalars or arrays.
-Apache::Session's sessions allow you to store arbitrarily complex objects.
-IIS sets up the session and automatically tracks it for you. With
-Apache::Session, you setup and track the session yourself. IIS is
-proprietary. Apache::Session is open-source. Apache::Session::DBI can issue
-400+ session requests per second on light Celeron 300A running Linux. IIS?
+server as the one that issued the session.
+<CODE>Apache::Session</CODE>'s session objects can be shared amongst a farm of many machines running
+different operating systems, including even Win32. IIS stores session
+information in RAM. <CODE>Apache::Session</CODE>
+stores sessions in databases, file systems, or RAM. IIS's sessions are only
+good for storing scalars or arrays. <CODE>Apache::Session</CODE>'s sessions allow you to store arbitrarily complex objects. IIS sets up the
+session and automatically tracks it for you. With
+<CODE>Apache::Session</CODE>, you setup and track the session yourself. IIS is proprietary. <CODE>Apache::Session</CODE> is open-source.
+<CODE>Apache::Session::DBI</CODE> can issue 400+ session requests per second on light Celeron 300A running
+Linux. IIS?
<P>
-An alternative to Apache::Session is Apache::ASP, which has session
-tracking abilities. HTML::Embperl hooks into Apache::Session for you.
+An alternative to <CODE>Apache::Session</CODE> is Apache::ASP, which has session tracking abilities. HTML::Embperl hooks
+into <CODE>Apache::Session</CODE> for you.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -167,13 +164,11 @@
<P>
The Perl modules are simply a thin xs layer on top of libapreq, making them
-a lighter and faster alternative to CGI.pm and CGI::Cookie. See the
-Apache::Request and Apache::Cookie documentation for more details and
-eg/perl/ for examples.
+a lighter and faster alternative to CGI.pm and CGI::Cookie. See the <CODE>Apache::Request</CODE> and <CODE>Apache::Cookie</CODE> documentation for more details and eg/perl/ for examples.
<P>
-Apache::Request and the libapreq are tied tight to the Apache API, which
-there is no access to in a process running under mod_cgi.
+<CODE>Apache::Request</CODE> and the libapreq are tied tight to the Apache API, which there is no access
+to in a process running under mod_cgi.
<P>
Get it from CPAN at $CPAN/authors/id/DOUGM/libapreq-x.xx.tar.gz or from <A
@@ -301,7 +296,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/15/1999
</FONT>
</B>
</TD>
1.5 +4 -7 modperl-site/guide/multiuser.html
Index: multiuser.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/multiuser.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- multiuser.html 1999/06/05 17:47:21 1.4
+++ multiuser.html 1999/06/19 21:15:11 1.5
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl for ISPs. mod_perl and Virtual Hosts.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.14 +4 -7 modperl-site/guide/obvious.html
Index: obvious.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/obvious.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- obvious.html 1999/06/05 17:47:21 1.13
+++ obvious.html 1999/06/19 21:15:11 1.14
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Things obvious to others, but not to you</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.16 +514 -458 modperl-site/guide/performance.html
Index: performance.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/performance.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- performance.html 1999/06/05 17:47:22 1.15
+++ performance.html 1999/06/19 21:15:12 1.16
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Performance. Benchmarks.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -35,12 +32,10 @@
<LI><A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A>
</UL>
- <LI><A HREF="#Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A>
- <LI><A HREF="#Memory_sharing">Memory sharing</A>
<LI><A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>
+ <LI><A HREF="#Sharing_Memory">Sharing Memory</A>
<LI><A HREF="#Avoid_Importing_Functions">Avoid Importing Functions</A>
- <LI><A HREF="#Reducing_the_Memory_Usage">Reducing the Memory Usage</A>
- <LI><A HREF="#how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A>
+ <LI><A HREF="#How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A>
<LI><A HREF="#Limiting_the_size_of_the_process">Limiting the size of the processes</A>
<LI><A HREF="#Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A>
<LI><A HREF="#Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A>
@@ -64,8 +59,10 @@
<LI><A HREF="#Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A>
</UL>
+ <LI><A HREF="#Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A>
<LI><A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>
<LI><A HREF="#Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A>
+ <LI><A HREF="#More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A>
<LI><A HREF="#Profiling">Profiling</A>
<LI><A HREF="#CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A>
<LI><A HREF="#Sending_plain_HTML_as_a_compress">Sending plain HTML as a compressed output</A>
@@ -88,28 +85,43 @@
<P>
<CENTER><H1><A NAME="Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A></H1></CENTER>
<P>
-Use the PerlRequire and PerlModule directives to load commonly used modules
-such as CGI.pm, DBI, etc., when the server is started. On most systems,
-server children will be able to share this space.
+Use the <CODE>PerlRequire</CODE> and <CODE>PerlModule</CODE> directives to load commonly used modules such as <CODE>CGI.pm</CODE>, <CODE>DBI</CODE> and etc., when the server is started. On most systems, server children will
+be able to share the code space used by these modules. Just add the
+following directives into <CODE>httpd.conf</CODE>:
<P>
-You can also put the standard <CODE>use Foo;</CODE> into the startup-file.
+<PRE> PerlModule CGI;
+ PerlModule DBI;
+</PRE>
+<P>
+But even better to create a separate startup file (with regular perl code)
+and put there things like:
<P>
-CGI.pm is a special one. Ordinarily CGI.pm autoloads most of its functions
-on an as-needed basis. This speeds up the loading time by deferring the
-compilation phase. However, if you are using mod_perl, FastCGI or another
-system that uses a persistent Perl interpreter, you will want to precompile
-the methods at initialization time. To accomplish this, call the package
-function <CODE>compile()</CODE> like this:
+<PRE> use DBI;
+ use Carp;
+</PRE>
+<P>
+Then you <CODE>require()</CODE> this file with help of <CODE>PerlRequire</CODE> directive from <CODE>httpd.conf</CODE>, before the rest of the mod_perl configuration directives:
<P>
+<PRE> PerlRequire /path/to/start-up.pl
+</PRE>
+<P>
+<CODE>CGI.pm</CODE> is a special case. Ordinarily <CODE>CGI.pm</CODE> autoloads most of its functions on an as-needed basis. This speeds up the
+loading time by deferring the compilation phase. However, if you are using
+mod_perl, FastCGI or another system that uses a persistent Perl
+interpreter, you will want to precompile the methods at initialization
+time. To accomplish this, call the package function <CODE>compile()</CODE>
+like this:
+
+<P>
<PRE> use CGI ();
CGI->compile(':all');
</PRE>
<P>
The arguments to <CODE>compile()</CODE> are a list of method names or sets, and are identical to those accepted by
-the use operator.
+the use operator. Note that in most cases you will want to replace <CODE>':all'</CODE> with the tags' names you really use in your code.
<P>
You can also preload the Registry scripts. See <A HREF="#Preload_Registry_Scripts">Preload Registry Scripts</A>.
@@ -119,37 +131,17 @@
<CENTER><H2><A NAME="Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A></H2></CENTER>
<P>
I have conducted a few tests to benchmark the memory usage when some
-modules are preloaded. First set of tests checks the memory use with
-Library Perl Module preload (only CGI.pm). The second set checks the
-compile method of CGI.pm. The third test checks benefit the the Library
-Perl Module preload but a few of them (too see more memory saved) and also
-the effect of precompiling the Registry modules with
-Apache::RegistryLoader.
-
-<P>
-Summary:
-
-<P>
-1. Library Perl Modules Preloading gave a good results everywhere.
-
-<P>
-2. compile method of CGI seems to make things worse (may be the speed is
-better?)
-
-<P>
-3. Apache::RegistryLoader might made the script load faster on the first
-request after the child has just started but the memory usage was worse!!!
-See the numbers by yourself.
-
-<P>
-HW/SW: The server is apache 1.3.2, mod_perl 1.16 running on AIX 4.1.5
+modules are preloaded. The first set of tests checks the memory use with
+Library Perl Module preload (only <CODE>CGI.pm</CODE>). The second set checks the compile method of <CODE>CGI.pm</CODE>. The third test checks the benefit of Library Perl Module preload but a
+few of them (to see more memory saved) and also the effect of precompiling
+the Registry modules with <CODE>Apache::RegistryLoader</CODE>.
<P>
--------------------------------------------------------------------------------
<P>
-1. In the first test was used a script:
+1. In the first test, the following script was used:
<P>
<PRE> use strict;
@@ -162,7 +154,7 @@
<Server restarted>
<P>
-Before the CGI.pm preload: (No other modules preloaded)
+Before the <CODE>CGI.pm</CODE> preload: (No other modules preloaded)
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -184,7 +176,7 @@
<Server restarted>
<P>
-After the CGI.pm preload:
+After the <CODE>CGI.pm</CODE> preload:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -207,7 +199,7 @@
<Server restarted>
<P>
-After CGI.pm preloaded and compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> preloaded and compiled with CGI->compile(':all');
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -224,8 +216,10 @@
</PRE>
<P>
Observation: child httpd has grown up by 1172K No change! So what does
-CGI->compile(':all') helps? I guess it helps if you import the symbols
-(subs) rather you use the methods
+CGI->compile(':all') help? I think it's because we never use all of the
+methods CGI provides - so in real use it's faster. So you might want to
+compile only the tags you are about to use - then you will benefit for
+sure.
<P>
--------------------------------------------------------------------------------
@@ -235,14 +229,15 @@
2. I have tried the second test to find it. I run the script:
<P>
-use strict; use CGI <CODE>qw(:all);</CODE> print
-header,start_html,p(``Hello'');
-
+<PRE> use strict;
+ use CGI qw(:all);
+ print header,start_html,p("Hello");
+</PRE>
<P>
<Server restarted>
<P>
-After CGI.pm preloaded and NOT compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> was preloaded and NOT compiled with CGI->compile(':all'):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -250,7 +245,7 @@
httpd 86904 0.0 0.0 1688 1800 - A 18:02:49 0:00 httpd
</PRE>
<P>
-After running a script which imports symbols, all of them
+After running a script which imports symbols (all of them):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -264,7 +259,7 @@
<Server restarted>
<P>
-After CGI.pm preloaded and compiled with CGI->compile(':all');
+After <CODE>CGI.pm</CODE> was preloaded and compiled with CGI->compile(':all'):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -272,7 +267,7 @@
httpd 99104 0.0 0.0 3064 1768 - A 17:59:52 0:00 httpd
</PRE>
<P>
-After running a script which imports symbols, all of them
+After running a script which imports symbols (all of them):
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -280,29 +275,32 @@
httpd 99104 0.0 1.0 4884 3636 - A 17:59:52 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 1868K. Why? Isn't
-CGI->compile(':all') supposed to make children to share the compiled
-code with parent?
+Observation: child httpd has grown by 1868K. Why? Isn't
+<CODE>CGI::compile(':all')</CODE> supposed to make children to share the compiled code with parent? It does
+works as advertised, but if you pay attention in the code we have called
+only three <CODE>CGI.pm</CODE>'s methods - just saying <CODE>use CGI qw(:all)</CODE> doesn't mean we compile the all available methods - we just import their
+names. So actually this test is misleading. Execute <CODE>compile()</CODE> only on the methods you are actually using and then you will see the
+difference.
<P>
--------------------------------------------------------------------------------
<P>
-3. The third script
+3. The third script:
<P>
<PRE> use strict;
use CGI;
use Data::Dumper;
- use Storable;
+ use Storable;
[and many lines of code, lots of globals - so the code is huge!]
</PRE>
<P>
<Server restarted>
<P>
-Nothing preloaded at startup
+Nothing preloaded at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -310,7 +308,7 @@
httpd 86870 0.0 0.0 1304 1784 - A 17:16:45 0:00 httpd
</PRE>
<P>
-Script using CGI (methods), Storable, Data::Dumper called
+Script using CGI (methods), Storable, Data::Dumper called:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -318,13 +316,13 @@
httpd 86870 0.0 1.0 4024 4548 - A 17:16:45 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 2764K
+Observation: child httpd has grown by 2764K
<P>
<Server restarted>
<P>
-Preloaded CGI (compiled), Storable, Data::Dumper at startup
+Preloaded CGI (compiled), Storable, Data::Dumper at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -340,15 +338,14 @@
httpd 91052 0.0 1.0 6568 5040 - A 17:19:21 0:00 httpd
</PRE>
<P>
-Observation: child httpd has grown up by 3276K. Great different: 512K
-less!!!
+Observation: child httpd has grown by 3276K. Great difference: 512K less!!!
<P>
<Server restarted>
<P>
All the above modules + the above script PreCompiled with
-Apache::RegistryLoader at startup
+<CODE>Apache::RegistryLoader</CODE> at startup:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -356,7 +353,7 @@
httpd 26844 0.0 0.0 3488 1776 - A 17:23:12 0:00 httpd
</PRE>
<P>
-Script using CGI (methods), Storable, Data::Dumper called
+Script using CGI (methods), Storable, Data::Dumper called:
<P>
<PRE> USER PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND
@@ -367,73 +364,39 @@
Observation: child httpd has grown even more 3316K ! Does not seem to be
good!
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Preopen_DB_connection_at_server_">Preopen DB connection at server startup</A></H1></CENTER>
<P>
-If you use DBI for DB connections, you can preopen a connections to DB for
-each child with Apache::DBI.
+<STRONG>Summary</STRONG>:
<P>
-<PRE> use Apache::DBI ();
- Apache::DBI->connect_on_init("DBI:mysql:test", 'login','passwd',
- {
- RaiseError => 1,
- PrintError => 1,
- AutoCommit => 1,
- };
-</PRE>
-<P>
-See also <A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>
-
-
+1. Library Perl Modules Preloading gave good results everywhere.
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Memory_sharing">Memory sharing</A></H1></CENTER>
<P>
-Another important point is memory sharing. If you OS supports this, and
-most of systems do, you might save more memory by sharing it between child
-processes. This is only possible when you preload code at the server
-startup. However during child process' life its memory pages becomes
-unshared and there is no way we can control perl to make it allocate memory
-so (dynamic) variables land on different memory pages than constants so the
-copy-on-write effect will hit almost at random. If you are pre-loading many
-modules you might be able to balance the memory that stays shared against
-the time for an occasional fork by tuning the <CODE>MaxRequestsperChild</CODE> to a point where you restart before too much becomes unshared. In this case
-the
-<CODE>MaxRequestsPerChild</CODE> is very specific to your scenario. You should do some measurements and you
-might see if this really makes a difference and what a reasonable number
-might be. Each time a child reaches this upper limit and restarts it should
-release the unshared copies and the new child will inherit pages that are
-shared until it scribbles on them.
+2. <CODE>CGI.pm</CODE>'s <CODE>compile()</CODE> method seems to use even more memory. It's because we never use all of the
+methods CGI provides. Do <CODE>compile()</CODE>
+only the tags that you are going to use and you will save the overhead of
+the first call for each has not yet been called method, and the memory -
+since compiled code will be shared across all the children.
<P>
-It is very important to understand that your goal is not to have
-<CODE>MaxRequestsperChild</CODE> to be of 10000. Having a child to serve 300 requests on precompiled code is
-already a huge speedup, so if it is 100 or 10000 it does not really matter
-if it saves you the RAM by sharing. Do not forget that if you preload most
-of your code at the server startup, the fork to spawn a new child will be
-very very fast, cause it inherits most of the preloaded code and the perl
-interpreter from the parent process.
+3. <CODE>Apache::RegistryLoader</CODE> might make scripts load faster on the first request after the child has
+just started but the memory usage is worse!!! See the numbers by yourself.
<P>
-The conclusion is that <CODE>MaxRequestsperChild</CODE> should not be too big, otherwise you loose the benefits of the memory
-sharing.
+HW/SW used : The server is apache 1.3.2, mod_perl 1.16 running on AIX 4.1.5
+RS6000 1G RAM.
<P>
-See <A HREF="././performance.html#Choosing_MaxRequestsPerChild">Choosing MaxRequestsPerChild</A> for more about tuning the <CODE>MaxRequestsperChild</CODE> parameter.
-
-<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Preload_Registry_Scripts">Preload Registry Scripts</A></H1></CENTER>
<P>
-Apache::RegistryLoader compiles Apache::Registry scripts at server startup.
-It can be a good idea to preload these as well. So the code will be shared
-among the child servers.
+<CODE>Apache::RegistryLoader</CODE> compiles Apache::Registry scripts at server startup. It can be a good idea
+to preload these as well. So the code will be shared among the child
+servers.
<P>
-example of use at modperl.com in a PerlRequire'd file:
+Here is an example of the use of this technique. This code is included in a <CODE>PerlRequire</CODE>'d file, and walks the directory tree under which all registry scripts are
+installed. For each <CODE>.pl</CODE> file encountered, it calls the <CODE>Apache::RegistryLoader::handler()</CODE> method to preload the script in the parent server (before preforking the
+child processes):
<P>
<PRE> use File::Find 'finddepth';
@@ -454,15 +417,14 @@
}
</PRE>
<P>
-Note that we don't use here the second argument to the
-<CODE>handler().</CODE> You might need to provide a <CODE>trans()</CODE>
-method, since it's very dependent on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE> for the complete information.
+Note that we don't use the second argument to <CODE>handler()</CODE> here. You might need to provide a <CODE>trans()</CODE> method, since it's very dependent on your server's configuration. See <CODE>perldoc Apache::RegistryLoader</CODE>
+for the complete information.
<P>
-You have to check whether it makes any good for you though, I did some
-testing [ <A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A> ], and it seems that it takes more memory than when the scripts is being
+You have to check whether this makes any improvement for you though, I did
+some testing [ <A HREF="#Preload_Perl_modules_Real_Numb">Preload Perl modules - Real Numbers</A> ], and it seems that it takes more memory than when the scripts are being
called from the child - This is only a first impression and needs better
-investigation. If you aren't concerned about few scripts invocations which
+investigation. If you aren't concerned about few script invocations which
will take some time to respond while they load the code, you might not need
it all!
@@ -472,53 +434,61 @@
<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Avoid_Importing_Functions">Avoid Importing Functions</A></H1></CENTER>
-<P>
-When possible, avoid importing of a module functions into your name space.
-The aliases which are created can take up quite a bit of space. Try to use
-method interfaces and fully qualified Package::function names instead.
-
-<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Reducing_the_Memory_Usage">Reducing the Memory Usage</A></H1></CENTER>
+<CENTER><H1><A NAME="Sharing_Memory">Sharing Memory</A></H1></CENTER>
<P>
-One of the important issues in improving the performance is memory usage
-reduce - the less memory server uses - the more server processes you can
-start - the more performance you have (from the user point of view - the
-respond speed )
+Another important point is the sharing of memory. If your OS supports this
+(and most sane systems do), you might save more memory by sharing it
+between child processes. This is only possible when you preload code at
+server startup. However during a child process' life, its memory pages
+becomes unshared and there is no way we can control perl to make it
+allocate memory so (dynamic) variables land on different memory pages than
+constants so the copy-on-write effect will hit almost at random. If you are
+pre-loading many modules you might be able to balance the memory that stays
+shared against the time for an occasional fork by tuning the <CODE>MaxRequestsperChild</CODE> to a point where you restart before too much becomes unshared. In this case
+the
+<CODE>MaxRequestsPerChild</CODE> is very specific to your scenario. You should do some measurements and you
+might see if this really makes a difference and what a reasonable number
+might be. Each time a child reaches this upper limit and restarts it should
+release the unshared copies and the new child will inherit pages that are
+shared until it scribbles on them.
<P>
-See <A HREF="././porting.html#Global_Variables">Global Variables</A>
-
-
+It is very important to understand that your goal is not to have
+<CODE>MaxRequestsperChild</CODE> to be 10000. Having a child serve 300 requests on precompiled code is
+already a huge speedup, so if it is 100 or 10000 it does not really matter
+if it saves you the RAM by sharing. Do not forget that if you preload most
+of your code at the server startup, the fork to spawn a new child will be
+very very fast, because it inherits most of the preloaded code and the perl
+interpreter from the parent process. But then during the work of the child,
+its memory pages (which aren't really its yet, it uses the parent's pages)
+are getting dirty (originally inherited and shared variables are getting
+updated) and the copy-on-write happens, which reduce the sharing number of
+memory pages - thus enlarging the memory usage. Killing the child and
+spawning a new one allows to get the pristine shared memory from the parent
+process again.
<P>
-See <A HREF="././porting.html#Memory_leakage">Memory "leakages"</A>
-
-
+The conclusion is that <CODE>MaxRequestsperChild</CODE> should not be too big, otherwise you loose the benefits of the memory
+sharing.
<P>
-Joel Wagner reports that calling an undefined subroutine in a module can
-cause a tight loop that consumes all memory. Here is a way to catch such
-errors. Define an autoload subroutine:
+See <A HREF="././performance.html#Choosing_MaxRequestsPerChild">Choosing MaxRequestsPerChild</A> for more about tuning the <CODE>MaxRequestsperChild</CODE> parameter.
<P>
-<PRE> sub UNIVERSAL::AUTOLOAD {
- my $class = shift;
- warn "$class can't \$UNIVERSAL::AUTOLOAD!\n";
- }
-</PRE>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Avoid_Importing_Functions">Avoid Importing Functions</A></H1></CENTER>
<P>
-It will produce a nice error in error_log, giving the line number of the
-call and the name of the undefined subroutine.
+When possible, avoid importing a module's functions into your name space.
+The aliases which are created can take up quite a bit of space. Try to use
+method interfaces and fully qualified
+<CODE>Package::function</CODE> or <CODE>$Package::variable</CODE> like names instead.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="how_can_I_find_if_my_modperl_scr">how can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
+<CENTER><H1><A NAME="How_can_I_find_if_my_modperl_scr">How can I find if my modperl scripts have memory leaks (and where)</A></H1></CENTER>
<P>
-Apache::Leak (derived from Devel::Leak) should help you with this task.
-Example:
+<CODE>Apache::Leak</CODE> (derived from <CODE>Devel::Leak</CODE>) should help you with this task. Example:
<P>
<PRE> use Apache::Leak;
@@ -531,12 +501,11 @@
};
</PRE>
<P>
-The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can
-just throw it around any code you suspect might be leaking. beware, it will
-run the code twice, because the first time in, new SVs are created, but
-does not mean you are leaking, the second pass will give better evidence.
-you do not need to be inside mod_perl to use it, from the command line, the
-above script outputs:
+The argument to <CODE>leak_test()</CODE> is an anonymous sub, so you can just throw it around any code you suspect
+might be leaking. beware, it will run the code twice, because the first
+time in, new <CODE>SV</CODE>s are created, but does not mean you are leaking, the second pass will give
+better evidence. you do not need to be inside mod_perl to use it, from the
+command line, the above script outputs:
<P>
<PRE> ENTER: 1482 SVs
@@ -548,34 +517,69 @@
!!! 2 SVs leaked !!!
</PRE>
<P>
-Build a debuggable perl to see dumps of the SVs. the simple way to have
-both a normal perl and debuggable perl, is to follow hints in the SUPPORT
-doc for building libperld.a, when that is built copy the `perl' from that
-directory to your perl bin directory, but name it `dperl'.
+Build a debuggable perl to see dumps of the <CODE>SV</CODE>s. the simple way to have both a normal perl and debuggable perl, is to
+follow hints in the
+<CODE>SUPPORT</CODE> doc for building <CODE>libperld.a</CODE>, when that is built copy the
+<CODE>perl</CODE> from that directory to your perl bin directory, but name it
+<CODE>dperl</CODE>.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_size_of_the_process">Limiting the size of the processes</A></H1></CENTER>
<P>
-Apache::SizeLimit allows you to kill off Apache httpd processes if they
-grow too large. see perldoc Apache::SizeLimit for more details.
+<CODE>Apache::SizeLimit</CODE> allows you to kill off Apache httpd processes if they grow too large. see
+perldoc <CODE>Apache::SizeLimit</CODE> for more details.
<P>
By using this module, you should be able to discontinue using the Apache
-configuration directive MaxRequestsPerChild, although for some folks, using
-both in combination does the job.
+configuration directive <CODE>MaxRequestsPerChild</CODE>, although for some folks, using both in combination does the job.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_resources_used_by_h">Limiting the resources used by httpd children</A></H1></CENTER>
<P>
-Apache::Resource uses the BSD::Resource module, which uses the C function
-setrlimit to set limits on system resources such as memory and cpu usage.
+<CODE>Apache::Resource</CODE> uses the <CODE>BSD::Resource</CODE> module, which uses the C function <CODE>setrlimit</CODE> to set limits on system resources such as memory and cpu usage.
<P>
-See perldoc Apache::Resource for more info.
+To configure use:
<P>
+<PRE> PerlModule Apache::Resource
+ # set child memory limit in megabytes
+ # (default is 64 Meg)
+ PerlSetEnv PERL_RLIMIT_DATA 32:48
+
+ # set child cpu limit in seconds
+ # (default is 360 seconds)
+ PerlSetEnv PERL_RLIMIT_CPU 120
+
+ PerlChildInitHandler Apache::Resource
+</PRE>
+<P>
+The following limit values are in megabytes: <CODE>DATA</CODE>, <CODE>RSS</CODE>,
+<CODE>STACK</CODE>, <CODE>FSIZE</CODE>, <CODE>CORE</CODE>, <CODE>MEMLOCK</CODE>; all others are treated as their natural unit. Prepend <CODE>PERL_RLIMIT_</CODE> for each one you want to use. Refer to <CODE>setrlimit</CODE> man page on your OS for other possible resources.
+
+<P>
+If the value of the variable is of the form <CODE>S:H</CODE>, <CODE>S</CODE> is treated as the soft limit, and <CODE>H</CODE> is the hard limit. If it is just a single number, it is used for both soft
+and hard limits.
+
+<P>
+To debug add:
+
+<P>
+<PRE> <Perl>
+ $Apache::Resource::Debug = 1;
+ require Apache::Resource;
+ </Perl>
+ PerlChildInitHandler Apache::Resource
+</PRE>
+<P>
+and look in the error_log to see what it's doing.
+
+<P>
+Refer to <CODE>perldoc Apache::Resource</CODE> and <CODE>man 2 setrlimit</CODE> for more info.
+
+<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Limiting_the_request_rate_speed_">Limiting the request rate speed (robots blocking)</A></H1></CENTER>
<P>
@@ -586,7 +590,7 @@
such robots, you'll have to be more sophisticated.
<P>
-Apache::SpeedLimit comes for you to help, see:
+<CODE>Apache::SpeedLimit</CODE> comes for you to help, see:
<P>
<A
@@ -602,16 +606,15 @@
directory of mod_perl dist for more examples.
<P>
-If you write a benchmarks from your own for heavy scripts use
-<CODE>Benchmark</CODE> and for very fast scripts use <CODE>Time::HiRes</CODE> modules.
+If you write a benchmark for your own, use <CODE>Benchmark</CODE> for heavy scripts or use <CODE>Time::HiRes</CODE> for very fast scripts where you need better precision.
<P>
-There is no need to write a special benchmark, if you want to impress your
-boss or colleagues, just take the heaviest cgi script you have, open 2
-xterms and call the same script in mod_perl mode in one xterm and in
-mod_cgi mode in the other. You can use lwp-get from LWP package to emulate
-the web agent (browser). (benchmark/ directory of mod_perl dist includes
-such an example)
+There is no need to write a special benchmark though. If you want to
+impress your boss or colleagues, just take the heaviest cgi script you
+have, open 2 xterms and call the same script in mod_perl mode in one xterm
+and in mod_cgi mode in the other. You can use lwp-get from
+<CODE>LWP</CODE> package to emulate the web agent (browser). (benchmark/ directory of
+mod_perl dist includes such an example)
<P>
See also 2 tools for benchmarking:
@@ -681,10 +684,11 @@
access module from yet another.
<P>
-I think the Apache::ASP module looks very promising. It has very easy to
-use and adequately powerful state maintenance, a good embedding system, and
-a sensible object model (that emulates the Microsoft ASP one). It doesn't
-replicate MS's ADO for data access, but DBI is fine for that.
+I think the <CODE>Apache::ASP</CODE> module looks very promising. It has very easy to use and adequately
+powerful state maintenance, a good embedding system, and a sensible object
+model (that emulates the Microsoft ASP one). It doesn't replicate MS's ADO
+for data access, but
+<CODE>DBI</CODE> is fine for that.
<P>
I have always found that the developers available make the greatest impact
@@ -726,20 +730,20 @@
perl: 299 secs (32.51 usr 23.98 sys = 56.49 cpu)
</PRE>
<P>
-We don't know what server configurations was used for these testing, but I
-guess the numbers talks for themselves.
+We don't know what server configurations was used for these tests, but I
+guess the numbers speak for themselves.
<P>
-The source code of the script at <A
+The source code of the script is available at <A
HREF="http://www.realtime.net/~parkerm/perl/conf98/sld006.htm">http://www.realtime.net/~parkerm/perl/conf98/sld006.htm</A>
-
+.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Benchmarking_scripts_with_execut">Benchmarking scripts with execution times below 1 second :)</A></H2></CENTER>
<P>
-As noted before for very fast scripts you will have to use Time::HiRes
-module, it's usage is similar to the Benchmark's.
+As noted before, for very fast scripts you will have to use the Time::HiRes
+module, its usage is similar to the Benchmark's.
<P>
<PRE> use Time::HiRes qw(gettimeofday tv_interval);
@@ -758,38 +762,49 @@
<P>
At <A
HREF="http://perl.apache.org/dist/contrib/">http://perl.apache.org/dist/contrib/</A>
-you will find Apache::Timeit package which does PerlHandler's Benchmarking.
+you will find
+<CODE>Apache::Timeit</CODE> package which does PerlHandler's Benchmarking.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Tuning_the_Apache_s_configuratio">Tuning the Apache's configuration variables for the best performance</A></H1></CENTER>
<P>
It's very important to make a correct configuration of the
-<CODE>MinSpareServers MaxSpareServers StartServers MaxClients
-MaxRequestsPerChild</CODE> parameters. There are no defaults, the values of these variable are very
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE>, <CODE>StartServers</CODE>,
+<CODE>MaxClients</CODE>, and <CODE>MaxRequestsPerChild</CODE> parameters. There are no defaults, the values of these variable are very
important, as if too ``low'' you will not use the system for its full
ability, and if too ``high'' chances your server will bring the machine to
-its knees.
+its knees.
<P>
All the above parameters should be specified on the basis of the resources
-you have. While with plain apache server, there is no big deal if you run
+you have. While with a plain apache server, there is no big deal if you run
too many servers (not too many of course) since the processes are of ~1Mb
and aren't eating a lot of your RAM. The situation is different with
-mod_perl. I have seen mod_perl processes of 20Mb and more. Now if you have
-MaxClients set to 50: 50x20Mb = 1Gb - do you have 1Gb of RAM? Probably not.
-So how do you tune these numbers? Generally by trying different
-combinations and testing the server.
+mod_perl. I have seen mod_perl processes of 20Mb and more. Now if you have <CODE>MaxClients</CODE> set to 50: 50x20Mb = 1Gb - do you have 1Gb of RAM? Probably not. So how do
+you tune these numbers? Generally by trying different combinations and
+testing the server.
<P>
Before you start this task you should be armed with the proper weapon. You
-need a crashme script, which will load your server with all kinds of
-mod_perl scripts you can think you have in your repository. There are
-commercial solutions for that, when you have free ones that do the same job
-(but for free :). You can use an
-<A HREF="././performance.html#Tuning_with_ab_ApacheBench">ApacheBench</A> <STRONG><CODE>ab</CODE></STRONG> utility that comes with apache distribution or use a <A HREF="././performance.html#Tuning_with_crashme_script">crashme test</A> which uses LWP::Parallel::UserAgent. You need these to have an ability to
-emulate multiuser environment and to generate multiply clients which will
-call the mod_perl scripts at your server simultaneously.
+need a crashme utility, which will load your server with mod_perl scripts
+you possess. While there are commercial solutions, you can get away with
+free ones who do the same job. You can use an
+<A HREF="././performance.html#Tuning_with_ab_ApacheBench">ApacheBench</A> <STRONG><CODE>ab</CODE></STRONG> utility that comes with apache distribution, a <A HREF="././performance.html#Tuning_with_crashme_script">crashme script</A> which uses
+<CODE>LWP::Parallel::UserAgent</CODE> or <CODE>httperf</CODE> (see <A HREF="././download.html#">Download page</A>). You need these to have an ability to emulate a multiuser environment and
+to emulate multiple clients behaviour which will call the mod_perl scripts
+at your server simultaneously.
+
+<P>
+Another important issue is to make sure to run testing client (load
+generator) on a system that is more powerful than the system being tested.
+After all we are trying to simulate the Internet users, where many users
+are trying to reach your service at once -- since a number of concurrent
+users can be quite big, your testing machine much be very powerful and
+capable to generate a big load. Of course you should not run the clients
+and server on the same machine. If you do -- your testing results would be
+incorrect, since clients will eat a CPU and a memory that have to be
+dedicated to the server, and vice versa.
<P>
See also 2 tools for benchmarking:
@@ -803,12 +818,12 @@
<P>
<STRONG>ab</STRONG> is a tool for benchmarking your Apache HTTP server. It is designed to give
you an impression on how much performance your current Apache installation
-can give. Particularly it shows you how much requests per secs your Apache
-server is capable to serve. The
-<STRONG>ab</STRONG> comes bundled with apache source distribution (and it's free :).
+can give. In particular, it shows you how many requests per secs your
+Apache server is capable of serving. The
+<STRONG>ab</STRONG> tool comes bundled with apache source distribution (and it's free :).
<P>
-Lets try it. We will simulate 10 users concurrently requesting the script <CODE>www.you.com:81/test/test.pl</CODE> which a very light one. Each one does it for 10 times.
+Lets try it. We will simulate 10 users concurrently requesting the script <CODE>www.you.com:81/test/test.pl</CODE> which is a very light one. Each one makes 10 requests.
<P>
<PRE> % ./ab -n 100 -c 10 www.you.com:81/test/test.pl
@@ -838,7 +853,7 @@
Requests per second: 139.86
</PRE>
<P>
-Lets rise the load of requests to 100 x 10 (10 users each 100 requests
+Let's raise the load of requests to 100 x 10 (10 users each 100 requests)
<P>
<PRE> % ./ab -n 1000 -c 10 www-pais:81/perl/access/access.cgi
@@ -849,7 +864,7 @@
</PRE>
<P>
As expected nothing changes (Since the situation didn't changed, we have
-the same 10 concurrent users). Now lets rise the number of concurrent
+the same 10 concurrent users). Now let's raise the number of concurrent
users:
<P>
@@ -859,8 +874,8 @@
Requests per second: 133.01
</PRE>
<P>
-We see that the server is capable to serve 50 concurrent users at amazing
-133 req/sec! Lets find the upper bound. Using <CODE>-n 10000 -c
+We see that the server is capable of serving 50 concurrent users at an
+amazing 133 req/sec! Lets find the upper bound. Using <CODE>-n 10000 -c
1000</CODE> failed to get results (Broken Pipe?). Using <CODE>-n 10000 -c
500</CODE> derived 94.82 req/sec. It went down with the high load.
@@ -888,16 +903,16 @@
<PRE> % ./ab -n 1000 -c 50 www-pais:81/perl/access/access.cgi
</PRE>
<P>
-The benchmark time outed with the above configuration.... I watched the
-output of ps as I run it, the parent process just wasn't capable to respawn
-the killed children in that rate...When I raised the MaxRequestsPerChild to
-10 I've got 8.34 req/sec - very bad (18 times slower!) (You can't benchmark
-the importance of the MinSpareServers, MaxSpareServers and StartServers
-with this kind of test).
+The benchmark timed out with the above configuration.... I watched the
+output of ps as I ran it, the parent process just wasn't capable of
+respawning the killed children at that rate...When I raised the
+<CODE>MaxRequestsPerChild</CODE> to 10 I've got 8.34 req/sec - very bad (18 times slower!) (You can't
+benchmark the importance of the
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE> and <CODE>StartServers</CODE> with this kind of test).
<P>
-Now let's try to return MaxRequestsPerChild to 1500, but to lower the
-MaxClients to 10 and run the same test:
+Now let's try to return <CODE>MaxRequestsPerChild</CODE> to 1500, but to lower the
+<CODE>MaxClients</CODE> to 10 and run the same test:
<P>
<PRE> MinSpareServers 8
@@ -907,58 +922,57 @@
MaxRequestsPerChild 1500
</PRE>
<P>
-I have got 27.12 req/sec, which is better but still 4-5 times slower (133
-with MaxClients of 50)
+I got 27.12 req/sec, which is better but still 4-5 times slower (133 with <CODE>MaxClients</CODE> of 50)
<P>
-<STRONG>Summary:</STRONG> I have tested a few combinations of server configuration variables
-(MinSpareServers MaxSpareServers StartServers MaxClients
-MaxRequestsPerChild). And the results we have received are as follows:
+<STRONG>Summary:</STRONG> I have tested a few combinations of server configuration variables (<CODE>MinSpareServers</CODE> <CODE>MaxSpareServers</CODE> <CODE>StartServers</CODE>
+<CODE>MaxClients</CODE> <CODE>MaxRequestsPerChild</CODE>). And the results we have received are as follows:
+
<P>
-MinSpareServers, MaxSpareServers and StartServers are only important for
-user respond times (sometimes user will have to wait a bit).
+<CODE>MinSpareServers</CODE>, <CODE>MaxSpareServers</CODE> and <CODE>StartServers</CODE> are only important for user response times (sometimes user will have to
+wait a bit).
<P>
-The important parameters are MaxClients and MaxRequestsPerChild. MaxClients
-should be not to big so it will not abuse your machine's memory resources
+The important parameters are <CODE>MaxClients</CODE> and
+<CODE>MaxRequestsPerChild</CODE>. <CODE>MaxClients</CODE> should be not to big so it will not abuse your machine's memory resources
and not too small, when users will be forced to wait for the children to
-become free to come serve them. MaxRequestsPerChild should be as big as
-possible, to take the full benefit of the mod_perl, but watch your server
-at the beginning to make sure your scripts are not leaking memory causing
-your server (and your service) to die very fast.
+become free to come serve them. <CODE>MaxRequestsPerChild</CODE> should be as big as possible, to take the full benefit of mod_perl, but
+watch your server at the beginning to make sure your scripts are not
+leaking memory, thereby causing your server (and your service) to die very
+fast.
<P>
-Also it is important to understand that we didn't test the respond times in
-the tests above, but the ability of the server to respond. If the script
+Also it is important to understand that we didn't test the response times
+in the tests above, but the ability of the server to respond. If the script
that was used to test was heavier, the numbers would be different but the
conclusions are very similar.
<P>
-The benchmarks were run at:
+The benchmarks were run with:
<P>
<PRE> HW: RS6000, 1Gb RAM
SW: AIX 4.1.5 . mod_perl 1.16, apache 1.3.3
- Machine running only mysql service, httpd docs and mod_perl servers.
- Machine was completely unloaded during the benchmarking.
+ Machine running only mysql, httpd docs and mod_perl servers.
+ Machine was _completely_ unloaded during the benchmarking.
</PRE>
<P>
-After each server restart when I did changes to server's configurations, I
-made sure the scripts were preloaded by fetching a script at least one time
-by each child.
+After each server restart when I did changes to the server's
+configurations, I made sure the scripts were preloaded by fetching a script
+at least one time by each child.
<P>
-It is important to notice that None of requests time outed even if was kept
-in server's queue form more than 1 minute! (That is the way <STRONG>ab</STRONG>
-works, which is OK for the test but will not for the real world - user will
-not wait for more than 5-10 secs for a request to complete, and the browser
-will timeout in a 30 secs or so)
+It is important to notice that none of requests timed out, even if was kept
+in server's queue for more than 1 minute! (That is the way <STRONG>ab</STRONG>
+works, which is OK for the test but will not for the real world - users
+will not wait for more than 5-10 secs for a request to complete, and the
+browser will timeout in 30 secs or so.)
<P>
-Now let me take a real code whose execution time is bigger than a few
-msecs. Will will do real testing and collect the data in tables for easier
-view.
+Now let's take a look at some real code whose execution time is more than a
+few msecs. We will do real testing and collect the data in tables for
+easier viewing.
<P>
I will use the following abbreviations
@@ -984,19 +998,20 @@
<P>
<PRE> NR NC RPS comment
------------------------------------------------
- 10 10 3.33 # not a reliable stats
+ 10 10 3.33 # not a reliable stat
100 10 3.94
1000 10 4.62
1000 50 4.09
</PRE>
<P>
-Conclusions: Here I wanted to show that when the application is slow not
-because of perl loading, script compiling and execution, but bounded to
-some external operation like mysqld querying which made the bottleneck - it
-almost does not matter what is the load we make - the RPS (Requests per
-second) is almost the same (taken that all the requested has been served,
-you have an ability to queue the clients, but be aware that something that
-goes to queue means a waiting client and browser can get time outed!)
+Conclusions: Here I wanted to show that when the application is slow -- not
+due to perl loading, script compiling and execution, but bounded to some
+external operation like mysqld querying which made the bottleneck -- it
+almost does not matter what load we place on the server. The RPS (Requests
+per second) is almost the same (given that all the requests have been
+served, you have an ability to queue the clients, but be aware that
+something that goes to queue means a waiting client and browser can time
+out!)
<P>
Now we will benchmark the same script without using the mysql (perl only
@@ -1012,7 +1027,7 @@
<P>
<PRE> NR NC RPS comment
------------------------------------------------
- 10 10 26.95 # not a reliable stats
+ 10 10 26.95 # not a reliable stat
100 10 30.88
1000 10 29.31
1000 50 28.01
@@ -1021,19 +1036,18 @@
100000 400 24.95
</PRE>
<P>
-Conclusions: This time the script we executed was a pure perl (not bounded
-to I/O or mysql), so we see that the server serves the requests much
-faster. You can see the RequestPerSecond (RPS) is almost the same for any
-load, but goes lower when the number of concurrent clients goes beyond the
-MaxClients. With 25 RPS, the client in load of 400 concurrent clients will
+Conclusions: This time the script we executed was pure perl (not bounded to
+I/O or mysql), so we see that the server serves the requests much faster.
+You can see the RequestPerSecond (RPS) is almost the same for any load, but
+goes lower when the number of concurrent clients goes beyond the <CODE>MaxClients</CODE>. With 25 RPS, the client supplying a load of 400 concurrent clients will
be served in 16 secs. But to get more realistic and assume the max
concurrency of 100, with 30 RPS, the client will be served in 3.5 secs,
which is pretty good for a highly loaded server.
<P>
-Now we will use the server for its full capacity, by keeping all MaxClients
-alive all the time and having a big MaxRequestsPerChild, so no server will
-be killed during the benchmarking.
+Now we will use the server for its full capacity, by keeping all
+<CODE>MaxClients</CODE> alive all the time and having a big
+<CODE>MaxRequestsPerChild</CODE>, so no server will be killed during the benchmarking.
<P>
<PRE> MinSpareServers 50
@@ -1051,13 +1065,12 @@
10000 200 31.60
</PRE>
<P>
-Conclusion: In this scenario there is no overhead for parent server to load
-new children, all the servers are available, and the only bottleneck is a
-rival over the CPU
+Conclusion: In this scenario there is no overhead involving the parent
+server loading new children, all the servers are available, and the only
+bottleneck is contention for the CPU.
<P>
-Now we will try to change the MaxClients and to watch the results: Let's
-reduce MC to 10.
+Now we will try to change the <CODE>MaxClients</CODE> and to watch the results: Let's reduce MC to 10.
<P>
<PRE> MinSpareServers 8
@@ -1079,14 +1092,15 @@
<P>
Conclusions: Very little difference! Almost no change! 10 servers were able
to serve almost with the same throughput as 50 servers. Why? My guess it's
-because of CPU , Seems that 10 servers were serving 5 times faster the
-requests then when in the test above we worked with 50 servers. In the case
-above each child received its CPU time slice 5 times less frequently. So
-having a big value for MaxClients, doesn't mean that the performance will
-be better. You have just saw the numbers!
+because of CPU throttling. It seems that 10 servers were serving requests 5
+times faster than when in the test above we worked with 50 servers. In the
+case above each child received its CPU time slice 5 times less frequently.
+So having a big value for
+<CODE>MaxClients</CODE>, doesn't mean that the performance will be better. You have just seen the
+numbers!
<P>
-Now we will start to reduce drastically the MaxRequestsPerClient
+Now we will start to drastically reduce the MaxRequestsPerClient:
<P>
<PRE> MinSpareServers 8
@@ -1104,9 +1118,8 @@
1000 100 10 6.51
</PRE>
<P>
-Conclusions: When we reduce drastically the MaxRequestsPerClient, the
-performance starts to become closer to the plain mod_cgi. Just for compare
-with mod_cgi, here are the numbers of run with mod_cgi:
+Conclusions: When we drastically reduce the <CODE>MaxRequestsPerClient</CODE>, the performance starts to become closer to the plain mod_cgi. Just for
+comparison with mod_cgi, here are the numbers of this run with mod_cgi:
<P>
<PRE> MinSpareServers 8
@@ -1124,7 +1137,7 @@
Conclusion: mod_cgi is much slower :) in test NReq/NClients 100/10 the RPS
in mod_cgi 1.12 and in mod_perl 32 => 30 times faster !!! In the first
test each child waited about 100 secs to be served. In the second and third
-1000 secs!
+1000 secs!
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -1134,14 +1147,15 @@
located at <A
HREF="http://www.linux-magazin.de/ausgabe.1998.08/Pounder/pounder.html">http://www.linux-magazin.de/ausgabe.1998.08/Pounder/pounder.html</A>
. I did a few modifications (mostly adding <CODE>my()</CODE> ops :). I also
-allowed it to accept more then one url, since sometimes you want to test
+allowed it to accept more than one url, since sometimes you want to test an
overall and not just one script.
<P>
The tool provides the same results as <STRONG>ab</STRONG> above but it also allows you to set the timeout value, so requests will
-fail if not served before time outed. You also get Latency (secs/Request)
-and Throughput (Requests/sec) numbers. It can give you a better picture and
-make a complete simulation of your favorite Netscape browser :)
+fail if not served within the time out period. You also get Latency
+(secs/Request) and Throughput (Requests/sec) numbers. It can give you a
+better picture and make a complete simulation of your favorite Netscape
+browser :)
<P>
I have noticed while running these 2 benchmarking suites - <STRONG>ab</STRONG> gave me results 2.5-3.0 times better. Both suites run on the same machine
@@ -1314,27 +1328,27 @@
supported; not more than this number of child server processes will be
created. To configure more than 256 clients, you must edit the
HARD_SERVER_LIMIT entry in httpd.h and recompile. In our case we want to
-set this variable to as little as possible number, this way we can
-virtually bound the resources used by the server children. If we know that
-we have X Mb of RAM, each child consumes a maximum of Y Mb of RAM (we can
-restrict each child See
-<A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>) and we have the all these X Mb dedicated for the webserver. Then
-calculation of
+set this variable as small as possible, this way we can virtually bound the
+resources used by the server children. If we know that we have X Mb of RAM,
+each child consumes a maximum of Y Mb of RAM (we can restrict each child.
+See
+<A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>) and we have all these X Mb dedicated for the webserver. Then calculation
+of
<CODE>MaxClients</CODE> is pretty straightforward :
<P>
<PRE> MaxClients = Total Available to the webserver RAM / MAX child's size
</PRE>
<P>
-So If I have 400Mb left for the the webserver to run . I can set the
+So if I have 400Mb left for the webserver to run in, I can set the
<CODE>MaxClients</CODE> to be of 40 if I know that each child is bounded to the 10Mb of memory
-(with Apache::SizeLimit, See the reference above)
+(with <CODE>Apache::SizeLimit</CODE>, See the reference above.)
<P>
-Certainly you will wander what happens to your server if there are more
+Certainly you will wonder what happens to your server if there are more
than <CODE>MaxClients</CODE> concurrent users at some moment. This situation is accompanied by the
-following warning message into the <CODE>error.log</CODE>
-file:
+following warning message into the
+<CODE>error.log</CODE> file:
<P>
<PRE> [Sun Jan 24 12:05:32 1999] [error] server reached MaxClients setting,
@@ -1353,9 +1367,9 @@
children. The best thing is not to have this condition reached at all.
<P>
-It's important to understand what is child's memory size? If your children
-can share some memory (when OS supports that and you worry to let the
-sharing happen - See <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A>). If this is the case chances that your <CODE>MaxClients</CODE> can be even higher. But seems that it's not so simple to calculate the
+It's important to understand how much memory a child occupies. If your
+children can share some memory (when the OS supports that and you take
+action to allow the sharing happen - See <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A>). If this is the case, chances are that your <CODE>MaxClients</CODE> can be even higher. But it seems that it's not so simple to calculate the
absolute number. (If you come up with solution please let me know)
<P>
@@ -1368,57 +1382,59 @@
<CODE>MaxRequestsPerChild</CODE> is 0, then the process will never expire.
<P>
-Setting <CODE>MaxRequestsPerChild</CODE> to a non-zero limit has two beneficial effects: solves memory leakages and
-helps reduce the number of processes when the server load reduces.
+Setting <CODE>MaxRequestsPerChild</CODE> to a non-zero limit has two beneficial effects: it solves memory leakages
+and helps reduce the number of processes when the server load reduces.
<P>
-The first reason is the most crucial for mod_perl, since dirty programming
+The first reason is the most crucial for mod_perl, since sloppy programming
will cause a child process to consume more memory after each request. If
-left unbounded after a certain number of requests children will it up all
-the available memory and leave the server to die in memory starvation :).
-Note, that sometimes some standard modules leaks memory, on OSes where
-memory managements is bad (Solaris 2.5 on x86 ?)
-
-<P>
-If this is your case you can set <CODE>MaxRequestsPerChild</CODE> to a small number, which will allow the parent to kill the memory greedy
-son after <CODE>MaxRequestsPerChild</CODE> requests. But then you loose all the speed bonuses you receive with
-mod_perl, and you better fall back to run in plain mod_cgi, since the
-overhead of reloading the script and the perl on each request will be too
-high. Consider using Apache::PerlRun if this is your case. Also setting
-MaxSpareServers to number close to
-<CODE>MaxClients</CODE>, will make the respond time faster (but your parent process will be busy
-to respawn new children all the time!)
+left unbounded, then after a certain number of requests the children will
+use up all the available memory and leave the server to die from memory
+starvation :). Note, that sometimes some standard modules leak memory,
+especially on OSes where memory managements is bad (Solaris 2.5 on x86 ?)
+
+<P>
+If this is your case you can set <CODE>MaxRequestsPerChild</CODE> to a small number, which will allow the system to reclaim the memory,
+greedy child process consumed, when it exits after <CODE>MaxRequestsPerChild</CODE>
+requests. But beware -- if you set this number too low, you will lose the
+speed bonus you receive with mod_perl, so maybe you should consider falling
+back to plain mod_cgi, since the overhead of reloading the script and the
+perl interpreter for each request will be too high. Consider using <CODE>Apache::PerlRun</CODE> if this is the case. Also setting <CODE>MaxSpareServers</CODE> to a number close to <CODE>MaxClients</CODE>, will improve the response time (but your parent process will be busy
+respawning new children all the time!)
<P>
-Another approach is to use Apache::SizeLimit (See <A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>). By using this module, you should be able to discontinue using the
+Another approach is to use <CODE>Apache::SizeLimit</CODE> (See <A HREF="././performance.html#Limiting_the_size_of_the_process">Limiting the size of the processes</A>). By using this module, you should be able to discontinue using the
<CODE>MaxRequestsPerChild</CODE>, although for some folks, using both in combination does the job.
<P>
See also <A HREF="././performance.html#Preload_Perl_modules_at_server_s">Preload Perl modules at server startup</A> and
-<A HREF="././performance.html#Memory_sharing">Memory sharing</A>.
+<A HREF="././performance.html#Sharing_Memory">Sharing Memory</A>.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Choosing_MinSpareServers_MaxSpa">Choosing MinSpareServers, MaxSpareServers and StartServers</A></H2></CENTER>
<P>
-With mod_perl it might take up to a 30-50 secs before the new server is
-ready to serve the requests. It depends on OS, number of preloaded modules
-and the load of the machine. So you better set <CODE>StartServers</CODE>
-and <CODE>MinSpareServers</CODE> to a big numbers so if you get a high load after the server has been just
-restarted, the fresh servers will be ready to serve on the first demand.
-It's good for mod_perl to raise all 3 variables up, Since with mod_perl you
-don't want to kill the servers when not in use, on opposite you want them
-to stay up. (For the same reason of the heavy and slow load). I think an
-ideal configuration is with <CODE>MinSpareServers</CODE> and <CODE>MaxSpareServers</CODE> of similar values, even the same. Having the <CODE>MaxSpareServers</CODE> close to
-<CODE>MaxClients</CODE> will use completely all of your resources (if <CODE>MaxClients</CODE>
-has been chosen to take the full advantage of the resources), but it'll
-make sure that in any given moment your system will be capable of
-responding to request with the maximum speed (taken that number of
-concurrent requests is not higher then <CODE>MaxClients</CODE>)
+With mod_perl enabled, it might take as much as 3-30 seconds from the time
+you start the server until it is ready to serve incoming requests. This
+delay depends on the OS, the number of preloaded modules and the process
+load of the machine. So it's best to set
+<CODE>StartServers</CODE> and <CODE>MinSpareServers</CODE> to high numbers, so that if you get a high load just after the server has
+been restarted, the fresh servers will be ready to serve requests
+immediately. With mod_perl, it's usually a good idea to raise all 3
+variables higher than normal. In order to maximize the benefits of
+mod_perl, you don't want to kill servers when they are idle, rather you
+want them to stay up and available to immediately handle new requests. I
+think an ideal configuration is to set <CODE>MinSpareServers</CODE> and <CODE>MaxSpareServers</CODE> to similar values, maybe even the same. Having the <CODE>MaxSpareServers</CODE>
+close to <CODE>MaxClients</CODE> will completely use all of your resources (if
+<CODE>MaxClients</CODE> has been chosen to take the full advantage of the resources), but it'll
+make sure that at any given moment your system will be capable of
+responding to requests with the maximum speed (given that number of
+concurrent requests is not higher then
+<CODE>MaxClients</CODE>.)
<P>
-Let me try some numbers. For the heavily loaded web site and the dedicated
-machine I would think of (note 400Mb is just for the show case):
+Let's try some numbers. For a heavily loaded web site and a dedicated
+machine I would think of (note 400Mb is just for example):
<P>
<PRE> Available to webserver RAM: 400Mb
@@ -1429,8 +1445,8 @@
MaxSpareServers: 35
</PRE>
<P>
-However if I want to use the server for many other tasks but make it
-capable of the high load, I'd think of:
+However if I want to use the server for many other tasks, but make it
+capable of handling a high load, I'd think of:
<P>
<PRE> Available to webserver RAM: 400Mb
@@ -1441,77 +1457,100 @@
MaxSpareServers: 10
</PRE>
<P>
-(These numbers are taken from the head and it shouldn't be used as rule,
-but to show you some possible scenarios. Use this information wisely!)
+(These numbers are taken off the top of my head, and it shouldn't be used
+as a rule, but rather as examples to show you some possible scenarios. Use
+this information wisely!)
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Summary_of_Benchmarking_to_tune_">Summary of Benchmarking to tune all 5 parameters</A></H2></CENTER>
<P>
-OK, we run various benchmarks and what are the conclusions:
+OK, we've run various benchmarks let's summarize the conclusions:
<UL>
<P><LI><STRONG><A NAME="item_MaxRequestsPerChild">MaxRequestsPerChild</A></STRONG>
<P>
-If your scripts are clean and don't leak the memory set this variable to a
-number as big as possible (10000?). If you use Apache::SizeLimit, you can
-set this parameter to 0 (equal to infinity).
+If your scripts are clean and don't leak memory, set this variable to a
+number as large as possible (10000?). If you use
+<CODE>Apache::SizeLimit</CODE>, you can set this parameter to 0 (equal to infinity).
<P><LI><STRONG><A NAME="item_StartServers">StartServers</A></STRONG>
<P>
-If you keep a little number of servers most of the time, keep this number
-low. Especially if MaxSpareServers is low and it'll kill the just loaded
-servers before they were utilized at all (if there is no load). If your
-service is heavily loaded make this number close to
-<CODE>MaxClients</CODE> (and keep MaxSpareServers equal to <CODE>MaxClients</CODE> as well)
+If you keep a small number of servers active most of the time, keep this
+number low. Especially if <CODE>MaxSpareServers</CODE> is low as it'll kill the just loaded servers before they were utilized at
+all (if there is no load). If your service is heavily loaded, make this
+number close to
+<CODE>MaxClients</CODE> (and keep <CODE>MaxSpareServers</CODE> equal to <CODE>MaxClients</CODE> as well.)
<P><LI><STRONG><A NAME="item_MinSpareServers">MinSpareServers</A></STRONG>
<P>
-If your server performs other work except web serving, make it low so the
-memory will be freed when there is no big load. If you server's load is
-like a wave (you get a load in bursts) and you want a fast respond for all
-clients at any time you will want to make it high, so new children will be
-respawned in advance.
+If your server performs other work besides web serving, make this low so
+the memory of unused children will be freed when there is no big load. If
+your server's load varies (you get loads in bursts) and you want fast
+response for all clients at any time, you will want to make it high, so
+that new children will be respawned in advance and be waiting to handle
+bursts of requests.
<P><LI><STRONG><A NAME="item_MaxSpareServers">MaxSpareServers</A></STRONG>
<P>
-The logic is the same as of MinSpareServers - low if need the machine for
-other tasks, high if it's web dedicated and you want the minimal delay on
-responses.
+The logic is the same as of <CODE>MinSpareServers</CODE> - low if you need the machine for other tasks, high if it's a dedicated web
+host and you want a minimal response delay.
<P><LI><STRONG><A NAME="item_MaxClients">MaxClients</A></STRONG>
<P>
-Not too low, so you don't get a situation where clients are waiting for
-server to start serving them. (they might wait, but not too long). Don't
-make it high, since if you get a high load and all requests will be
-immediately granted your CPU will have a hard times and if child's size *
-number of running children is bigger than the total available RAM, your
-server will start swapping (which will slow down everything, which in turn
-will make things even more slower, until eventually your machine will die).
-It's important that you make sure that no swap will be normally used. Swap
-is an emergency pool, not a resource to be used on the constant basis. If
-you low on memory and you badly need it - buy it, the memory is amazingly
-cheap these days. But based on the test I conducted above, even if you have
-a plenty of memory like I have (1Gb), pulling <CODE>MaxClients</CODE> sometimes will give you no speedup. The more clients are running the more
-CPU will be utilized, the less CPU time slices each process will receive,
-the latency (the to process the request) will grow, so you didn't get an
-improve. The best approach is to find the minimum requirement for your kind
-of service and the maximum capability of your machine, then start at the
-minimum and start testing like I did, by raising this parameter, until you
-find the point where the curve on the latency or throughput graph stops to
-raise or the ramp becomes smaller. Stop there and use it. Of course when
-you use these parameters in production server, you will have the ability to
-tune them more precisely. Also don't forget that if you add more scripts,
-most probably that the parameters need to be recalculated, since the
-processes will grow in size as you compile in more code.
+Not too low, so you don't get into a situation where clients are waiting
+for the server to start serving them (they might wait, but not too long).
+Don't make it high, since if you get a high load and all requests will be
+immediately granted, your CPU will have a hard time keeping up, and if the
+child's size * number of running children is larger than the total
+available RAM, your server will start swapping (which will slow down
+everything, which in turn will make things even more slower, until
+eventually your machine could die). It's important that you take pains to
+ensure that swapping does not normally happen. Swap space is an emergency
+pool, not a resource to be used on a consistent basis. If you are low on
+memory and you badly need it - buy it, memory is amazingly cheap these
+days. But based on the test I conducted above, even if you have plenty of
+memory like I have (1Gb), increasing <CODE>MaxClients</CODE> sometimes will give you no speedup. The more clients that are running, the
+more CPU time will be required, the less CPU time slices each process will
+receive. The response latency (the time to respond to a request) will grow,
+so you won't see the expected improvement. The best approach is to find the
+minimum requirement for your kind of service and the maximum capability of
+your machine. Then start at the minimum and start testing like I did,
+successively raising this parameter until you find the point on the curve
+of the graph of the latency or throughput where the improvement becomes
+smaller. Stop there and use it. Of course when you use these parameters in
+production server, you will have the ability to tune them more precisely.
+Also don't forget that if you add more scripts, most probably that the
+parameters need to be recalculated, since the processes will grow in size
+as you compile in more code.
</UL>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Preopen_DB_connection_at_server_">Preopen DB connection at server startup:</A></H1></CENTER>
+<P>
+If you use DBI for DB connections, you can preopen connections to DB for
+each child with Apache::DBI.
+
+<P>
+<PRE> use Apache::DBI ();
+ Apache::DBI->connect_on_init("DBI:mysql:test", 'login','passwd',
+ {
+ RaiseError => 1,
+ PrintError => 1,
+ AutoCommit => 1,
+ };
+</PRE>
+<P>
+See also <A HREF="#Persistent_DB_Connections">Persistent DB Connections</A>.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Persistent_DB_Connections">Persistent DB Connections</A></H1></CENTER>
<P>
-Another popular use of mod_perl is to take advantage of it's persistence to
-maintain open database connections. The basic idea goes like so:
+Another popular use of mod_perl is to take advantage of its ability to
+maintain persistent open database connections. The basic approach is as
+follows:
<P>
<PRE> #Apache::Registry script
@@ -1521,37 +1560,34 @@
$dbh ||= SomeDbPackage->connect(...);
</PRE>
<P>
-Since <CODE>$dbh</CODE> is a global variable for the child, once the child
-has opened the connection it will use it over and over again, unless you
-perform <CODE>disconnect().</CODE>
+Since <CODE>$dbh</CODE> is a global variable for the child, once the child has opened the
+connection it will use it over and over again, unless you perform <CODE>disconnect()</CODE>.
<P>
Be careful to use different names for handlers if you open connection to
-different Databases!
+different databases!
<P>
-Apache::DBI - allows to make a persistent database connection. With this
-module enabled every connect request to plain DBI module will be forwarded
-to the Apache::DBI module. This looks if a database handle from a previous
-connect request is already stored and if this handle is still valid using
+<CODE>Apache::DBI</CODE> allows you to make a persistent database connection. With this module
+enabled, every connect request to the plain DBI module will be forwarded to
+the <CODE>Apache::DBI</CODE> module. This looks to see whether a database handle from a previous connect
+request has already been opened, and if this handle is still valid using
the ping method. If these two conditions are fulfilled it just returns the
database handle. If there is no appropriate database handle or if the ping
method fails, a new connection is established and the handle is stored for
-later re-use. <STRONG>There is no need to delete the disconnect statements from
-your code</STRONG>. They would not do anything because the Apache::DBI module overloads the
-disconnect method with a NOP. On child exit there is no explicit
-disconnect, the child dies and so does the database connection.
+later re-use. <STRONG>There is no need to delete the disconnect
+statements from your code</STRONG>. They will not do anything, as the
+<CODE>Apache::DBI</CODE> module overloads the disconnect method with a NOP. On child exit there is
+no explicit disconnect, the child dies and so does the database connection.
<P>
-The usage is simple:
+The usage is simple -- add to <CODE>httpd.conf</CODE>:
<P>
-<PRE> httpd.conf
- ----------
- PerlModule Apache::DBI
+<PRE> PerlModule Apache::DBI
</PRE>
<P>
-It is important, to load this module before any other ApacheDBI module !
+It is important, to load this module before any other <CODE>ApacheDBI*</CODE> module!
<P>
<PRE> a script.perl
@@ -1563,7 +1599,7 @@
{ autocommit => 0 }
) || die $DBI::errstr;
- ...rest of program
+ ...rest of the program
</PRE>
<P>
The module provides the additional method:
@@ -1574,41 +1610,40 @@
<P>
This can be used as a simple way to have apache children establish
connections on server startup. This call should be in a startup file
-(PerlModule, <Perl> or PerlRequire). It will establish a connection
-when a child is started in that child process. See the Apache::DBI manpage
-to see the requirements for this method.
+(PerlModule, <Perl> or PerlRequire). It will establish a connection when a child is
+started in that child process. See the <CODE>Apache::DBI</CODE>
+manpage to see the requirements for this method.
<P>
-However be warned that some old DBD drivers are not supporting this feature
-(ping method), so check the documentation of the driver you use.
+Beware however, as some old DBD drivers do not support this feature (ping
+method), so check the documentation of the driver you use.
<P>
-Another problem are timeouts: some databases disconnect the client after a
-certain time of inactivity. ping method ensures that this will not happen.
-Some DBD drivers don't have this method, check the Apache::DBI manpage to
-see how to write a ping method.
+Another problem is with timeouts: some databases disconnect the client
+after a certain time of inactivity. The ping method ensures that this will
+not happen. Some DBD drivers don't have this method, check the Apache::DBI
+manpage to see how to write a ping method.
<P>
-Also some folks at list suggested to change the timeout of the server (they
-talked specifically about mysql). So starting from 3.22.x you can set a
-wait_timeout option at mysqld server startup to change the default value,
-setting it to 24 hours probably will fix the timeout problem.
+Another approach is to change the client's connection timeout. Starting
+from mysql-3.22.x you can set a <CODE>wait_timeout</CODE>
+option at mysqld server startup to change the default value, setting it to
+36 hours probably would fix the timeout problem.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Using_1_under_mod_perl_and_be">Using $|=1 under mod_perl and better print() techniques.</A></H1></CENTER>
<P>
-As you know <CODE>$|=1;</CODE> disables the buffering of the currently selected file handle (default is
-STDOUT). If you enable it, <CODE>ap_rflush()</CODE> is being called after
-each <CODE>print()</CODE>, unbuffering Apache's IO.
+As you know <CODE>$|=1;</CODE> disables the buffering of the currently selected file handle (default is <CODE>STDOUT</CODE>). If you enable it, <CODE>ap_rflush()</CODE>
+is called after each <CODE>print()</CODE>, unbuffering Apache's IO.
<P>
-If you are using a _bad_ style of output generating, which consist of
-multiply <CODE>print()</CODE> calls or you just have too many of them, you will experience a degradation
+If you are using a _bad_ style in generating output, which consist of
+multiple <CODE>print()</CODE> calls, or you just have too many of them, you will experience a degradation
in performance. The severity depends on the number of the calls.
<P>
-Many old CGIs were written in style of:
+Many old CGIs were written in the style of:
<P>
<PRE> print "<BODY BGCOLOR="black" TEXT="white">";
@@ -1619,9 +1654,9 @@
print "</BODY>";
</PRE>
<P>
-which reveals the following drawbacks: multiply <CODE>print()</CODE> calls - performance degradation with $|=1, backslashism which makes the
-code unreadable and difficulty to format the HTML to be easily readable as
-CGI's output. The code below solves them all:
+which reveals the following drawbacks: multiple <CODE>print()</CODE> calls - performance degradation with $|=1, backslashism which makes the
+code less readable and more difficult to format the HTML to be easily
+readable as CGI's output. The code below solves them all:
<P>
<PRE> print qq{
@@ -1634,7 +1669,7 @@
};
</PRE>
<P>
-I guess you see the difference. Be careful though, when printing the
+I guess you see the difference. Be careful though, when printing a
<CODE>&lt;HTML&gt;</CODE> tag. The correct way is:
<P>
@@ -1644,7 +1679,7 @@
}
</PRE>
<P>
-If you use the approach bellow:
+If you try the following:
<P>
<PRE> print qq{
@@ -1654,37 +1689,60 @@
}
</PRE>
<P>
-Some older browsers might not accept the output as HTML, and print it as a
-plain text, since they expect the first characters after the headers and
-empty line to be <CODE>&lt;HTML&gt;</CODE> and not spaces and/or additional newline and then <CODE>&lt;HTML&gt;</CODE>. Even if it works in your browser it might not work in other.
+Some older browsers might not accept the output as HTML, but rather print
+it as a plain text, since they expect the first characters after the
+headers and empty line to be <CODE>&lt;HTML&gt;</CODE> and not spaces and/or additional newline and then <CODE>&lt;HTML&gt;</CODE>. Even if it works with your browser, it might not work for others.
<P>
-Now let's go back to the <CODE>$|=1</CODE> topic. I still disable the buffering, for 2 reasons: I use few <CODE>print()</CODE> calls and I want my users to get the output immediately. So if I am about
+Now let's go back to the <CODE>$|=1</CODE> topic. I still disable buffering, for 2 reasons: I use few <CODE>print()</CODE> calls and I want my users to see the output immediately. So if I am about
to produce the results of the DB query, which might take some time to
-complete, I want user to get some headers which improves the usability of
-my site. Recall yourself - what do you like better: getting the output
-``slowly'' but steadily or having to watch the ``falling stars'' for awhile
-and then getting the whole output at once (if browser did not timeout till
-then).
+complete, I want users to get some titles ahead. This improves the
+usability of my site. Recall yourself:
<P>
-Conclusion: Do not follow blind suggestions but think what is best for you
-in every given case.
+What do you like better: getting the output ``slowly'' but steadily or
+having to watch the ``falling stars'' for awhile and then to receive the
+whole output at once (if the browser did not timeout till then).
+
+<P>
+Conclusion: Do not blindly follow suggestions, but think what is best for
+you in every given case.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="More_Reducing_Memory_Usage_Tips">More Reducing Memory Usage Tips</A></H1></CENTER>
+<P>
+One of the important issues in improving the performance is reduction of
+memory usage - the less memory each server uses, the more server processes
+you can start, and thus the more performance you have (from the user's
+point of view - the response speed )
+
+<P>
+See <A HREF="././porting.html#Global_Variables">Global Variables</A>
+
+
+
+<P>
+See <A HREF="././porting.html#Memory_leakage">Memory "leakages"</A>
+
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Profiling">Profiling</A></H1></CENTER>
<P>
-Profiling will help you to determine which subroutines are using the most
-time and which subroutines are being called most often, then you will
-probably will want to optimize those, if your code is a way heavy.
+Profiling will help you to determine which subroutines or just snippets of
+code take the longest execution time and which subroutines are being called
+most often, then you will probably will want to optimize those, and to
+improve the code toward efficiency.
<P>
-It is possible to profile code run under mod_perl with the
-<CODE>Devel::DProf</CODE> module available on CPAN. However, you must have apache version 1.3b3 or
-higher and the PerlChildExitHandler enabled. When the server is started, <CODE>Devel::DProf</CODE> installs an END block to write the tmon.out file, which will be run when
-the server is shutdown. Here is how to start and stop a server with the
-profiler enabled:
+It is possible to profile code running under mod_perl with the
+<CODE>Devel::DProf</CODE> module, available on CPAN. However, you must have apache version 1.3b3 or
+higher and the <CODE>PerlChildExitHandler</CODE>
+enabled. When the server is started, <CODE>Devel::DProf</CODE> installs an
+<CODE>END</CODE> block to write the <CODE>tmon.out</CODE> file, which will be called at the server shutdown. Here is how to start and
+stop a server with the profiler enabled:
<P>
<PRE> % setenv PERL5OPT -d:DProf
@@ -1695,10 +1753,9 @@
% dprofpp
</PRE>
<P>
-The <CODE>Devel::DProf</CODE> package is a Perl code profiler. This will collect information on the
-execution time of a Perl script and of the subs in that script. This
-information can be used to determine which subroutines are using the most
-time and which subroutines are being called most often.
+The <CODE>Devel::DProf</CODE> package is a Perl code profiler. It will collect information on the
+execution time of a Perl script and of the subs in that script (remember
+that that <CODE>print()</CODE> and <CODE>map()</CODE> are subs as well, they come together with Perl!).
<P>
Another approach is to use <CODE>Apache::DProf</CODE>, which hooks
@@ -1717,7 +1774,7 @@
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="CGI_pm_s_object_methods_calls_vs">CGI.pm's object methods calls vs. function calls</A></H1></CENTER>
<P>
-What approach is better?
+Which approach is better?
<P>
<PRE> use CGI;
@@ -1733,8 +1790,7 @@
</PRE>
<P>
There is not any performance benefit of using the object calls rather than
-the function calls, but there is a real memory hit when you import all of
-CGI.pm's function calls into the process memory. This can be significant,
+the function calls, but there is a real memory hit when you import all of <CODE>CGI.pm</CODE>'s function calls into your process memory. This can be significant,
particularly when there are many child daemons.
<P>
@@ -1772,7 +1828,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.6 +4 -7 modperl-site/guide/perl.html
Index: perl.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/perl.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- perl.html 1999/06/05 17:47:23 1.5
+++ perl.html 1999/06/19 21:15:12 1.6
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Perl Reference</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.17 +23 -30 modperl-site/guide/porting.html
Index: porting.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/porting.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- porting.html 1999/06/05 17:47:23 1.16
+++ porting.html 1999/06/19 21:15:12 1.17
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: CGI to mod_perl Porting. mod_perl Coding guidelines.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -56,19 +53,15 @@
<LI><A HREF="#Turning_warnings_ON">Turning warnings ON</A>
<LI><A HREF="#diagnostics_pragma">diagnostics pragma</A>
<LI><A HREF="#Global_Variables">Global Variables</A>
+ <LI><A HREF="#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="#Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A>
<LI><A HREF="#Memory_leakage">Memory leakage</A>
</UL>
- <LI><A HREF="#Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A>
<LI><A HREF="#Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A>
- <UL>
-
- <LI><A HREF="#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
- <LI><A HREF="#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
- <LI><A HREF="#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
- </UL>
-
+ <LI><A HREF="#Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A>
+ <LI><A HREF="#The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A>
+ <LI><A HREF="#Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A>
<LI><A HREF="#Redirecting_Errors_to_Client_ins">Redirecting Errors to Client instead of error_log</A>
<LI><A HREF="#Finding_the_line_number_the_erro">Finding the line number the error/warning has been triggered at</A>
<LI><A HREF="#Forking_subprocesses_from_mod_pe">Forking subprocesses from mod_perl</A>
@@ -732,6 +725,16 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A></H2></CENTER>
+<P>
+To pass an environment variable from a configuration file, add to it:
+
+<P>
+<PRE> PerlSetEnv key val
+ PerlPassEnv key
+</PRE>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H2><A NAME="Code_has_been_changed_but_it_se">Code has been changed, but it seems the script is running the old code</A></H2></CENTER>
<P>
Files pulled in via <STRONG>use</STRONG> or <STRONG>require</STRONG> statements are not automatically reloaded when changed on disk. See <A HREF="././obvious.html#Reloading_Modules_and_Required_F">Reloading Modules and Required Files</A> for more info.
@@ -1010,16 +1013,6 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H1><A NAME="Passing_ENV_variables_to_CGI">Passing ENV variables to CGI</A></H1></CENTER>
-<P>
-To pass an environment variable from a configuration file, add to it:
-
-<P>
-<PRE> PerlSetEnv key val
- PerlPassEnv key
-</PRE>
-<P>
-<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Filehandlers_and_locks_leakages">Filehandlers and locks leakages</A></H1></CENTER>
<P>
At the beginning there was:
@@ -1062,7 +1055,7 @@
</PRE>
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A></H2></CENTER>
+<CENTER><H1><A NAME="Sometimes_it_Works_Sometimes_it_">Sometimes it Works Sometimes it does Not (Very important!)</A></H1></CENTER>
<P>
When you start running your scripts under mod_perl, you might find yourself
in situation where a script seems to work, but sometimes it screws up. And
@@ -1074,7 +1067,7 @@
<P>
Generally the problem you have is using global variables. Since global
variables don't change from one script invocation to another unless you
-change it, you can find your scripts do ``fancy'' things.
+change them, you can find your scripts do ``fancy'' things.
<P>
The first example is amazing -- Web Services. Imagine that you enter some
@@ -1146,7 +1139,7 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A></H2></CENTER>
+<CENTER><H1><A NAME="The_Script_is_too_dirty_It_does">The Script is too dirty, It does the job and I can't afford rewriting it.</A></H1></CENTER>
<P>
You still can win from using mod_perl.
@@ -1186,7 +1179,7 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
-<CENTER><H2><A NAME="Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A></H2></CENTER>
+<CENTER><H1><A NAME="Apache_PerlRun_a_closer_look">Apache::PerlRun - a closer look</A></H1></CENTER>
<P>
Apache::PerlRun gives you a benefit of preloaded perl and its modules. This
module's handler emulates the CGI environment, allowing programmers to
@@ -1558,7 +1551,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/12/1999
</FONT>
</B>
</TD>
1.15 +254 -34 modperl-site/guide/scenario.html
Index: scenario.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/scenario.html,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- scenario.html 1999/06/05 17:47:24 1.14
+++ scenario.html 1999/06/19 21:15:13 1.15
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Real World Scenarios Implementaion</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -30,6 +27,14 @@
<UL>
<LI><A HREF="#Before_you_dive_into_the_gory_de">Before you dive into the gory details</A>
+ <LI><A HREF="#Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A>
+ <UL>
+
+ <LI><A HREF="#Installation_in_10_lines">Installation in 10 lines</A>
+ <LI><A HREF="#Installation_in_10_paragraphs">Installation in 10 paragraphs</A>
+ <LI><A HREF="#Configuration_Process">Configuration Process</A>
+ </UL>
+
<LI><A HREF="#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
<UL>
@@ -92,6 +97,223 @@
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H1><A NAME="Standalone_mod_perl_Enabled_Apac">Standalone mod_perl Enabled Apache Server</A></H1></CENTER>
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Installation_in_10_lines">Installation in 10 lines</A></H2></CENTER>
+<P>
+The Installation is very very simple (example from Linux OS):
+
+<P>
+<PRE> % cd /usr/src
+ % lwp-download <A HREF="http://www.apache.org/dist/apache_x.x.x.tar.gz">http://www.apache.org/dist/apache_x.x.x.tar.gz</A>
+ % lwp-download <A HREF="http://perl.apache.org/dist/mod_perl-x.xx.tar.gz">http://perl.apache.org/dist/mod_perl-x.xx.tar.gz</A>
+ % tar zvxf apache_x.xx.tar.gz
+ % tar zvxf mod_perl-x.xx.tar.gz
+ % cd mod_perl-x.xx
+ % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \
+ USE_APACI=1 DO_HTTPD=1 PERL_MARK_WHERE=1 ALL_HOOKS=1
+ % make && make test && make install
+ % cd ../apache_x.x.x/src
+ % make install
+</PRE>
+<P>
+That's all!
+
+<P>
+Notes: Replace x.x.x with the real version numbers of mod_perl and apache.
+gnu tar uncompresses as well (with z flag).
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Installation_in_10_paragraphs">Installation in 10 paragraphs</A></H2></CENTER>
+<P>
+First download the sources of both packages, e.g. you can use
+<CODE>lwp-download</CODE> utility to do it. <CODE>lwp-download</CODE> is a part of the LWP (or libwww) package, you will need to have it
+installed in order for mod_perl's <CODE>make test</CODE> to pass. Once you install this package unless it's already installed, <CODE>lwp-download</CODE> will be available for you as well.
+
+<P>
+<PRE> % lwp-download <A HREF="http://www.apache.org/dist/apache_x.x.x.tar.gz">http://www.apache.org/dist/apache_x.x.x.tar.gz</A>
+ % lwp-download <A HREF="http://perl.apache.org/dist/mod_perl-x.xx.tar.gz">http://perl.apache.org/dist/mod_perl-x.xx.tar.gz</A>
+</PRE>
+<P>
+Extract both sources. Generally I open all the sources in
+<CODE>/usr/src/</CODE>, your mileage may vary. So move the sources and cd to the directory you
+want to put the sources in. Gnu <CODE>tar</CODE> utility knows to uncompress too with z flag, if you have a non-gnu <CODE>tar</CODE> utility, it will be incapable to decompress, so you would do it in 2 steps,
+first uncompressing the packages with <CODE>gzip -d apache_x.xx.tar.gz</CODE> and
+<CODE>gzip -d mod_perl-x.xx.tar.gz</CODE>. And untarring them with <CODE>tar xvf
+apache_x.xx.tar</CODE> and <CODE>tar xvf mod_perl-x.xx.tar</CODE>.
+
+<P>
+<PRE> % cd /usr/src
+ % tar zvxf apache_x.xx.tar.gz
+ % tar zvxf mod_perl-x.xx.tar.gz
+</PRE>
+<P>
+Change to the mod_perl source directory.
+
+<P>
+<PRE> % cd mod_perl-x.xx
+</PRE>
+<P>
+Now build the make file, for a basic work and first time installation the
+parameters in the example below are the only ones you would need. <CODE>APACHE_SRC</CODE> tells where the apache <src> directory is. If you have followed my
+advice and extracted the sources under the same directory (e.g.
+</usr/src>), the following is correct.
+
+<P>
+<PRE> % perl Makefile.PL APACHE_SRC=../apache_x.x.x/src \
+ USE_APACI=1 DO_HTTPD=1 PERL_MARK_WHERE=1 ALL_HOOKS=1
+</PRE>
+<P>
+There are many additional parameters. You can find some of them in the
+configuration dedicated chapter and other sections where any of them
+becomes relevant. While running <CODE>perl Makefile.PL ...</CODE> the process will check for prerequisites and tell you if something is
+missing, If you are missing some of the perl packages or other software you
+will have to install these before you proceed.
+
+<P>
+Now we <STRONG>make</STRONG> the project (by building the mod_perl extension and calling <CODE>make</CODE> in apache source directory to build a <CODE>httpd</CODE>),
+<STRONG>make test</STRONG> it (by running various tests) and install the mod_perl modules.
+
+<P>
+<PRE> % make && make test && make install
+</PRE>
+<P>
+Note that if <CODE>make</CODE> fails, non of the <CODE>make test</CODE> and <CODE>make
+install</CODE> will be not executed. If <CODE>make test</CODE> fails, <CODE>make install</CODE>
+will be not executed.
+
+<P>
+Now change to apache source directory and run <CODE>make install</CODE> to install apache's headers, default configuration files, build apache
+directory tree and put the <CODE>httpd</CODE> there.
+
+<P>
+<PRE> % cd ../apache_x.x.x/src
+ % make install
+</PRE>
+<P>
+When you execute the above command, apache installation process will tell
+you how can you start the webserver (the path of the <apachectl>,
+more about it later) and where the configuration files are. Remember (or
+even better write down) both for you will need this information very soon.
+On my machine they 2 important paths are:
+
+<P>
+<PRE> /usr/local/apache/bin/apachectl
+ /usr/local/apache/conf/httpd.conf
+</PRE>
+<P>
+Now the build and the installation processes are completed. Just configure <CODE>httpd.conf</CODE> and start the webserver.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
+<CENTER><H2><A NAME="Configuration_Process">Configuration Process</A></H2></CENTER>
+<P>
+A basic configuration is a simple one. First configure the apache as you
+always do (like setting a correct <CODE>Port</CODE>, <CODE>User</CODE>, <CODE>Group</CODE>, log-file and other file paths and etc), start the server and make sure it
+works. One of the ways to start and stop the server is to use
+<CODE>apachectl</CODE> utility:
+
+<P>
+<PRE> /usr/local/apache/bin/apachectl start
+ /usr/local/apache/bin/apachectl stop
+</PRE>
+<P>
+Put the server down, open the <CODE>httpd.conf</CODE> in your favorite editor and scroll to the end of the file, where we will
+add the mod_perl configuration directives (of course you can place them
+anywhere in the file).
+
+<P>
+Add the following configuration directives:
+
+<P>
+<PRE> Alias /perl/ /home/httpd/perl/
+</PRE>
+<P>
+Assuming that you put all your scripts that should be executed under
+mod_perl into <CODE>/home/httpd/perl/</CODE> directory.
+
+<P>
+<PRE> PerlModule Apache::Registry
+ <Location /perl>
+ SetHandler perl-script
+ PerlHandler Apache::Registry
+ Options ExecCGI
+ PerlSendHeader On
+ allow from all
+ </Location>
+</PRE>
+<P>
+Now put a test script into <CODE>/home/httpd/perl/</CODE> directory:
+
+<P>
+<PRE> test.pl
+ -------
+ #!/usr/bin/perl -w
+ use strict;
+ print "Content-type: text/html\r\n\r\n";
+ print "It worked!!!\n";
+ -------
+</PRE>
+<P>
+Make it executable and readable by server, if your server is running as
+user <CODE>nobody</CODE> (hint see <CODE>User</CODE> directive in <CODE>httpd.conf</CODE> file), do the following:
+
+<P>
+<PRE> chown nobody /home/httpd/perl/test.pl
+ chmod u+rx /home/httpd/perl/test.pl
+</PRE>
+<P>
+Test that the script is running from the command line, by executing it:
+
+<P>
+<PRE> /home/httpd/perl/test.pl
+</PRE>
+<P>
+You should see:
+
+<P>
+<PRE> Content-type: text/html
+
+ It worked!!!
+</PRE>
+<P>
+Now it is a time to test our mod_perl server, assuming that your config
+file includes <CODE>Port 80</CODE>, go to your favorite Netscape browser and fetch the following URL:
+
+<P>
+<PRE> <A HREF="http://localhost/perl/test.pl">http://localhost/perl/test.pl</A>
+</PRE>
+<P>
+(Assuming that you have a loop-back device configured, if not use the real
+server name for this test (e.g. <CODE>http://www.nowhere.com/perl/test.pl</CODE>)
+
+<P>
+You should see:
+
+<P>
+<PRE> It worked!!!
+</PRE>
+<P>
+If something went wrong, go through the installation process again, and
+make sure you didn't make a mistake. If that doesn't help, read the <CODE>INSTALL</CODE> pod document (<CODE>perlpod INSTALL</CODE>) in the mod_perl distribution directory.
+
+<P>
+Now migrate your CGI scripts into a <CODE>/home/httpd/perl/</CODE> directory and see them working much much faster, from the newly configured
+base URL (<CODE>/perl/</CODE>). Not all of your scripts will work unchanges, but many will.
+
+<P>
+The above setup is very basic, it will help you to have a mod_perl enabled
+server running.
+
+<P>
+As with <STRONG>perl</STRONG> you can start benefit from <STRONG>mod_perl</STRONG> from the very first moment you try it. When you become more familiar with
+mod_perl you will want to start writing apache handlers and deploy more of
+the mod_perl power.
+
+<P>
+<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A></H1></CENTER>
<P>
Since we run two apache servers we will need two different configuration
@@ -948,7 +1170,9 @@
</PRE>
<P>
<CODE>PPR</CODE> is the saving grace here, that makes Apache a win over Squid. That cleans
-up redirects and stuff to remove the :81 from the URIs. Very nice.
+up redirects and stuff to remove the :81 from the URIs. Very nice. If you
+want to use mod_proxy to proxy pass more than one port, you probably want
+to take a look at mod_rewrite.
<P>
You can control the buffering feature with <CODE>ProxyReceiveBufferSize</CODE>
@@ -990,39 +1214,22 @@
. Basically, that module adds an extra HTTP header to proxying requests.
You can access that header in the mod_perl-enabled server, and set the IP
of the remote server. You won't need to compile anything into the back-end
-server, just put something like the following into your mod_perl handler:
-
-<P>
-<PRE> my $real_client;
- if (defined($real_client = $::r->header_in('X-Forwarded-For'))) {
- $::r->connection->remote_ip($real_client);
- }
-</PRE>
-<P>
-See how it works? From that point on, the remote IP address is correct.You
-should be able to access REMOTE_ADDR as usual.
-
-<P>
-If you are using <CODE>Apache::{Registry,PerlRun}</CODE> - do it like this:
-
-<P>
-in startup.pl:
+server, if you are using <CODE>Apache::{Registry,PerlRun}</CODE> just put something like the following into <CODE>start-up.pl</CODE>:
<P>
-<PRE> sub My::ProxyRemoteAddr ($) {
- my $r = shift;
-
+<PRE> sub My::ProxyRemoteAddr ($) {
+ my $r = shift;
+
# we'll only look at the X-Forwarded-For header if the requests
# comes from our proxy at localhost
return OK unless ($r->connection->remote_ip eq "127.0.0.1");
-
- my @ip = split(/,\s*/, $r->header_in('X-Forwarded-For'));
- if (my $ip = pop(@ip)) {
- $r->connection->remote_ip($ip);
+
+ if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
+ $r->connection->remote_ip($ip);
}
return OK;
- }
+ }
</PRE>
<P>
And in <CODE>httpd.conf</CODE>:
@@ -1031,6 +1238,19 @@
<PRE> PerlPostReadRequestHandler My::ProxyRemoteAddr
</PRE>
<P>
+Different sites have different needs. If you're using the header to set the
+ip address Apache believes it is dealing with (in the logging and stuff)
+you really don't want anyone but your own system to set the header.
+
+<P>
+That's why the above ``recommanded code'' includes a check for where the
+request really is coming from before we change remote_ip.
+
+<P>
+From that point on, the remote IP address is correct. You should be able to
+access <CODE>REMOTE_ADDR</CODE> as usual.
+
+<P>
You could do the same thing with other environment variables (though I
think several of them are preserved, you will want to run some tests to see
which ones).
@@ -1105,7 +1325,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/05/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.3 +4 -7 modperl-site/guide/security.html
Index: security.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/security.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- security.html 1999/06/05 17:47:24 1.2
+++ security.html 1999/06/19 21:15:13 1.3
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Protecting Your Site</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.14 +4 -7 modperl-site/guide/snippets.html
Index: snippets.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/snippets.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- snippets.html 1999/06/05 17:47:25 1.13
+++ snippets.html 1999/06/19 21:15:13 1.14
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Code Snippets</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.14 +4 -7 modperl-site/guide/start.html
Index: start.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/start.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- start.html 1999/05/17 20:47:38 1.13
+++ start.html 1999/06/19 21:15:13 1.14
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Guide's Overview</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.14 +4 -7 modperl-site/guide/status.html
Index: status.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/status.html,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- status.html 1999/06/05 17:47:25 1.13
+++ status.html 1999/06/19 21:15:14 1.14
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: mod_perl Status. Peeking into the Server's Perl Innards</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
1.4 +36 -20 modperl-site/guide/strategy.html
Index: strategy.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/strategy.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- strategy.html 1999/06/05 17:47:26 1.3
+++ strategy.html 1999/06/19 21:15:14 1.4
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Choosing the Right Strategy</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -57,7 +54,8 @@
<CENTER><H1><A NAME="Do_it_like_me_">Do it like me?!</A></H1></CENTER>
<P>
There is no such a thing as a single <STRONG>RIGHT</STRONG> strategy in web server business, though there are many wrong ones. Never
-believe a person who says: <EM>"Do it this way, this is the best!"</EM>. As the old saying goes: <EM>"Trust but verify"</EM>. There are too many technologies out there to choose from, and it would
+believe a person who says: <EM>"Do it this way, this is the best!"</EM>. As the old saying goes:
+<EM>"Trust but verify"</EM>. There are too many technologies out there to choose from, and it would
take an enormous investment of time and money to try to validate each one
before deciding which is the best choice for your situation. Keeping this
idea in mind, I will present some different combinations of mod_perl and
@@ -111,12 +109,15 @@
more state-of-the-art-yet-suspiciously-new DSO system, or to the forth
option which gives you even more power.
+<OL>
+<P><LI>
<P>
The first option will kill your production site if you serve a lot of
static data with ~2-12 MB webserver processes. On the other hand, while
testing you will have no other server interaction to mask or add to your
errors.
+<P><LI>
<P>
The second option allows you to seriously tune the two servers for maximum
performance. On the other hand you have to deal with proxying or fancy site
@@ -124,6 +125,7 @@
need to choose between running the two servers on multiple ports, multiple
IPs, etc... This adds the burden of administrating more than one server.
+<P><LI>
<P>
The third option (DSO) -- as mentioned above -- means playing with the
bleeding edge. In addition <CODE>mod_so</CODE> (the DSO module) adds size and complexity to your binaries. With DSO,
@@ -131,16 +133,16 @@
modules are even shared among multiple servers. Again, it is bleeding edge
and still somewhat platform specific, but your milegue may vary. See <A HREF="././scenario.html#mod_perl_server_as_DSO">mod_perl server as DSO</A>.
+<P><LI>
<P>
The fourth option (proxy in http accelerator mode), once correctly
configured and tuned, improves performance by caching and buffering page
results.
+</OL>
<P>
The rest of this chapter discusses the pros and the cons of each of these
-presented configurations.
-<A HREF="././scenario.html#">Real World Scenarios Implementaion</A>
-describes the implementation techniques of these schemas.
+presented configurations. <A HREF="././scenario.html#">Real World Scenarios Implementaion</A> describes the implementation techniques of these schemas.
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
@@ -227,12 +229,11 @@
started.
<P>
-And of course, if your site is serving only mod_perl scripts, this might be
-the perfect choice for you!
+And of course, if your site is serving only mod_perl scripts (close to zero
+static objects, like images), this might be the perfect choice for you!
<P>
-For implementation notes see :
-<A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+For implementation notes see : <A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
@@ -329,11 +330,14 @@
</UL>
<P>
-For implementation notes see :
-<A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+Before you go on with this solution you really want to look at the
+<A HREF="././strategy.html#Adding_a_Proxy_Server_in_http_Ac">Adding a Proxy Server in http Accelerator Mode</A> section.
+<P>
+For implementation notes see : <A HREF="././scenario.html#One_Plain_and_One_mod_perl_enabl">One Plain and One mod_perl enabled Apache Servers</A>
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="One_light_non_Apache_and_One_mod">One light non-Apache and One mod_perl enabled Apache Servers</A></H1></CENTER>
@@ -362,6 +366,13 @@
uses only 260k - 100 times less! You could use the saved 30M to run more
mod_perl servers.
+<P>
+Note that this is not true if your OS supports memory sharing and you
+configured apache to use it (it is a DSO approach. There is no memory
+sharing if apache modules are being statically compiled into httpd). If you
+do allow memory sharing -- 30 light apache servers ought to use about 3-4Mb
+only, because most of it will be shared. Than the save-ups with <STRONG>thttpd</STRONG> are much smaller.
+
<P><LI>
<P>
Reported to be about 5 times faster then plain apache serving static
@@ -375,7 +386,7 @@
<P><LI>
<P>
Lacks some of apache's features, like access control, error redirection,
-customizable logfile formats, and so on.
+customizable logfile formats, and so on.
</UL>
<P>
@@ -404,7 +415,7 @@
<P><LI>
<P>
Allow serving of static objects from the proxy's cache (objects that
-previously were entirely served by the httpd_docs server).
+previously were entirely served by the httpd_docs server).
<P><LI>
<P>
@@ -464,6 +475,11 @@
allows for only your public ``bastion'' accelerating www server to get
hosed in a successful attack, while leaving your internal data safe.
+<P><LI>
+<P>
+You can have the <CODE>mod_proxy</CODE> process serve your static documents from disk to ``kill two birds with one
+stone''.
+
</UL>
<P>
The disadvantages are:
@@ -675,7 +691,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.15 +7 -9 modperl-site/guide/warnings.html
Index: warnings.html
===================================================================
RCS file: /export/home/cvs/modperl-site/guide/warnings.html,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- warnings.html 1999/06/05 17:47:26 1.14
+++ warnings.html 1999/06/19 21:15:14 1.15
@@ -2,13 +2,10 @@
<HTML>
<HEAD>
<TITLE>mod_perl guide: Runtime Warnings and Errors: Where and Why.</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; AIX 4.1) [Netscape]">
- <META NAME="Author" CONTENT="Bekman Stas">
- <META NAME="Description" CONTENT="All Apache/Perl related information: Hints,
-Guidelines, Scenarios and Troubleshottings">
- <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed
-fast guide mod_perl apache guide help info faq mod_perl installation cgi
-troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
+ <META NAME="GENERATOR" CONTENT="Pod2HTML [Perl/Linux]">
+ <META NAME="Author" CONTENT="Stas Bekman">
+ <META NAME="Description" CONTENT="All Apache/Perl related information: Hints, Guidelines, Scenarios and Troubleshottings">
+ <META NAME="keywords" CONTENT="mod_perl modperl perl apache cgi webserver speed fast guide mod_perl apache guide help info faq mod_perl installation cgi troubleshooting help no sex speedup free open source OSS mod_perl apache guide">
</HEAD>
<LINK REL=STYLESHEET TYPE="text/css"
HREF="style.css" TITLE="refstyle">
@@ -75,8 +72,9 @@
<CENTER><H1><A NAME="Incorrect_line_number_reporting_">Incorrect line number reporting in error/warn log messages</A></H1></CENTER>
<P>
See <A HREF="././warnings.html#Use_of_uninitialized_value_at_e">Use of uninitialized value at (eval 80) line 12.</A>
-=head1 Incorrect line number reporting in error/warn log messages
+
+
<P>
<P><B><FONT SIZE=-1><A HREF="#toc">[TOC]</A></FONT></B><HR WIDTH="100%"></P>
<CENTER><H1><A NAME="Value_of_x_will_not_stay_shared">Value of $x will not stay shared at - line 5</A></H1></CENTER>
@@ -433,7 +431,7 @@
<B>
<FONT SIZE=-1>
Written by <A HREF="help.html#This_document_s_Author">Stas Bekman</A>.
- <BR>Last Modified at 06/04/1999
+ <BR>Last Modified at 06/19/1999
</FONT>
</B>
</TD>
1.1 modperl-site/guide/mod_perl_guide.ps.gz
<<Binary file>>