SlideShare une entreprise Scribd logo
1  sur  20
eZ Cluster unleashed
The return
Purpose and history

One eZ Publish on multiple servers, for:
Performance
Redundancy

Created for eZ Publish 3.8, vastly improved since then:
3.10: huge schema & feature improvements
4.2: new eZDFS cluster handler for NFS
4.2: Stalecaching mechanism for eZDB and eZDFS
4.7: Refactored binary index architecture

Matches the shared database for filesystem operations:
Inserting new data, expiring/deleting obsolete data
serving files through HTTP
Cluster handlers



           eZ DB                        eZ DFS

From eZ Publish 3.8           From eZ Publish 4.2

Stores metadata in DB         Stores metadata in DB

Stores data in DB (BLOBs)     Stores data on NFS

Easy to setup                 Requires an NFS server

Huge DB, harder to maintain   Maintenance is much easier
HTTP vs Internal calls

HTTP

Requests done through index_cluster.php
Serves files directly
A reverse proxy caches images & binary files

INTERNAL / KERNEL CALLS

Reads/writes cache items
Stores binary files
Configuration #1: file.ini

A cluster handler must be configured in a file.ini override:

1.[ClusteringSettings]
2.FileHandler=eZDFSFileHandler


1.# DFS Cluster Handler settings
2.[eZDFSClusteringSettings]
3.MountPointPath=var/nfs
4.DBBackend=eZDFSFileHandlerMySQLBackend
5.DBHost=localhost
6.DBName=labs_ezpublish_trunk_cluster
7.DBUser=root
8.DBPassword=root
Configuration #2: database


eZDB and eZDFS both require database tables

The same DB server can be used

Performance wise it is better to use another server

Schemas are available in
kernel/sql/*/cluster_*_schema.sql (mysql only, oracle's are in
the extension)
Configuration #3: clusterize


Existing local files must be moved to the cluster

This  is done using bin/php/clusterize.php

This script will copy/move images & binary files from the local
filesystem to the cluster

It must only be executed once for the whole cluster
Configuration #4: binary URLs rewriting


URL rewriting is required to "stream" clusterized binary files to
visitors:
   Images
   Binary files

They only affect known path for these types of files

To stream different files, new rules must be added

     RewriteEngine On
     Rewriterule ^/var/([^/]+/)?storage/original/.* /index_cluster.php [L]
     Rewriterule ^/var/([^/]+/)?storage/images/.*   /index_cluster.php [L]

     # Standard eZ Publish rewrite rules
     # ...
Configuration #5: binary files index


The cluster index handles binary files HTTP requests

It doesn't use the whole kernel in order to perform better
It was completely refactored in 4.7

Before 4.7                              After 4.7
Required custom file to be created      No custom files


Many files also located at root level   Documented



Duplicated logic among handlers         Common code has been refactored



Features weren't identical among        Features are (almost) perfectly
Configuration #5: binary files index, example

/**
 * Cluster configuration file
 */
define( 'CLUSTER_STORAGE_BACKEND',    'dfsmysqli'     );
define( 'CLUSTER_STORAGE_HOST',       'localhost'     );
define( 'CLUSTER_STORAGE_PORT',       3306            );
define( 'CLUSTER_STORAGE_USER',       'clusteruser'   );
define( 'CLUSTER_STORAGE_PASS',       ''              );
define( 'CLUSTER_STORAGE_DB',         'ezcluster'     );
define( 'CLUSTER_STORAGE_CHARSET',    'utf8'          );
define( 'CLUSTER_MOUNT_POINT_PATH',   '/opt/nfs/ez'   );
How cache is handled


Remote, clusterized files are copied locally

Before using a local file, eZ always checks if it is newer
than the remote one

When a cache file is generated, it is stored on the cluster,
and re-used by other nodes

expiry.php provides an intermediate method
API: reading clusterized files

1.$path = '/var/ezwebin_site/path/to/my/file.txt'


1.// read a text file, "instance" syntax
2.$contents = eZClusterFileHandler::instance( $path )->fetchContents();


1.// read a text file, "static" syntax
2.$contents = eZClusterFileHandler::instance()->fileFetchContents( $path );


1.// fetch a file (a binary one for example) to disk
2.$path = 'var/ezflow_site/storage/original/video/961d8a65efffdd93708cc23bc6398953.flv';
3.$handler = eZClusterFileHandler::instance( $path )->fetchUnique();


1.// ... use the file ... then delete it
2.$handler->deleteLocal( $uniquePath );


1.// reading metadata
2.$file = eZClusterFileHandler::instance( $someFile );
3.echo $file->size();
4.echo $file->mtime();
API: writing a file to the cluster


Again, the native PHP I/O API isn't cluster aware !
1.// stores the contents of the $contents variable to cluster
2.$path = 'var/ezwebin_site/file.txt';
3.$handler = eZClusterFileHandler::instance( $path );
4.$handler->storeContents( $contents, 'text', 'text/plain' );


1.// alternative "static" method: fileStoreContents()


1.// stores the contents of a local image as a clusterized file
2.$imagePath = 'var/ezwebin_site/path/image.png';
3.$handler = eZClusterFileHandler::instance();
4.$handler->fileStore( $imagePath, 'image', true, 'image/png' );
API: ViewCache !


ViewCache uses advanced methods of the cluster API

These method handle:
      
        cache retrieving and/or generation
      
        Concurrency
      
        stale caching

It can technically be used to manage custom cache !

Next: introducing the processCache() method
API: The processCache() method !


It can be used for custom developements too !

It will let you implement caching in your own extensions

It uses:
       
         a generate() callback that generates the dynamic
       content
       
         a retrieve() callback that retrieves valid cached
       content
API: The processCache() method, CODE !

1.$cacheFilePath = eZCachedModule::cacheFilePath( $Params );
2.$cacheFile = eZClusterFileHandler::instance( $cacheFilePath );
3.$Result = $cacheFile->processCache(
4.    array( 'eZCachedModule', 'retrieve' ),
5.    array( 'eZCachedModule', 'generate' ),
6.    null,
7.    null,
8.    compact( 'Params' ) );

1.return $Result;
API: The processCache() method, callback


Let's review an example that caches the whole output
($Result) of a module.
It has a configurable TTL, and provides a custom cache key
that can be used to invalidate cache.

1. Get the code from github:
git clone git://gist.github.com/3635993.git extension/ezcachedmodule


2. enable the extension in site.ini
ActiveExtensions[]=ezcachedmodule


3. and do not forget to regenerate the extensions autoload:
Php bin/php/ezpgenerateautoloads.php –extension
API: The processCache() method, callback


1. Enable the DebugOutput
  Come on, you know how to do it


2. Go to http://ezpublish4.admin/cachedmodule/view/abcd
  Look into the debugOutput for « eZCachedModule »


3. Let's review it together
API: The processCache() method, callback


Let's review an example that caches the whole output
($Result) of a module.
It has a configurable TTL, and provides a custom cache key
that can be used to invalidate cache.

1. Get the code from github:
git clone git://gist.github.com/3635993.git extension/ezcachedmodule


2. enable the extension in site.ini
ActiveExtensions[]=ezcachedmodule


3. and do not forget to regenerate the extensions autoload:
Php bin/php/ezpgenerateautoloads.php –extension

Contenu connexe

Tendances

On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappersPositive Hack Days
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasaggarrett honeycutt
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesJulie Tsai
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係Kiwamu Okabe
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadPuppet
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File SystemAdrian Huang
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe BookTim Riley
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetWalter Heck
 
Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Dominic Cleal
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernelAdrian Huang
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)YoungHeon (Roy) Kim
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSEelliando dias
 
Lightweight DAS components in Perl
Lightweight DAS components in PerlLightweight DAS components in Perl
Lightweight DAS components in Perlguestbab097
 

Tendances (20)

On secure application of PHP wrappers
On secure application  of PHP wrappersOn secure application  of PHP wrappers
On secure application of PHP wrappers
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
2015 bioinformatics bio_python
2015 bioinformatics bio_python2015 bioinformatics bio_python
2015 bioinformatics bio_python
 
Puppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi ExercisesPuppet HackDay/BarCamp New Delhi Exercises
Puppet HackDay/BarCamp New Delhi Exercises
 
HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係HaskellとDebianの辛くて甘い関係
HaskellとDebianの辛くて甘い関係
 
working with files
working with filesworking with files
working with files
 
Shark - Lab Assignment
Shark - Lab AssignmentShark - Lab Assignment
Shark - Lab Assignment
 
Linux configer
Linux configerLinux configer
Linux configer
 
Tutorial Puppet
Tutorial PuppetTutorial Puppet
Tutorial Puppet
 
Functional Hostnames and Why they are Bad
Functional Hostnames and Why they are BadFunctional Hostnames and Why they are Bad
Functional Hostnames and Why they are Bad
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
Making Your Capistrano Recipe Book
Making Your Capistrano Recipe BookMaking Your Capistrano Recipe Book
Making Your Capistrano Recipe Book
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
PuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with PuppetPuppetCamp SEA 1 - Version Control with Puppet
PuppetCamp SEA 1 - Version Control with Puppet
 
Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)Configuration surgery with Augeas (OggCamp 12)
Configuration surgery with Augeas (OggCamp 12)
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
 
занятие8
занятие8занятие8
занятие8
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSE
 
Lightweight DAS components in Perl
Lightweight DAS components in PerlLightweight DAS components in Perl
Lightweight DAS components in Perl
 

Similaire à eZ Publish cluster unleashed revisited

Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294IkiArif1
 
Symfony internals [english]
Symfony internals [english]Symfony internals [english]
Symfony internals [english]Raul Fraile
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
Best Practices For Direct Admin Security
Best Practices For Direct Admin SecurityBest Practices For Direct Admin Security
Best Practices For Direct Admin Securitylisa Dsouza
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing DaeHyung Lee
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache MesosJoe Stein
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeMarco Gralike
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsKaliop-slide
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHPPaul Jones
 
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security ParadigmAnis LARGUEM
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applicationsjeromevdl
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneDeepti Singh
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneDeepti Singh
 
Drupal 8 configuration management
Drupal 8 configuration managementDrupal 8 configuration management
Drupal 8 configuration managementAlexander Tkachev
 
Rman cloning guide
Rman cloning guideRman cloning guide
Rman cloning guideAmit87_dba
 
Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023Mark Niebergall
 

Similaire à eZ Publish cluster unleashed revisited (20)

Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294
 
Symfony internals [english]
Symfony internals [english]Symfony internals [english]
Symfony internals [english]
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
Best Practices For Direct Admin Security
Best Practices For Direct Admin SecurityBest Practices For Direct Admin Security
Best Practices For Direct Admin Security
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache Mesos
 
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco GralikeBoost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
Boost Your Environment With XMLDB - UKOUG 2008 - Marco Gralike
 
Workshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching MechanismsWorkshop eZ Publish Caching Mechanisms
Workshop eZ Publish Caching Mechanisms
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Decoupled Libraries for PHP
Decoupled Libraries for PHPDecoupled Libraries for PHP
Decoupled Libraries for PHP
 
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
DataStax | Building a Spark Streaming App with DSE File System (Rocco Varela)...
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security Paradigm
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Softshake - Offline applications
Softshake - Offline applicationsSoftshake - Offline applications
Softshake - Offline applications
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
Android Data Storagefinal
Android Data StoragefinalAndroid Data Storagefinal
Android Data Storagefinal
 
Drupal 8 configuration management
Drupal 8 configuration managementDrupal 8 configuration management
Drupal 8 configuration management
 
Rman cloning guide
Rman cloning guideRman cloning guide
Rman cloning guide
 
Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023Filesystem Management with Flysystem - php[tek] 2023
Filesystem Management with Flysystem - php[tek] 2023
 

Plus de Bertrand Dunogier

The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016Bertrand Dunogier
 
Dev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuDev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuBertrand Dunogier
 
Discover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productDiscover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productBertrand Dunogier
 
eZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingeZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingBertrand Dunogier
 

Plus de Bertrand Dunogier (7)

The eZ Platform Query Field
The eZ Platform Query FieldThe eZ Platform Query Field
The eZ Platform Query Field
 
The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016The eZ Platform view layer – eZ Conference 2016
The eZ Platform view layer – eZ Conference 2016
 
Dev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenuDev Symfony2 rapide avec un framework de contenu
Dev Symfony2 rapide avec un framework de contenu
 
Discover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this productDiscover eZ Publish: why you have to know this product
Discover eZ Publish: why you have to know this product
 
eZ Publish REST API v2
eZ Publish REST API v2eZ Publish REST API v2
eZ Publish REST API v2
 
E zsc2012 rest-api-v2
E zsc2012 rest-api-v2E zsc2012 rest-api-v2
E zsc2012 rest-api-v2
 
eZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content PublishingeZ Publish Asynchronous Content Publishing
eZ Publish Asynchronous Content Publishing
 

Dernier

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Dernier (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

eZ Publish cluster unleashed revisited

  • 2. Purpose and history One eZ Publish on multiple servers, for: Performance Redundancy Created for eZ Publish 3.8, vastly improved since then: 3.10: huge schema & feature improvements 4.2: new eZDFS cluster handler for NFS 4.2: Stalecaching mechanism for eZDB and eZDFS 4.7: Refactored binary index architecture Matches the shared database for filesystem operations: Inserting new data, expiring/deleting obsolete data serving files through HTTP
  • 3.
  • 4. Cluster handlers eZ DB eZ DFS From eZ Publish 3.8 From eZ Publish 4.2 Stores metadata in DB Stores metadata in DB Stores data in DB (BLOBs) Stores data on NFS Easy to setup Requires an NFS server Huge DB, harder to maintain Maintenance is much easier
  • 5. HTTP vs Internal calls HTTP Requests done through index_cluster.php Serves files directly A reverse proxy caches images & binary files INTERNAL / KERNEL CALLS Reads/writes cache items Stores binary files
  • 6. Configuration #1: file.ini A cluster handler must be configured in a file.ini override: 1.[ClusteringSettings] 2.FileHandler=eZDFSFileHandler 1.# DFS Cluster Handler settings 2.[eZDFSClusteringSettings] 3.MountPointPath=var/nfs 4.DBBackend=eZDFSFileHandlerMySQLBackend 5.DBHost=localhost 6.DBName=labs_ezpublish_trunk_cluster 7.DBUser=root 8.DBPassword=root
  • 7. Configuration #2: database eZDB and eZDFS both require database tables The same DB server can be used Performance wise it is better to use another server Schemas are available in kernel/sql/*/cluster_*_schema.sql (mysql only, oracle's are in the extension)
  • 8. Configuration #3: clusterize Existing local files must be moved to the cluster This  is done using bin/php/clusterize.php This script will copy/move images & binary files from the local filesystem to the cluster It must only be executed once for the whole cluster
  • 9. Configuration #4: binary URLs rewriting URL rewriting is required to "stream" clusterized binary files to visitors: Images Binary files They only affect known path for these types of files To stream different files, new rules must be added RewriteEngine On Rewriterule ^/var/([^/]+/)?storage/original/.* /index_cluster.php [L] Rewriterule ^/var/([^/]+/)?storage/images/.* /index_cluster.php [L] # Standard eZ Publish rewrite rules # ...
  • 10. Configuration #5: binary files index The cluster index handles binary files HTTP requests It doesn't use the whole kernel in order to perform better It was completely refactored in 4.7 Before 4.7 After 4.7 Required custom file to be created No custom files Many files also located at root level Documented Duplicated logic among handlers Common code has been refactored Features weren't identical among Features are (almost) perfectly
  • 11. Configuration #5: binary files index, example /** * Cluster configuration file */ define( 'CLUSTER_STORAGE_BACKEND', 'dfsmysqli' ); define( 'CLUSTER_STORAGE_HOST', 'localhost' ); define( 'CLUSTER_STORAGE_PORT', 3306 ); define( 'CLUSTER_STORAGE_USER', 'clusteruser' ); define( 'CLUSTER_STORAGE_PASS', '' ); define( 'CLUSTER_STORAGE_DB', 'ezcluster' ); define( 'CLUSTER_STORAGE_CHARSET', 'utf8' ); define( 'CLUSTER_MOUNT_POINT_PATH', '/opt/nfs/ez' );
  • 12. How cache is handled Remote, clusterized files are copied locally Before using a local file, eZ always checks if it is newer than the remote one When a cache file is generated, it is stored on the cluster, and re-used by other nodes expiry.php provides an intermediate method
  • 13. API: reading clusterized files 1.$path = '/var/ezwebin_site/path/to/my/file.txt' 1.// read a text file, "instance" syntax 2.$contents = eZClusterFileHandler::instance( $path )->fetchContents(); 1.// read a text file, "static" syntax 2.$contents = eZClusterFileHandler::instance()->fileFetchContents( $path ); 1.// fetch a file (a binary one for example) to disk 2.$path = 'var/ezflow_site/storage/original/video/961d8a65efffdd93708cc23bc6398953.flv'; 3.$handler = eZClusterFileHandler::instance( $path )->fetchUnique(); 1.// ... use the file ... then delete it 2.$handler->deleteLocal( $uniquePath ); 1.// reading metadata 2.$file = eZClusterFileHandler::instance( $someFile ); 3.echo $file->size(); 4.echo $file->mtime();
  • 14. API: writing a file to the cluster Again, the native PHP I/O API isn't cluster aware ! 1.// stores the contents of the $contents variable to cluster 2.$path = 'var/ezwebin_site/file.txt'; 3.$handler = eZClusterFileHandler::instance( $path ); 4.$handler->storeContents( $contents, 'text', 'text/plain' ); 1.// alternative "static" method: fileStoreContents() 1.// stores the contents of a local image as a clusterized file 2.$imagePath = 'var/ezwebin_site/path/image.png'; 3.$handler = eZClusterFileHandler::instance(); 4.$handler->fileStore( $imagePath, 'image', true, 'image/png' );
  • 15. API: ViewCache ! ViewCache uses advanced methods of the cluster API These method handle:  cache retrieving and/or generation  Concurrency  stale caching It can technically be used to manage custom cache ! Next: introducing the processCache() method
  • 16. API: The processCache() method ! It can be used for custom developements too ! It will let you implement caching in your own extensions It uses:  a generate() callback that generates the dynamic content  a retrieve() callback that retrieves valid cached content
  • 17. API: The processCache() method, CODE ! 1.$cacheFilePath = eZCachedModule::cacheFilePath( $Params ); 2.$cacheFile = eZClusterFileHandler::instance( $cacheFilePath ); 3.$Result = $cacheFile->processCache( 4. array( 'eZCachedModule', 'retrieve' ), 5. array( 'eZCachedModule', 'generate' ), 6. null, 7. null, 8. compact( 'Params' ) ); 1.return $Result;
  • 18. API: The processCache() method, callback Let's review an example that caches the whole output ($Result) of a module. It has a configurable TTL, and provides a custom cache key that can be used to invalidate cache. 1. Get the code from github: git clone git://gist.github.com/3635993.git extension/ezcachedmodule 2. enable the extension in site.ini ActiveExtensions[]=ezcachedmodule 3. and do not forget to regenerate the extensions autoload: Php bin/php/ezpgenerateautoloads.php –extension
  • 19. API: The processCache() method, callback 1. Enable the DebugOutput Come on, you know how to do it 2. Go to http://ezpublish4.admin/cachedmodule/view/abcd Look into the debugOutput for « eZCachedModule » 3. Let's review it together
  • 20. API: The processCache() method, callback Let's review an example that caches the whole output ($Result) of a module. It has a configurable TTL, and provides a custom cache key that can be used to invalidate cache. 1. Get the code from github: git clone git://gist.github.com/3635993.git extension/ezcachedmodule 2. enable the extension in site.ini ActiveExtensions[]=ezcachedmodule 3. and do not forget to regenerate the extensions autoload: Php bin/php/ezpgenerateautoloads.php –extension