<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Blooki/0.4803" -->
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:cc="http://web.resource.org/cc/"
  xmlns="http://purl.org/rss/1.0/"
>

<channel rdf:about="http://blooki.org/2004/09/28/.rdf/">
  <title>Blooki</title>
  <link>http://blooki.org/2004/09/28/.rdf/</link>
  <description>Grow what you know</description>
  <dc:language>en</dc:language>
  <dc:creator>Paul Kulchenko</dc:creator>
  <dc:date>1970-01-01T00:00:00Z</dc:date>
  <admin:generatorAgent rdf:resource="http://www.blooki.org/" />

  <items>
    <rdf:Seq>
      <rdf:li rdf:resource="development/dynamic-publishing-bake-or-fry"/><rdf:li rdf:resource="download"/><rdf:li rdf:resource="install"/>
    </rdf:Seq>
  </items>
</channel>


  <item rdf:about="http://blooki.org/2004/09/28/.rdf/development/dynamic-publishing-bake-or-fry">
    <title>Dynamic Publishing: Bake or Fry?</title>
    <link>http://blooki.org/2004/09/28/.rdf/development/dynamic-publishing-bake-or-fry</link>
    <description>&lt;p&gt;I was reading Tim's &lt;a href="http://www.timaoutloud.org/archives/000361.html"&gt;MT 3.1 Dynamic Publishing Blues&lt;/a&gt; and it reminded me a topic I read almost two years ago -- &lt;a href="http://philringnalda.com/blog/2002/11/halfbaked_and_a_little_fried.php"&gt;Half baked and little fried&lt;/a&gt; -- about dynamic vs. static generation. The topic of Timothy's post is about controversy of recently introduced dynamic publishing in MovableType that uses &lt;span class="caps"&gt;PHP &lt;/span&gt;as its engine. While Ben Trott &lt;a href="http://groups.yahoo.com/group/mt-dev/message/580"&gt;explained their reasoning&lt;/a&gt; behind the decision I'm not sure I agree with him. &lt;/p&gt;

&lt;p&gt;In his analysis Ben describes several options and dismisses most of Perl related options as inefficient. Without considering speed of interpreters, I guess he is talking about startup penalty of perl interpreter that is called on every request. This cost is definitely there, but the solution reminds me advice to buy more hardware to solve a performance problem without looking at optimizing an algorithm that is being used. Let's look at it.&lt;/p&gt;

&lt;p&gt;The stated problem of reducing latency and server load can be solved in several ways:&lt;/p&gt;

&lt;p&gt;1. &lt;strong&gt;Expires and Last-Modified headers&lt;/strong&gt;. The script can return these headers (along with ETag) to make the page cacheable. The tricky part is to set proper Expires header. It should be long enough to minimize calls to the server and short enough to allow those calls when the content changes. This can be achieved by giving different values to different pages or even doing something similar to what google bot does visiting more often pages that change more frequently; +10% on expiration and -50% on modification may be a good start. Expires/Last-Modified also works well with static content (images, client-side scripts, and stylesheets). Expires header can be set to a fairly large value; if a file is updated, it can be served using a new &lt;span class="caps"&gt;URL.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;2. &lt;strong&gt;Handling of If-Modified-Since and If-None-Match&lt;/strong&gt;. The script should return 304 if content hasn't been modified. It doesn't even need to have a copy of the page; all it needs to know that it hasn't changed. It may be as simple as one LastModified time per blog/site for rarely updated sites that invalidates all caches; or as complex as dependency tracking to know exactly what information was used to generate a page.&lt;/p&gt;

&lt;p&gt;3. &lt;strong&gt;Local cache of generated pages&lt;/strong&gt;. The dependency check still needs to be done, but the page may already be generated and served from a local cache (likely file system). At this point most people would point out that all this can be done by saving generated pages as static pages and have them to be served by a webserver using little bit of mod_rewrite-like magic. While that's true, there are still several things that need to be addressed: &lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;Expires values need to be configured and they likely to be static&lt;/li&gt;
&lt;li&gt;Any custom headers need to be configured&lt;/li&gt;
&lt;li&gt;No personalization is possible (new since the last visit and other similar things)&lt;/li&gt;
&lt;li&gt;Authentication requests may need to be handled separately&lt;/li&gt;
&lt;li&gt;No parametrized request: pagination, searches and the like.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Pages can be cached (they can even be compressed) along with their headers and served when necessary. While this may be a viable option in many cases, there is still a question of how this cache should be in/validated: dependencies can be checked on every request, or they can be checked when pages are added/updated/deleted.&lt;/p&gt;

&lt;p&gt;4. &lt;strong&gt;Template fragment caching&lt;/strong&gt;. While the script may not cache the entire page, it still may be feasible to cache some of page fragments, especially the most time consuming or most frequently used, as recently updated items or list of subcategories that are likely to be used across many pages. This requires tracking of what fragment uses what information, so they can, again, be properly invalidated, but this may not be as complex as it seems.&lt;/p&gt;

&lt;p&gt;5. &lt;strong&gt;File/memory cache&lt;/strong&gt;. While template fragments may not be cached, the information that is necessary for page generation can be cached in memory (applicable to mod_perl, daemon and similar server solutions) or in files (this works well for filesystem-based solutions like &lt;a href="http://blooki.org"&gt;Blooki&lt;/a&gt;, &lt;a href="http://blosxom.com"&gt;Blosxom&lt;/a&gt;, and other file I/O hungry solutions). It is not necessary to cache all the information; in most cases modification date/time, title, and some meta information is enough.&lt;/p&gt;

&lt;p&gt;6. &lt;strong&gt;Access optimization&lt;/strong&gt;. This probably doesn't apply to &lt;span class="caps"&gt;MT, &lt;/span&gt;but it definitely applies to Blooki (which uses filesystem to store its information). Even when information is not available in a cache, it's still possible to optimize a process of getting this information. Blooki is super-lazy about getting the stuff it needs. First, it's driven by templates; if it's not requested by a templates it probably won't be processed. Second, it only read directories first without even stat'ing files in them. Then it only stat files if you ask for their modification times. And then it only reads their content if you ask for title, meta, or other information.&lt;/p&gt;

&lt;p&gt;7. &lt;strong&gt;Direct access&lt;/strong&gt;. If nothing else helps, then information has to be read and page has to be regenerated from scratch.&lt;/p&gt;

&lt;p&gt;Now, back to the original question: &lt;strong&gt;was it worth it&lt;/strong&gt;? Unfortunately, it's &lt;a href="http://groups.yahoo.com/group/mt-dev/message/574"&gt;not clear from the description&lt;/a&gt; if Perl is being used at all when &lt;span class="caps"&gt;PHP&lt;/span&gt;-based rendering is used, but as far as I understand it is (please correct me if I'm wrong). Switching from Perl to &lt;span class="caps"&gt;PHP &lt;/span&gt;only addresses items 2 and 3; doing everything else still requires Perl interpreter (and hence startup penalty). Now, both 2 and 3 can be quite effectively achieved by using a local proxy/cache, which some users may already have and for those that don't it is a one-time deal and is much easier than &lt;span class="caps"&gt;PHP &lt;/span&gt;engine integration. In my opinion the asnwer is clear.&lt;/p&gt;</description>
    <dc:subject>development/</dc:subject>
    <dc:date>2004-09-28T20:54:00Z</dc:date>
  </item>

  <item rdf:about="http://blooki.org/2004/09/28/.rdf/download">
    <title>Download</title>
    <link>http://blooki.org/2004/09/28/.rdf/download</link>
    <description>&lt;p&gt;&lt;strong&gt;Blooki 0.48 released 28 Sep 2004&lt;/strong&gt;. Available as &lt;a href="download/blooki-0.48.zip"&gt;&lt;strong&gt;.zip&lt;/strong&gt;&lt;/a&gt; and &lt;a href="download/blooki-0.48.tar.gz"&gt;&lt;strong&gt;.tar.gz&lt;/strong&gt;&lt;/a&gt; archives. Downloaded package can be &lt;a href="install"&gt;installed&lt;/a&gt; in just a few clicks. &lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Changes in the latest version (0.48 Tue Sep 28 01:13:32 2004)&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;fixed daemon detection in IfModule directive&lt;/li&gt;
&lt;li&gt;added Markdown filter&lt;/li&gt;
&lt;li&gt;added Excerpt filter (to generate 'see more...')&lt;/li&gt;
&lt;li&gt;added pagination for list of entries&lt;/li&gt;
&lt;li&gt;added next/previous for entry pages&lt;/li&gt;
&lt;li&gt;added better diagnostics on template error; now includes tag/variable names and parameters&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Nightly builds&lt;/strong&gt; can be downloaded here (&lt;a href="download/blooki-nightly.zip"&gt;&lt;strong&gt;.zip&lt;/strong&gt;&lt;/a&gt; and &lt;a href="download/blooki-nightly.tar.gz"&gt;&lt;strong&gt;.tar.gz&lt;/strong&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Licensed under &lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.0/"&gt;Creative Commons Attribution-NonCommercial-ShareAlike 2.0&lt;/a&gt;. &lt;/p&gt;</description>
    <dc:subject></dc:subject>
    <dc:date>2004-09-28T05:49:51Z</dc:date>
  </item>

  <item rdf:about="http://blooki.org/2004/09/28/.rdf/install">
    <title>Installation</title>
    <link>http://blooki.org/2004/09/28/.rdf/install</link>
    <description>&lt;p&gt;Blooki runs just anywhere where Perl runs. If you plan to run Blooki as a standalone server, there is nothing to install. Assuming &lt;code&gt;blooki-app&lt;/code&gt; is a current directory, the server can be started by running the following command: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;gt; perl blooki.pl --port 81 &lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Alternatively, if you have perl associated with .pl extension you should be able to just double click on blooki.pl file to start blooki daemon server. The server will use port 80 by default.&lt;br /&gt;
  &lt;br /&gt;
To install Blooki to use it with your webserver as &lt;span class="caps"&gt;CGI&lt;/span&gt;/mod_perl script type the following:&lt;/p&gt;



&lt;pre&gt;&lt;code&gt;  &amp;gt; perl Makefile.PL
  &amp;gt; make
  &amp;gt; make test
  &amp;gt; make install
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This will:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;Detect whether you have a webserver available to set proper default values&lt;/li&gt;
&lt;li&gt;Create Blooki configuration file populated with the values you enter&lt;/li&gt;
&lt;li&gt;Create .htaccess file(s) that match your configuration, and&lt;/li&gt;
&lt;li&gt;Copy all application and configuration files into proper locations.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;Users on Windows platform may try &lt;code&gt;nmake&lt;/code&gt; instead of &lt;code&gt;make&lt;/code&gt;. If no &lt;code&gt;make&lt;/code&gt; is available, then &lt;code&gt;Makefile.PL&lt;/code&gt; can be run with &lt;code&gt;--nomake&lt;/code&gt; option that will also install necessary files: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;gt; perl Makefile.PL --nomake &lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;You can still run tests using &lt;code&gt;perl test.pl&lt;/code&gt; command. &lt;/p&gt;

&lt;p&gt;The script will also detect whether you have mod_rewrite and mod_perl extensions available and will generate necessary configuration files based on information you provide.&lt;/p&gt;

&lt;p&gt;Although webserver detection in the installation script currently works only for Apache server, the way package and configuration files are organized should allow you to run Blooki with any other webserver with minimum or no changes.&lt;/p&gt;</description>
    <dc:subject></dc:subject>
    <dc:date>2004-09-28T05:12:41Z</dc:date>
  </item>


</rdf:RDF>
