Project

General

Profile

Actions

Using Redux to serve images on myamiweb » History » Revision 21

« Previous | Revision 21/64 (diff) | Next »
Amber Herold, 03/13/2013 10:10 AM


Using Redux to serve images on myamiweb

Before you begin:
Redux is new for CentOS 6 (PHP 5.3).
If you want to install Appion/Leginon 2.2 on CentOS 5, you do not need to install Redux. Instead, you must follow the directions to Install the MRC PHP Extension.

Installation

  1. Follow Web_Server_Installation but ignore warning on not using php 5.3
  2. Install myami-redux branch of myami on the webserver machine.
    • Install redux prerequisites as found in its README file
    • Redux needs write permission at its installation location to write fftw wisdom file.
    • Install python filesystem abstraction for redux caching like this:
      sudo easy_install fs
      

Configurations:

configure redux

> cd /YourMyamDownload/redux
> cp redux.cfg.template redux.cfg
* You can also copy it to /etc/myami/redux.cfg if you prefer.
  • Turn on redux caching if desired,
    [cache]
    enable: yes
    path: /var/cache/myami/redux
    disksize:  500
    memsize: 500
    

    You need to make sure the cache path exists and writable by the user that starts the redux server (reduxd)
    • Input the desired disk_cache_path, disk_cache_size, and mem_cache_size in the next few lines
    • Create the disk_cache_path before running redux if cache will be used

Assign redux server in myamiweb

  • At myamiweb/config.php
    define('SERVER_HOST',"localhost")
    

Test Installation

  1. Using Redux to do simple input output (simple client with no reduxd server needed):
    redux --filename=test.jpg --oformat=PNG > test.png
    Make sure the resulting test.png is in fact an image and not an error message.
  2. Run the server: run the following on a command line:
    reduxd
    leave it running for the following...
  3. Test command line client connecting to the server
    redux --server_host=localhost --filename=test.jpg --oformat=PNG > test.png
    Note: The input file name is from the perspective of the reduxd server, so be sure to give it an absolute path (unlike the first test, which was not accessing the server)

Using redux server with myamiweb

  1. start reduxd server if not already running from the above test:
    reduxd
  2. click on "[test dataset]" on your main myamiweb home page, or go directly to the URL: myamiweb/viewerxml.php
  3. test by accessing your own images from Leginon in myamiweb/imageviewer.php

starting reduxd at boot

sudo cp -v myami/redux/init.d/reduxd /etc/init.d/
sudo service reduxd start

Using imcache to cache mrc images as jpeg images of the default size on myamiweb

imcache uses redux and replaces the old myamiweb caching system that used mrc2any. It queries the database leginondata and check the cache_path for uncached images and convert them to jpeg images. These jpeg images can be 94 x smaller than the mrc 4kx4k image. Therefore, using imcache will significantly increase the image load time from the image viewer. A default size power spectrum image is also cached.

Installation

  1. Follow Web_Server_Installation with modification for redux.
  2. Install pyami, sinedon, redux on the webserver machine
  3. Configure sinedon.cfg for your database
  4. imcache can found in your myamiweb installation in the folder myamiweb/imcache/

Configurations:

configure imcache

> cd /YourMyamiWeb/imcache
> edit imcacheconfig.py

Modify the line

cache_path = '/srv/cache/myamiweb'

to the path you want to use as the base path for the cache to be stored. The path must exist and writable by whoever starts imcached

Assign the same cache path in myamiweb

  • At myamiweb/config.php
    define('ENABLE_CACHE', true);
    define('CACHE_PATH',"/srv/cache/myamiweb");
    

h2 Test Installation

  1. Start imcached in its installed location with the reverse order caching
    ./imcached r
    

    If you have acquired any Leginon images prior to this, imcached will start converting them into jpeg.
  2. View a cached image in the imageviewer while checking redux log. jpeg, not mrc image should be requested by the imageviwer.

Start imcache during data collection

  1. Start imcached in its installed location with the forward order caching in the background
    sudo nohup ./imcached f > /var/log/imcached.f
    
  2. Wait for the first image to be cached before starting the reverse caching
    sudo nohup ./imcached r > /var/log/imcached.r
    

Updated by Amber Herold over 11 years ago · 21 revisions