eZ Platform Discussions

Configuring the DFS IO handler for cache


#1

Bonjour à tous,

My site is hosted on platform.sh in Enterprise version.

So I have 3 servers.
Originally, these 3 servers shared the same cache folder over the network.
But for performance reasons each of the 3 servers now has its own cache folder.

So I have problems with invalidation of the caches …

Changes made in the back office are immediately visible randomly. (one request out of 3)

Test procedure :

I open a handful (10) of my browser’s tabs on the site’s homepage, with the console enabled on Network.

I made a modification on the homepage.
I update all the tabs of my browser.

One in three pages contains the modification.
By checking the headers of the queries we notice that all the pages with the modification come from the same server.

The problem occurs on the platform.sh url (https://staging.mysite.c.myprojet.ent.platform.sh/)
Removing the redis cache does not change anything.
Removing the eZ cache solves the problem.
The problem does not come from fastly.

The problem is that the 3 servers have their own cache folder: ezplatform/var/cache
The server that makes the change changes its own cache. But the other 2 are not aware.

Platform.sh recommends setting up the DFS IO handler.
https://doc.ezplatform.com/en/latest/guide/clustering/#dfs-io-handler
My first tests affect the display of images.

How to configure the DFS IO handler to support only the cache?

For the moment I have this configuration:

# =====================================================================
# https://doc.ezplatform.com/en/latest/guide/clustering/#dfs-io-handler
#

# define the Flysystem handler
oneup_flysystem:
    adapters:
        nfs_cache_adapter:
            local:
                directory: "%kernel.project_dir%/var/cache"

# define the eZ Platform handlers
ez_io:
    binarydata_handlers:
        nfs_cache:
            flysystem:
                adapter: nfs_cache_adapter
    metadata_handlers:
        dfs_cache:
            legacy_dfs_cluster:
                connection: doctrine.dbal.dfs_connection

# set the application handlers
ezpublish:
    system:
        default:
            io:
                metadata_handler: dfs_cache
                binarydata_handler: nfs_cache

With this configuration, the images have disappeared. And the problem is not solved.