File: HOWTO-Blobs-NFS.txt

package info (click to toggle)
zodb 1:3.10.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 3,988 kB
  • ctags: 5,875
  • sloc: python: 33,695; ansic: 7,673; xml: 474; sh: 20; makefile: 18
file content (86 lines) | stat: -rw-r--r-- 2,856 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
===========================================
How to use NFS to make Blobs more efficient
===========================================

:Author: Christian Theune <ct@gocept.com>

Overview
========

When handling blobs, the biggest goal is to avoid writing operations that
require the blob data to be transferred using up IO resources.

When bringing a blob into the system, at least one O(N) operation has to
happen, e.g. when the blob is uploaded via a network server. The blob should
be extracted as a file on the final storage volume as early as possible,
avoiding further copies.

In a ZEO setup, all data is stored on a networked server and passed to it
using zrpc. This is a major problem for handling blobs, because it will lock
all transactions from committing when storing a single large blob. As a
default, this mechanism works but is not recommended for high-volume
installations.

Shared filesystem
=================

The solution for the transfer problem is to setup various storage parameters
so that blobs are always handled on a single volume that is shared via network
between ZEO servers and clients.

Step 1: Setup a writable shared filesystem for ZEO server and client
--------------------------------------------------------------------

On the ZEO server, create two directories on the volume that will be used by
this setup (assume the volume is accessible via $SERVER/):

    - $SERVER/blobs

    - $SERVER/tmp

Then export the $SERVER directory using a shared network filesystem like NFS.
Make sure it's writable by the ZEO clients.

Assume the exported directory is available on the client as $CLIENT.

Step 2: Application temporary directories
-----------------------------------------

Applications (i.e. Zope) will put uploaded data in a temporary directory
first. Adjust your TMPDIR, TMP or TEMP environment variable to point to the
shared filesystem:

    $ export TMPDIR=$CLIENT/tmp

Step 3: ZEO client caches
-------------------------

Edit the file `zope.conf` on the ZEO client and adjust the configuration of
the `zeoclient` storage with two new variables::

    blob-dir = $CLIENT/blobs
    blob-cache-writable = yes

Step 4: ZEO server
------------------

Edit the file `zeo.conf` on the ZEO server to configure the blob directory.
Assuming the published storage of the ZEO server is a file storage, then the
configuration should look like this::

    <blobstorage 1>
        <filestorage>
            path $INSTANCE/var/Data.fs
        <filestorage>
        blob-dir $SERVER/blobs
    </blobstorage>

(Remember to manually replace $SERVER and $CLIENT with the exported directory
as accessible by either the ZEO server or the ZEO client.)

Conclusion
----------

At this point, after restarting your ZEO server and clients, the blob
directory will be shared and a minimum amount of IO will occur when working
with blobs.