Ignore:
Timestamp:
11/24/08 01:10:49 (4 years ago)
Author:
KennethLavrsen
Message:

Item221: Updated more TWiki:Codev links and fixing general TWiki strings
now that I have to closely read the topics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PublicCacheAddOn/twpc/PublicCacheAddOn.txt

    r878 r898  
    11---+ Public Cache Add-On 
    22<table align='right'><tr><td bgcolor='#eeeeee'>%TOC%</table> 
    3 Makes TWiki surviving being   
     3Makes Foswiki surviving being   
    44[[http://en.wikipedia.org/wiki/Slashdot_effect][Slashdotted]] 
    55- serves pages 100 times faster. 
    66---++ Goals 
    77I made this addon for people (like me) wanting to have their personal (or 
    8 small group) *public web site* on a TWiki. The problems I want to address are 
     8small group) *public web site* on a Foswiki. The problems I want to address are 
    99thus the ones important for this scenario: 
    1010   * many *more reads* and readers than edits and authors 
    1111   * extreme *performance*, serving a page in few 100th of a second. 
    1212   * huge *spikes* of visitors, being able to survive a slashdot effect. It  
    13      should handle 10000 simultaneous requests on a TWiki topic on a 1Ghz  
     13     should handle 10000 simultaneous requests on a Foswiki topic on a 1Ghz  
    1414     machine. It does this by locking to ensure only one process tries to  
    1515     build a page at a time, reducing tremendously the load on the server, even 
     
    3030     cycle: you must not have to have to 
    3131     refresh manually a page to see the edits you just did to it. 
    32    * *compatible* should work with all TWiki features, options and plugins  
     32   * *compatible* should work with all Foswiki features, options and plugins  
    3333     (or most of them: not the ones trying to show 
    3434     different things to different people). Most important are features  
     
    4343     just fast). 
    4444 
    45 This caching system has thus different goals than TWiki:Codev/TWikiCache that 
     45This caching system has thus different goals than Foswiki:Development.FoswikiCache that 
    4646will accelerate even page builds, in an exact and optimal way, but will be 
    4747less slashdot-resistant, and the mod_perl, speedycgi, persistent perl perl 
     
    8686force refresh of pages or webs that change without human editing (for instance 
    8787blog pages showing "Edited N days ago"), you must position the  
    88 =PUBLIC_CACHE_EXPIRE= TWiki variable to the number of seconds after which the 
     88=PUBLIC_CACHE_EXPIRE= Foswiki macro to the number of seconds after which the 
    8989cache will be automatically cleared. Note that as this will be performed by the 
    9090next run of the crontab job =pccl=, normally each 3 minutes. 
     
    101101=%<nop>INCLUDE{http://some.site/external}%= automatically sets a  
    102102=PUBLIC_CACHE_EXPIRE= of the default value, if not already set by an  
    103 explicit declaration. This variable is a normal TWiki variable, so you can use 
     103explicit declaration. This variable is a normal Foswiki macro, so you can use 
    104104it in a web preferences to set a cache policy to a whole web. 
    105105 
     
    108108__Note:__ You do not need to install anything on the browser to use this 
    109109add-on. The following instructions are for the administrator who installs the 
    110 add-on on the server where TWiki is running.  
     110add-on on the server where Foswiki is running.  
    111111 
    112112   * Download the TGZ file from the Add-on Home (see below) 
     
    116116   * if you are *upgrading from a version before 4.0*, 
    117117      * first do a =./uninstall TWIKI_DIR/bin= 
    118       * in your TWiki site, search for all occurences of =PCACHEEXPTIME= vars, 
     118      * in your Foswiki site, search for all occurences of =PCACHEEXPTIME= vars, 
    119119        and replace them with declarations  
    120120        <br> =* Set PUBLIC_CACHE_EXPIRE = 1= (1, or the previous value =NNN= of 
     
    130130     clean duty every 3 minutes, as 
    131131     <br> =*/3 * * * * test -x TWIKI_DIR/bin/pccl && TWIKI_DIR/bin/pccl= 
    132    * the install script will install small patches to the TWiki code, in 
    133      =lib/TWiki.pm=, =lib/TWiki/Func.pm=, and =lib/TWiki/UI/View.pm=. The 
     132   * the install script will install small patches to the Foswiki code, in 
     133     =lib/Foswiki.pm=, =lib/Foswiki/Func.pm=, and =lib/Foswiki/UI/View.pm=. The 
    134134     patches are clearly surrounded by =#TWikiPublicCacheAddOn_Patch...=  
    135135     comments 
    136    * If you *update your TWiki* install, or install afterwards the 
    137      Foswiki:Extensions/NewsPlugin or TWiki:TagMePlugin (or any future plugin 
    138      calling the =TWiki::Func::saveFile= function,you must re-do an  
     136   * If you *update your Foswiki* install, or install afterwards the 
     137     Foswiki:Extensions/NewsPlugin or System:TagMePlugin (or any future plugin 
     138     calling the =Foswiki::Func::saveFile= function,you must re-do an  
    139139     =install -u= in order to apply the patches above. 
    140140   * To be sure people notified of changes by email will actually see the 
     
    146146     <br /> to check every hour for uncached pages and build them 
    147147 
    148 Note that the argument can just be TWIKI_DIR if your TWiki perl scripts 
     148Note that the argument can just be TWIKI_DIR if your Foswiki perl scripts 
    149149dir is in the standard place (as a =bin/= subdirectory), otherwise you must 
    150 give the actual path of your TWiki perl scripts directory. 
     150give the actual path of your Foswiki perl scripts directory. 
    151151 
    152152To update, or change options, just redo install. This will clear the cache. type =./install -h= to see options, i.e: 
     
    160160   * =-eseconds= default value for %<nop>PUBLIC_CACHE_EXPIRE% (defaults to 3600) 
    161161   * -wWebList=  make pcad build menu and pcge default mode not rebuild  
    162      these webs. List is comma-separated. (defaults to -wMain,TWiki,Sandbox,Trash) 
     162     these webs. List is comma-separated. (defaults to -wMain,System,Sandbox,Trash) 
    163163   * =-v=    verbose: logs a lot of things in data/twpc-debug.txt 
    164164 
     
    237237 
    238238---+++ Tips 
    239    * Use robots.txt on your site to prevent browsing the TWiki web. e.g, 
    240      <br> =Disallow: /bin/view/TWiki= 
     239   * Use robots.txt on your site to prevent browsing the System web. e.g, 
     240     <br> =Disallow: /bin/view/System= 
    241241     <br> You may want to also disallow access to Main, Sandbox, and Trash. 
    242      Why? The TWiki web represent often an important (more than 500 pages) 
    243      part of a TWiki web site. This has the drawback of 
     242     Why? The System web represent often an important (more than 500 pages) 
     243     part of a Foswiki web site. This has the drawback of 
    244244      * Making search engines produce less relevant results for your site 
    245         (your personal contents will be diluted into the TWiki docs) 
     245        (your personal contents will be diluted into the Foswiki docs) 
    246246      * Google has a time limit for browsing a site. He may thus only crawl 
    247         part of your TWiki site on first run and not index your actual content 
    248       * As the cache will be totally cleared on edits, it means that the TWiki 
     247        part of your Foswiki site on first run and not index your actual content 
     248      * As the cache will be totally cleared on edits, it means that the Foswiki 
    249249        cache will be re-computed over and over on crawling by search 
    250250        engines, consuming needless CPU and bandwidth 
    251    * Use a perl accelerator: TWiki:Codev/ModPerl, TWiki:Codev/SpeedyCGI or  
    252      TWiki:Codev/PersistentPerl 
     251   * Use a perl accelerator: Mod-Perl, Speedy CGI or Persistent Perl 
    253252 
    254253---++ Implementation 
     
    268267     without caching it. 
    269268   * the "cache builder", *pcbd* (shell) calls the copy of the original  
    270      TWiki view script (named *vief*) to make it build the page, and save  
     269     Foswiki view script (named *vief*) to make it build the page, and save  
    271270     it in normal and gzipped versions. If it cannot get it (read-protected  
    272271     page) it saves a marker to remember not trying to build it and  
    273272     directly delegate to vief. 
    274    * an automatically installed TWiki plugin *PublicCachePlugin* (perl)  
     273   * an automatically installed Foswiki plugin *PublicCachePlugin* (perl)  
    275274     installs just an afterSaveHandler hook to track the changes in topics,  
    276275     and save the IP Adress of the client browser that edited the page as a  
     
    305304   * Cached pages have ETags so that the browser will not even re-download 
    306305   them if they have not changed. 
    307    * TWiki code is slightly patched (some lines in TWiki.pm, to set 
     306   * Foswiki code is slightly patched (some lines in Foswiki.pm, to set 
    308307   =%<nop>PUBLIC_CACHE_EXPIRE%= on inclusion of external urls).  
    309308   The patch consists of the lines between 
    310309   =#TWikiPublicCacheAddOn_PatchInclude_START= and  
    311310   =#TWikiPublicCacheAddOn_PatchInclude_END= . 
    312    After a TWiki update,  
     311   After a Foswiki update,  
    313312   just reinstall this addon. This patch work with 4.x versions, and 
    314313   probably newer ones. But it is just for convenience to avoid putting  
    315314   =Set PUBLIC_CACHE_EXPIRE= by hand on all topics using  
    316315   =%<nop>INCLUDE{external-url}% 
    317    * If you use TWiki:Codev/ModPerl, TWiki:Codev/SpeedyCGI or TWiki:Codev/PersistentPerl, check that you enable 
     316   * If you use mod-perl, Speedy CGI or Persistent Perl, check that you enable 
    318317     it also for =bin/vief= for better performance, and *disable it for view*, as it 
    319318     no more a perl file and will crash your server 
     
    335334   * linux (or any unix with GNU utilities, but untested) 
    336335   * TWiki Cairo, Dakar, Edinburgh, Freetown, ... (3.0 -> 4.2). Should work on 
    337      any version at it is very disconnected from TWiki perl code. Warning: 
     336     any version at it is very disconnected from TWiki/Foswiki perl code. Warning: 
    338337     Cairo(3.0) is only supported in the version 3.1 of this plugin 
    339338   * Changes to pages not resulting from an edit will not be shown 
     
    366365---++ Performance, benchmarks 
    367366Current performance: (celeron 1Ghz, 512M RAM, Apache 1.3, 150 max processes) 
    368 for 20 simultaneous requests for the same TWiki page: 
     367for 20 simultaneous requests for the same Foswiki page: 
    369368|*Configuration*|*First run, empty cache*|*2nd run, cache built*| 
    370369| Normal 4.2  | 143s load 20 | 143s load 20 | 
    371 | TWiki:Codev/TWikiCache  | 66s load 12 | 65s load 11 | 
     370| Foswiki:Development.FoswikiCache  | 66s load 12 | 65s load 11 | 
    372371| Cairo+mod_perl+koalaskin  | 28s load 8 | 18s load 9 | 
    373372| Cairo+speedy+koalaskin | 20s load 6 | 17s load 8 | 
     
    394393<br> =i=1000;while let 'i-->0';do curl -s --compressed <nop>http://mytwiki/bin/view/System/Macros >/dev/null& done; time wait= 
    395394 
    396 Note that it does *not* mean this cache is better that  TWiki:Codev/TWikiCache 
     395Note that it does *not* mean this cache is better that  Foswiki:Development.FoswikiCache 
    397396for all uses. If you just look at the time to load a single page: 
    398397|*Configuration*|*1rst time*|*2nd time*| 
     
    400399| Normal+speedy  | 6s | 5.5s | 
    401400| publiccache  | 6s | 0.06s | 
    402 | TWiki:Codev/TWikiCache  | 4.3s | 3.3s | 
    403 | TWiki:Codev/TWikiCache + speedy  | 4.5s | 3s | 
    404 You can see that !TWikiCache will be better suited for intranet sites, and the 
     401| Foswiki:Development.FoswikiCache  | 4.3s | 3.3s | 
     402| Foswiki:Development.FoswikiCache + speedy  | 4.5s | 3s | 
     403You can see that !FoswikiCache will be better suited for intranet sites, and the 
    405404only option if you use access control or have personalized views anyways. And 
    406405my "benchmark" is really braindead and do not model typical use. And it only 
     
    412411   * Set SHORTDESCRIPTION = Fast cache geared for public site usage 
    413412 
    414 |  Add-on Author: | TWiki:Main.ColasNahaboo | 
    415 |  Copyright: | &copy; 2008, TWiki:Main.ColasNahaboo | 
     413|  Add-on Author: | Foswiki:Main.ColasNahaboo | 
     414|  Copyright: | &copy; 2008, Foswiki:Main.ColasNahaboo | 
    416415|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    417416|  Add-on Version: | 12 Apr 2008 (V4.006) | 
     
    438437|  29 Jan 2008: | algorithm v2, beta, autoconfig | 
    439438|  13 Jan 2008: | Initial version, v1, alpha | 
    440 TWiki Dependency: | $TWiki::Plugins::VERSION 1.020 (TWiki 3.0) | 
     439Foswiki Dependency: | $Foswiki::Plugins::VERSION 1.020 (TWiki 3.0) | 
    441440|  CPAN Dependencies: | LWP::Simple File::Path | 
    442441|  Other Dependencies: | bash, sed, wget, grep, crontab, cc (optional), ... | 
     
    448447__Related Topic:__ %SYSTEMWEB%.ContributedAddOns 
    449448 
    450 -- TWiki:Main/ColasNahaboo 
     449-- Foswiki:Main/ColasNahaboo 
Note: See TracChangeset for help on using the changeset viewer.