comparison java-settings.html @ 1640:1ae8b89d3a86

Creating site for 2.5-SNAPSHOT
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Tue, 22 Aug 2017 16:38:19 +0000
parents
children 16be3440305b
comparison
equal deleted inserted replaced
-1:000000000000 1640:1ae8b89d3a86
1 <!DOCTYPE html>
2 <!--
3 | Generated by Apache Maven Doxia at 2017-08-22
4 | Rendered using Apache Maven Fluido Skin 1.3.0
5 -->
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <meta charset="UTF-8" />
9 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10 <meta name="Date-Revision-yyyymmdd" content="20170822" />
11 <meta http-equiv="Content-Language" content="en" />
12 <title>digilib - The Digital Image Library &#x2013; Java VM memory settings for digilib</title>
13 <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
14 <link rel="stylesheet" href="./css/site.css" />
15 <link rel="stylesheet" href="./css/print.css" media="print" />
16
17
18 <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
19
20
21 </head>
22 <body class="topBarDisabled">
23
24
25
26 <div class="container-fluid">
27 <div id="banner">
28 <div class="pull-left">
29 <a href="./" id="bannerLeft">
30 <h2>digilib - a versatile image viewing environment for the internet</h2>
31 </a>
32 </div>
33 <div class="pull-right"> <a href="./" id="bannerRight">
34 <img src="images/digilib-logo-small.png" />
35 </a>
36 </div>
37 <div class="clear"><hr/></div>
38 </div>
39
40 <div id="breadcrumbs">
41 <ul class="breadcrumb">
42
43
44 <li id="publishDate">Last Published: 2017-08-22</li>
45 <li class="divider">|</li> <li id="projectVersion">Version: 2.5-SNAPSHOT</li>
46
47
48
49
50 </ul>
51 </div>
52
53
54 <div class="row-fluid">
55 <div id="leftColumn" class="span3">
56 <div class="well sidebar-nav">
57
58
59 <ul class="nav nav-list">
60 <li class="nav-header">Overview</li>
61
62 <li>
63
64 <a href="index.html" title="About digilib">
65 <i class="none"></i>
66 About digilib</a>
67 </li>
68
69 <li>
70
71 <a href="features.html" title="digilib features">
72 <i class="none"></i>
73 digilib features</a>
74 </li>
75
76 <li>
77
78 <a href="digilib-short.html" title="How digilib works">
79 <i class="none"></i>
80 How digilib works</a>
81 </li>
82
83 <li>
84
85 <a href="history.html" title="Ancient history">
86 <i class="none"></i>
87 Ancient history</a>
88 </li>
89 <li class="nav-header">Installation</li>
90
91 <li>
92
93 <a href="install-digilib.html" title="Installing digilib">
94 <i class="none"></i>
95 Installing digilib</a>
96 </li>
97
98 <li>
99
100 <a href="build-maven.html" title="Building digilib">
101 <i class="none"></i>
102 Building digilib</a>
103 </li>
104 <li class="nav-header">Configuration</li>
105
106 <li>
107
108 <a href="digilib-config.html" title="Configuring digilib">
109 <i class="none"></i>
110 Configuring digilib</a>
111 </li>
112
113 <li>
114
115 <a href="image-directories.html" title="Directory layout">
116 <i class="none"></i>
117 Directory layout</a>
118 </li>
119
120 <li class="active">
121
122 <a href="#"><i class="none"></i>Java settings and tuning</a>
123 </li>
124
125 <li>
126
127 <a href="auth.html" title="Access control">
128 <i class="none"></i>
129 Access control</a>
130 </li>
131 <li class="nav-header">Development</li>
132
133 <li>
134
135 <a href="scaler-api.html" title="The digilib Scaler API">
136 <i class="none"></i>
137 The digilib Scaler API</a>
138 </li>
139
140 <li>
141
142 <a href="iiif-api.html" title="The digilib IIIF API">
143 <i class="none"></i>
144 The digilib IIIF API</a>
145 </li>
146
147 <li>
148
149 <a href="client-integration.html" title="Integrating digilib into your page">
150 <i class="none"></i>
151 Integrating digilib into your page</a>
152 </li>
153
154 <li>
155
156 <a href="plugins.html" title="Digilib plugins">
157 <i class="none"></i>
158 Digilib plugins</a>
159 </li>
160 <li class="nav-header">Project Documentation</li>
161
162 <li>
163
164 <a href="project-info.html" title="Project Information">
165 <i class="icon-chevron-right"></i>
166 Project Information</a>
167 </li>
168 </ul>
169
170
171
172 <hr class="divider" />
173
174 <div id="poweredBy">
175 <div class="clear"></div>
176 <div class="clear"></div>
177 <div class="clear"></div>
178 <a href="http://maven.apache.org/" title="Built by Maven" class="builtBy">
179 <img class="builtBy" alt="Built by Maven" src="http://maven.apache.org/images/logos/maven-feather.png" />
180 </a>
181 <a href="http://www.sourceforge.net/" title="Hosted by SourceForge" class="builtBy">
182 <img class="builtBy" alt="Hosted by SourceForge" src="http://upload.wikimedia.org/wikipedia/commons/0/0b/Sourceforge_logo.png" />
183 </a>
184 </div>
185 </div>
186 </div>
187
188
189 <div id="bodyColumn" class="span9" >
190
191 <h1>Java VM memory settings for digilib</h1>
192 <p>(Robert Casties, September 2013)</p>
193 <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 (&#x201c;out of memory error&#x201d;).</p>
194 <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>
195 <p>The amount of memory Tomcat (version 5.0) uses is configured by creating a <tt>setenv.sh</tt> (or <tt>setenbv.bat</tt>) script with a line</p>
196
197 <div class="source">
198 <div class="source">
199 <pre>CATALINA_OPTS=&quot;-Xmx512m&quot;
200 </pre></div></div>
201 <p>in Tomcat&#x2019;s <tt>bin</tt> directory (giving 512MB RAM in this case).</p>
202 <p>You can check the amount of memory your digilib instance has available on the bottom of the web page <tt>/server/dlConfig.jsp</tt> in your digilib instance (e.g. <a class="externalLink" href="http://localhost:8080/digilib/server/dlConfig.jsp">http://localhost:8080/digilib/server/dlConfig.jsp</a></p>
203 <h1>Installing JAI ImageIO</h1>
204 <p>(Robert Casties, September 2013)</p>
205 <p>In principle you should be able to install the <a class="externalLink" href="http://java.sun.com/javase/technologies/desktop/media/jai/">Java Advanced Imaging</a> JAI-ImageIO JAR file <tt>jai_imageio.jar</tt> (and native library files if available) in the <tt>/WEB-INF/lib/</tt> directory of the digilib web application as part of the default installation.</p>
206 <p>You can see if the Jai-ImageIO plugin is active by checking for the availability of the TIFF image format under &#x201c;Supported image types&#x201d; on the <a class="externalLink" href="http://localhost:8080/digilib/server/dlConfig.jsp"><tt>/server/dlConfig.jsp</tt></a> status page.</p>
207 <p>Sometimes there are problems with leaking memory. Newer versions of Tomcat refuse to load the libraries (see JREMemoryLeakPreventionListener) and I found that in some cases digilib stopped reading TIFF files after a period of running. In these cases it helped to install the JAI files in Tomcats <tt>lib/</tt> directory or globally in the local Java JDK installation (i.e. in the Java&#x2019;s &#x2018;jre/lib/ext/&#x2019; directory on linux).</p>
208 <p>If you really need to have the imageio-plugins JAR inside the web app, please consider using Harald Kuhrs <a class="externalLink" href="https://github.com/haraldk/TwelveMonkeys#deploying-the-plugins-in-a-web-app">IIOProviderContextListener</a>.</p>
209 <h1>Codec availability and Performance</h1>
210 <p>(Ubbo Veentjer, Oct 2015)</p>
211 <p>The number of image formats, which digilib may read or write, but also the performance of operating on this image formats depends on the ImageIO readers and writers available on the classpath.</p>
212 <p>Working with larger images in JPEG format we experienced a big performance difference using different implementations of the JPEG readers/writers. OpenJDK-7 for example brings rather slow JPEG codecs, OpenJDK-8 operates much quicker on JPEG images, relying on libjpeg-turbo for this file format. Also the official Oracle-JDKs may include faster native codecs. </p>
213 <p>Some drop-in replacements for the native codecs are:</p>
214
215 <ul>
216
217 <li><a class="externalLink" href="https://github.com/geosolutions-it/imageio-ext">https://github.com/geosolutions-it/imageio-ext</a></li>
218
219 <li><a class="externalLink" href="https://github.com/haraldk/TwelveMonkeys">https://github.com/haraldk/TwelveMonkeys</a></li>
220 </ul>
221 <p>if these jar files are availabe on the classpath, the codecs may be used by digilib. To add them the jar files could e.g. be placed in the lib directory of tomcat or addded as a dependency to the digilib maven project.</p>
222 <p>The actual codec implementation used is logged by digilib in debug mode, e.g.</p>
223
224 <div class="source">
225 <div class="source">
226 <pre>1564059 [http-apr-9092-exec-4] DEBUG digilib.image.DocuImage - ImageIO: this reader: class com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader
227 </pre></div></div>
228 <p>(Robert Casties, Oct 2015)</p>
229 <p>You can now use the TwelveMonkeys codecs instead of the default JAI-ImageIO by just <a href="build-maven.html">building digilib</a> with the Maven-Parameter <tt>imageio=12m</tt>:</p>
230
231 <div class="source">
232 <div class="source">
233 <pre>mvn -Dimageio=12m package
234 </pre></div></div>
235 <h1>Codec performance</h1>
236 <p>(Ubbo Veentjer, Oct 2015)</p>
237 <p>In our tests comparing the performance of OpenJDK7, OpenJDK8, imageio-ext and TwelveMonkeys codecs we experienced the following numbers for decoding, encoding and scaling a 4968px*5968px JPEG file with a color profile to 50% size: </p>
238
239 <div class="source">
240 <div class="source">
241 <pre>24801 ms - OpenJDK7
242 11507 ms - OpenJDK7 with com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader
243 4216 ms - OpenJDK7 with imageio-ext using libjpeg-turbo
244 3635 ms - OpenJDK8
245 </pre></div></div>
246 <p>This numbers may depend on the actual implementation used, the processing power of the CPU and many other factors, to this is just meant to be a rough hint.</p>
247 <p>For using imageio-ext, the native library needs to be available with the <tt>LD_LIBRARY_PATH</tt> environment variable (compare: <a class="externalLink" href="https://github.com/geosolutions-it/imageio-ext/wiki/TurboJPEG-plugin)">https://github.com/geosolutions-it/imageio-ext/wiki/TurboJPEG-plugin)</a>, also the .jar archives need to be on the classpath.</p>
248 <p>For using the TwelveMonkey Codecs we added the following jars to the tomcat lib directory, which were retrieved by maven (dependency on imageio-jpeg-3.1.2):</p>
249
250 <ul>
251
252 <li>common-image-3.1.2.jar</li>
253
254 <li>common-lang-3.1.2.jar</li>
255
256 <li>imageio-jpeg-3.1.2.jar</li>
257
258 <li>common-io-3.1.2.jar</li>
259
260 <li>imageio-core-3.1.2.jar</li>
261
262 <li>imageio-metadata-3.1.2.jar</li>
263 </ul>
264 <h1>Available image formats</h1>
265 <p>(Ubbo Veentjer, Oct 2015)</p>
266 <p>Digilib logs on startup which image formats are supported, e.g: </p>
267
268 <div class="source">
269 <div class="source">
270 <pre>9763 [localhost-startStop-1] INFO digilib.conf.DigilibConfiguration - DocuImage supported image formats: raw, jpeg, tif, WBMP, pcx, PNM, JPG, wbmp, JPEG, PNG, jpeg 2000, tiff, BMP, JPEG2000, RAW, jpeg2000, GIF, TIF, TIFF, bmp, jpg, PCX, pnm, png, gif,
271 </pre></div></div>
272 <p>by adding e.g. TwelveMonkeys or image-io ext codecs, more codecs could become available.</p>
273 </div>
274 </div>
275 </div>
276
277 <hr/>
278
279 <footer>
280 <div class="container-fluid">
281 <div class="row span12">Copyright &copy; 2001-2017
282 <a href="http://digilib.sourceforge.net">digilib Community</a>.
283 All Rights Reserved.
284
285 </div>
286
287
288
289 </div>
290 </footer>
291 </body>
292 </html>