JPIP Server

From Helioviewer Wiki

Jump to: navigation, search

Contents

Introduction

The JPIP server is capable to handle the following types of JPEG2000 image files: raw J2C, JP2 and JPX with or without hyperlinks. The codestreams of the images must comply with the following requirements:

  • No tiles partition is allowed.
  • The progression order must be LRCP, RLCP or RPCL.
  • PLT markers must be included with the information of all the packets.

If the image is compressed using the "kdu_compress" tool of the Kakadu SDK, we should include the parameters "Corder=RPCL" and "ORGgen_plt=yes", avoding any tiling parameter like "Stiles" or "Stile_origin".

When one image does not fit these requirements then it can not be served by this server. In its log files we could see the some messages similar to the following ones when trying to serve an incompatible image:

2011-11-09 15:04:49,986: src/jpeg2000/file_manager.cc:217: ERROR: The code-stream does not include any PLT marker
2011-11-09 15:04:49,986: src/jpeg2000/index_manager.cc:62: ERROR: The image file '/var/www/jp2/file.jpx' can not be read
2011-11-09 15:04:49,986: src/client_manager.cc:129: ERROR: The image file '/var/www/jp2/file.jpx' can not be read

Moreover, although they are not mandatory, the following requirements are strongly recommended:

  • No tile-parts.
  • Use the RPCL progression order.
  • Use an appropriate precinct partition.

The JPIP server does not transcode the images at all, serving them as it. Therefore the last requirement is particularly recommended for big images in order to improve the transmission efficiency. For resolution levels bigger than 1024x1024 precincts of 512x512 or 256x256 are recommended.

Installation

In order to install the server it is necessary to get the code from Launchpad and compile it. The code of the server has been specifically written for Linux systems, so it has not been tested in any other platform.

For compiling the source code the libraries libproc, log4cpp and ligconfig++ must be installed, for developing, on the system. On Ubuntu, you can install the required libraries for compiling the JPIP server and building its documentation using the command:

sudo apt-get update && sudo apt-get install build-essential libproc-dev \
liblog4cpp5-dev libconfig++8-dev transfig texlive texlive-doc-en texlive-extra-utils \
texlive-fonts-extra texlive-formats-extra texlive-latex-extra texlive-math-extra

Just by means of one "make" the compilation is performed. If "make doc" is used, the documentation of the project in PDF is created automatically (Doxygen and LaTeX are required to be installed). The last documentation can be also found at this link: File:Esajpip refman.pdf.

In order to get running the application it is only necessary to modify the configuration file as needed and to have a caching directory with the write permission enabled for the server.

Configuration

The configuration of the different parameters of the server is carried out by means of the file "server.cfg", which must be located in the same directory where the server is launched. The structure of this file is:

  • Section "listen_at":
    • Field "port": Port used for listening.
    • Field "address": IP server address used for listening. This field can be empty meaning that the server will listen at any address available.
  • Section "folders":
    • Field "images": Root of the folder where the images to serve are stored.
    • Field "caching": Root of the folder to store the cache files.
    • Field "logging": Folder to store the log files.
  • Section "connections":
    • Field "time_out": It defines the timeout (in seconds) of every connection.
    • Field "max_number": The maximum number of simultaneous connections.
  • Section "general":
    • Field "logging": It indicates if the log file is created (1 - Yes, 0 - No).
    • Field "cache_max_time": Expiration time of the cache files, in seconds. If this value is less than zero it means that no expiration time is used for the cache files.
    • Field "max_chunk_size": Maximum chunk size used for transmission, in bytes.

Each time the server opens an image to be served, it creates a little associated cache file, if it does not exist yet, with the related indexing information, within the configured caching folder.

Here is an example of a configuration file, which is the default one included in the Launchpad repository:

listen_at =
{
  port = 8080;
  address = "";
};

folders =
{
  images = "../data";
  caching = "cache";
  logging = "log";
};

connections =
{
  time_out = 60;
  max_number = 500;
};

general =
{
  logging = 1;
  cache_max_time = -1;
  max_chunk_size = 1000;
};

Commands

The application accepts the following command line parameters:

esa_jpip_server [start]

It runs the server application.

esa_jpip_server status

It shows some information (memory, num. of connections, etc.) of the current server process. Currently the information shown is:

  • The available total memory.
  • The memory consumed by the father process.
  • The memory consumed by the child process.
  • The number of connections.
  • The number of iterations (the number of times that the child process has been restarted).
  • The number of threads of the child process.
  • The CPU usage of the child process.
esa_jpip_server record [name_file]

It shows the same information in columns, being updated every 5 seconds. It accepts a third parameter, a name of a file where to store this information.

esa_jpip_server stop [child]

Both processes or only the child process (depending on the second parameter) associated to the current server running are finished.

esa_jpip_server debug [child]

It calls the debugger for the parent or child process depending on the second parameter.

esa_jpip_server clean cache

It removes all the cache files from the cache root folder which have exceeded the "cache_max_time" field from the "server.cfg" file. It also removes the existing ".backup" files from the same directory.

buy lasix online
Personal tools