Skip to content

Commit 9ed83ed

Browse files
committed
feat: added ZEO_CLIENT_CACHE_SIZE and ZEO_BLOB_CACHE_SIZE
1 parent 8d0f26f commit 9ed83ed

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ By default the `docker-compose.yml` includes the core Zope instances and a light
5757
| `RELSTORAGE_DSN` | *(empty)* | If provided, connects ZODB to a RelStorage backend (e.g. `dbname='reportek'...`) |
5858
| `ZEO_ADDRESS` | *(empty)* | If set (e.g. `zeo:8100`), Zope connects to this ZEO server instead of using local FileStorage |
5959
| `ZEO_SHARED_BLOB_DIR` | `off` | Declares if the blob directory is natively shared with a ZEO server volume mount (`on` / `off`) |
60+
| `ZEO_CLIENT_CACHE_SIZE` | `128MB` | ZEO client object cache size (e.g. `128MB`, `512MB`). Only applied when `ZEO_ADDRESS` is set |
61+
| `ZEO_CLIENT_BLOB_CACHE_SIZE` | *(unset)* | ZEO client local blob cache size (e.g. `1GB`). Only meaningful when `ZEO_ADDRESS` is set and `ZEO_SHARED_BLOB_DIR=off`; omitted from
62+
+config when unset |
6063
| `ZODB_CACHE_SIZE` | `50000` | Size of the ZODB cache for the main database |
6164
| `ZOPE_THREADS` | `4` | Number of threads to use in the Waitress WSGI server |
6265
| `ZOPE_DEBUG_MODE` | `off` | Toggles the Zope application debug mode (`on`, `off`) |

src/docker-entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ setup_zodb() {
8181
local zodb_conf="$ZOPE_HOME/etc/zodb.conf"
8282
local cache_size=${ZODB_CACHE_SIZE:-50000}
8383
local shared_blob_dir=${ZEO_SHARED_BLOB_DIR:-off}
84+
local zeo_client_cache_size=${ZEO_CLIENT_CACHE_SIZE:-128MB}
85+
local zeo_blob_cache_line=""
86+
if [ -n "$ZEO_CLIENT_BLOB_CACHE_SIZE" ]; then
87+
zeo_blob_cache_line=" blob-cache-size $ZEO_CLIENT_BLOB_CACHE_SIZE"
88+
fi
8489

8590
log "Generating ZODB configuration at $zodb_conf"
8691

@@ -100,7 +105,7 @@ setup_zodb() {
100105
</zodb_db>
101106
EOF
102107
elif [ -n "$ZEO_ADDRESS" ]; then
103-
log "ZEO_ADDRESS is set to $ZEO_ADDRESS. Configuring ZEO Client..."
108+
log "ZEO_ADDRESS is set to $ZEO_ADDRESS. Configuring ZEO Client (cache-size=$zeo_client_cache_size${ZEO_CLIENT_BLOB_CACHE_SIZE:+, blob-cache-size=$ZEO_CLIENT_BLOB_CACHE_SIZE})..."
104109
cat <<EOF > "$zodb_conf"
105110
<zodb_db main>
106111
cache-size $cache_size
@@ -109,10 +114,11 @@ EOF
109114
storage 1
110115
name zeostorage
111116
var $ZOPE_HOME/var
112-
cache-size 128MB
117+
cache-size $zeo_client_cache_size
113118
blob-dir $ZOPE_HOME/var/blobstorage
114119
shared-blob-dir $shared_blob_dir
115-
</zeoclient>
120+
${zeo_blob_cache_line:+$zeo_blob_cache_line
121+
} </zeoclient>
116122
mount-point /
117123
</zodb_db>
118124
EOF

0 commit comments

Comments
 (0)