view website/tips.html @ 3:9a472dab7e09

more new documentation
author robcast
date Mon, 12 Dec 2011 20:37:53 +0100
parents 8abbc40d0df5
children
line wrap: on
line source

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>digilib -- Digital Image Library</title>
</head>
<body>
  <table border="0" cellspacing="0" cellpadding="10">
    <tr>
      <td bgcolor="#a0a0a0">&nbsp;</td>
      <td>
        <img src="images/digilib-logo-big.png" align="left" />
        <h1>
          <tt>digilib</tt> -- a versatile image viewing environment for the internet
        </h1>
      </td>
    </tr>
    <tr>
      <td bgcolor="#a0a0a0" valign="top" align="right">
        <p>
          <b><a href="index.html">Info</a> </b>
        </p>
        <p>
          <b><a href="http://developer.berlios.de/projects/digilib/">Project</a> </b>
        </p>
        <p>
          <b><a href="http://developer.berlios.de/project/showfiles.php?group_id=251">Download</a>
          </b>
        </p>
        <p>
          <b><a href="docs.html">Docs</a></b>
          <br />
          <a href="build-maven.html">Building</a>
          <br />
          <a href="digilib-config.html">Configuring</a>
          <br />
          <a href="http://developer.berlios.de/docman/?group_id=251">...more</a>
        </p>
        <p>
          <b><a href="tips.html">Tips</a> </b>
        </p>
        <p>
          <b><a href="http://hg.berlios.de/repos/digilib">Source</a> </b>
        </p>
      </td>
      <td>


        <p>Some tips for running digilib</p>
        <ul>
          <li>
            <a href="#vm_settings">Java VM settings for digilib</a>
          </li>
          <li>
            <a href="#prescaled_images">Prescaled images</a>
          </li>
          <li>
            <a href="#installing_jai">Installing JAI</a>
          </li>
        </ul>

        <h1 id="vm_settings">Java VM settings for digilib</h1>

        <p>The Java virtual machine (Java-VM) only uses a fixed amount of memory for
          its operations. When an operation needs more memory than available it aborts
          with an error ("out of memory error").</p>
        <p>digilib can need a lot of memory depending on the size and type of images.
          Since digilib runs as a servlet under Tomcat its in the same VM as the Tomcat
          server.</p>
        <p>The amount of memory Tomcat (version 5.0) uses is configured by creating a
          "setenv.sh" script with a line</p>
        <pre> CATALINA_OPTS="-Xmx512m"
</pre>
        <p>in Tomcat's "bin" directory (giving 512MB in this case).</p>
        <p>
          You can check the amount of memory your digilib instance has available on the
          bottom of the web page /server/dlConfig.jsp in your digilib instance (e.g. <a
            href="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/server/dlConfig.jsp"
            class="external free" rel="nofollow">http://digilib.mpiwg-berlin.mpg.de/digitallibrary/server/dlConfig.jsp</a>).
        </p>

        <h1 id="prescaled_images">Prescaled images</h1>

        <p>You can provide any number of scaled-down versions of your images that
          digilib uses when a smaller version of an image is requested. Since less data
          has to be read and processed this can speed up digilib's performance quite a
          lot.</p>
        <p>The actual process is that the client requests a certain target size,
          digilib scans all available scaled-down versions of the same image, selects the
          smallest image that is larger than the requested size and scales it down to the
          requested size.</p>
        <p>The scaled-down versions of the image have to have the same file name as
          the original hi-res file. They can have a different type and extension (e.g.
          img002.jpg for img002.TIFF)</p>
        <p>The scaled down images have to be in the same subdirectory (the part that
          shows up in digilib's "fn" parameter) as the hi-res file. The first part of each
          directory tree is configured by the basedir-list parameter in
          digilib-config.xml.</p>
        <p>The sequence of directories in basedir-list is from hi-res to lo-res.
          Images must be present in the hires directory but they need not be present in
          all lower-res directories.</p>
        <p>e.g. if digilib-config.xml contains</p>
        <pre> &lt;parameter name="basedir-list" value="/images:/scaled:/thumb" /&gt;
</pre>
        <p>and a user requests the image "books/book1/page0002" digilib looks for</p>
        <pre> /thumb/books/book1/page0002.*
 /scaled/books/book1/page002.*
 /images/books/book1/page002.*
</pre>
        <p>and uses the first image that is bigger than or equal to the requested
          size.</p>
        <p>
          For batch-prescaling our images we use a script called "scale-o-mat" that uses a
          lot of freely available imaging libraries (ImageMagick, libtiff, netpbm) and is
          available in our public CVS <a
            href="http://itgroup.mpiwg-berlin.mpg.de/cgi-bin/cvsweb.cgi/scaleomat/"
            class="external autonumber" rel="nofollow">[1]</a>. The script is given a
          hi-res base directory, a destination base directory, a destination size and a
          starting directory. It then processes all files in the starting directory and
          all its subdirectories and creates scaled images in corresponding directories
          under the destination base directory.
        </p>
        <p>We currently use prescaled thumbnails of 100 pixels and images for browser
          display of 1500 pixels. Remember that the prescaled image has to be larger (or
          the same size) than the requested image size!</p>
        <p>There is another optimization in digilib: if the requested image is exactly
          the same size and type as the prescaled image then the prescaled image is sent
          unmodified to the client which is a lot faster. So it makes sense to produce
          thumbnails of exactly 90 pixels width when they are used in an HTML page where
          all images are 90 pixels wide.</p>


        <h1 id="installing_jai">Installing JAI</h1>

        <p>
          In theory you can install the <a
            href="http://java.sun.com/javase/technologies/desktop/media/jai/"
            class="external text" rel="nofollow">Java Advanced Imaging</a> and JAI-ImageIO
          JAR files <code>jai_core.jar, jai_codec.jar, jai_imageio.jar</code> (and native
          library files if available) in the <code>/WEB-INF/lib/</code> directory of the
          digilib web application.
        </p>
        <p>But there are classloader issues. Newer versions of Tomcat refuse to load
          the libraries and I found that in some cases digilib stopped reading TIFF files
          after a period of running.</p>
        <p>
          In these cases it helped to install the JAI files in Tomcats <code>lib/</code>
          directory or Jettys <code>lib/ext/</code> or globally in the local Java JDK
          installation (i.e. in the Java's /jre/lib/ext/ directory on linux).
        </p>


        <h1 id="mpiwg_setup">Sample setup</h1>

        <p>The current digilib setup at the MPIWG (as of December 2010):</p>
        <ul>
          <li>
            One frontend server running the lightweight web-multiplexer <a
              href="http://www.apsis.ch/pound/" class="external text" rel="nofollow">pound</a>
            on port 80 that distributes requests to three servers runnning digilib
          </li>
          <li>
            the three servers run digilib under <a
              href="http://www.eclipse.org/jetty/" class="external text"
              rel="nofollow">Jetty</a> on port 8080 without Apache
            <ul>
              <li>one server is the frontend server (Linux 32bit, Dual
                2.4GHz Xeon, 2GB RAM)</li>
              <li>the other server is a separate, newer machine (Linux 64bit, Dual 1.8GHz
                Opteron, 2GB RAM)</li>
              <li>the third server is a separate, newer machine (Linux 32bit, Dual 2.8GHz
                Xeon, 4GB RAM)</li>
            </ul>
          </li>
          <li>
            the digilib instances (digilib 2.0b1 as of 12.12.2011) run on Jetty 8.0.4 on Java
            1.6.0_26 with 1GB of <a href="#vm_settings">Java VM memory
              for digilib</a> (-Xmx1024m) with JAI (1.1.3) and JAI-ImageIO (1.1) <a
              href="#installing_jai">installed in the Jetty/lib/ext</a>(!)
          </li>
          <li>both digilib servers access all image files over NFS (over GBit
            Ethernet) from a central file server (Solaris 10, Sun Fire 240, multiple RAIDs
            on Fibrechannel)</li>
        </ul>

      </td>
    </tr>
    <tr>
      <td style="padding: 0px" align="left">
        <a href="http://developer.berlios.de"> <img
          src="http://developer.berlios.de/bslogo.php?group_id=0&type=1" width="124"
          height="32" border="0" alt="BerliOS Logo" />
        </a>
      </td>
      <td></td>
    </tr>
  </table>

</body>
</html>