Giter VIP home page Giter VIP logo

magento-parallels's Introduction

Run heavy pieces of your Magento code in a background process to increase page load speed.

Installation

Just copy files to your magento directory. Make file var/log/parallels.txt writeable and parallels/run.sh executable.

Usage

For example you have a model class mymodule/model with a method:

<?php

function bigCalculations($a, $b)
{
    $c = $a * $b;
    sleep(30); // Just relax
}

And in some request you wanna run it in a backround. In your module add the following to config.xml

<global>
    <parallels>
        <process>
            <do_my_calculations>
                <model>mymodule/model</model>
                <method>bigCalculations</method>
            </do_my_calculations>
        </process>
    </parallels>
</global>

Then go to your module's class where you want to run these calculations and write:

<?php
Mage::getModel('parallels/runner')->run('do_my_calculations', array(2, 3));

run method has 2 arguments:

  1. Process identifier which we mentioned in config.xml
  2. Array with arguments which will be passed to the callback method

So after this bigCalculations execution will be forwarded to the separate process with specified arguments (in our case it will just do 2*3 and sleep). Please note, that in callback method you are free to use any Magento-related stuff like Mage::getModel(...), etc.

Also, var/log/parallels.log file will contain output from the last parallel process call. This may help with debugging.

magento-parallels's People

Contributors

dankocherga avatar denmarkin avatar vsushkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

magento-parallels's Issues

Hide parallels directory

The parallels directory has a .htaccess file. It works well for Apache but it's not working for nginx. But almost every single nginx config denies access to hidden files. Wouldn't it be great to hide this directory?

"Permission denied" using nginx on centos. ""

This is great module, thanks. It works form me on local but on server does not works.

The line which php returns empty.

if i turn run.php executable it return these lines.

/.parallels/run.php: line 1: ?php: Arquivo ou diretório não encontrado
/home/safiri/magento/production/releases/20141209024416/.parallels/run.php: line 3: /bin: É um diretório
/home/safiri/magento/production/releases/20141209024416/.parallels/run.php: line 4: api.php: comando não encontrado

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.