GithubHelp home page GithubHelp logo

calien666 / distributed-locks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from b13/distributed-locks

0.0 1.0 0.0 21 KB

Adds a Redis Locking Strategy for TYPO3 frontend page generation, useful on distributed systems with NFS.

License: GNU General Public License v2.0

PHP 100.00%

distributed-locks's Introduction

Distributed Redis Locker for TYPO3 Locking Mechanism

TYPO3 has three built-in Locking Strategies, that are chosen at runtime which fits best for the current system setup.

  • SemaphoreLockStrategy
  • SimpleLockStrategy
  • FileLockStrategy

However, when dealing with a multi-tier system and a shared file system with multiple frontend nodes with a NFS filesystem, it is especially helpful to use a better suitable format. Redis is our weapon of choice for handling multi-node scenarios, and works just fine with TYPO3 and Caching.

This extension provides a Redis Locking mechanism to store the locks in a (shared) Redis database.

Requirements

This extension is available for TYPO3 v8+ LTS, and requires the PHP package php-redis as well as a Redis server.

Installation

Install this extension via composer composer require b13/distributed-locks or extensions.typo3.org / Extension Manager, and activate it in the Extension Manager.

Now add the following lines to your LocalConfiguration / AdditionalConfiguration to activate Redis Locking.

$GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['redis'] = [
    'hostname' => '127.0.0.1',
    'database' => 12
];

Other options:

'ttl' (numeric, default is 30sec)
'port' (numeric, default is 6379)
'password' (contains the password, necessary for secure authentication if required by redis)
'priority' (numeric, default is 95) - Set priority for this locking strategy. See LockingApi documentation.

Future Development

Should be switched to symfony/lock to allow distributed redis services and other lockers.

Credits & Background

Inspiration was taken from the now unmaintained extension "redis_lock_strategy" which we used several times, however with some drawbacks:

  • No stable version for TYPO3 v9 in composer mode
  • No maintainer available for releases anymore
  • Destroying an object did not remove locks, ending in certain dead lock scenarios in broken scripts

Thanks to Alexander Miehe for the initial extension and the conceptual work.

Sharing our expertise

Find more TYPO3 extensions we have developed that help us deliver value in client projects. As part of the way we work, we focus on testing and best practices to ensure long-term performance, reliability, and results in all our code.

distributed-locks's People

Contributors

bmack avatar davidsteeb avatar stucki avatar sypets avatar

Watchers

 avatar

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.