Skip to content

Commit 56f54ed

Browse files
authored
Merge pull request #320 from skokhan-x/master
MAXWS-1042: Update MaxCache docs — rename HTCache directives, remove …
2 parents 760c5ae + 87c9ba8 commit 56f54ed

1 file changed

Lines changed: 52 additions & 61 deletions

File tree

docs/cloudlinuxos/shared-pro/README.md

Lines changed: 52 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ MAx Cache is currently supported on cPanel control panels only.
13041304
To install MAx Cache, run the following commands:
13051305
13061306
```
1307-
yum install accelerate-wp cloudlinux-site-optimization-module libmaxcache maxcache-htcache-watchd --enablerepo=cloudlinux-updates-testing
1307+
yum install accelerate-wp cloudlinux-site-optimization-module libmaxcache --enablerepo=cloudlinux-updates-testing
13081308
```
13091309
```
13101310
yum install ea-apache24-mod_maxcache --enablerepo=cl-ea4-testing
@@ -1313,10 +1313,9 @@ yum install ea-apache24-mod_maxcache --enablerepo=cl-ea4-testing
13131313
| Package | Description |
13141314
| --- | --- |
13151315
| `ea-apache24-mod_maxcache` | Apache module with cache serving and full .htaccess caching subsystems |
1316-
| `maxcache-htcache-watchd` | Filesystem watcher daemon for real-time `.htaccess` change detection |
13171316
| `libmaxcache` | Shared C library for device detection, WebP, cookie/QS handling |
13181317
1319-
After installation, the full .htaccess caching subsystem is enabled by default (`MaxCacheHTCache On`) and the `maxcache-htcache-watchd` daemon is automatically started and enabled on boot.
1318+
After installation, the full .htaccess caching subsystem is enabled by default (`MaxCacheHtaccess On`). Change detection uses per-request `stat()` polling — no separate daemon is required.
13201319
13211320
### MAx Cache Activation Guide
13221321
@@ -1910,89 +1909,83 @@ By default, Apache re-reads and re-parses `.htaccess` files from disk on every r
19101909
19111910
#### Change detection
19121911
1913-
Full .htaccess caching detects `.htaccess` changes through two mechanisms:
1912+
Full .htaccess caching detects `.htaccess` changes through per-request `stat()` polling. Each cached entry on the current request path is checked against disk when its per-entry timer expires (controlled by `MaxCacheHtaccessRevalidateInterval`).
19141913
1915-
| Mode | Detection latency | When active |
1914+
| `MaxCacheHtaccessRevalidateInterval` | Detection latency | Trade-off |
19161915
| --- | --- | --- |
1917-
| **watchd (real-time)** | Sub-second | When `maxcache-htcache-watchd` service is running |
1918-
| **Polling (fallback)** | Up to `MaxCacheHTCacheRevalidateInterval` seconds (default 60) | Always active as a safety net |
1916+
| `0` (default) | Immediate (next request) | Every request `stat()`s each cached directory on its path |
1917+
| `N` seconds | Up to `N` seconds | Fewer `stat()` syscalls on busy paths, slower change pick-up |
19191918
1920-
When the `maxcache-htcache-watchd` daemon is running, it monitors the filesystem and signals Apache through shared memory whenever a `.htaccess` file is created, modified, or deleted.
1921-
1922-
:::warning CloudLinux 7/8 limitations
1923-
On CloudLinux 7 and 8, the kernel's `fanotify` interface only supports file write events. This means the watchd daemon detects `.htaccess` **modifications** instantly, but **deletes**, **renames**, and **moves** are not detected in real time — they rely on the polling fallback (`MaxCacheHTCacheRevalidateInterval`, default 60 seconds). If you need faster detection of these operations on CL7/CL8, lower the revalidation interval (e.g. `MaxCacheHTCacheRevalidateInterval 10`).
1924-
1925-
On CloudLinux 9+ (kernel 5.14+), all change types — including deletes, renames, and moves — are detected in real time.
1926-
:::
1919+
With the default value of `0`, any `.htaccess` create, modify, or delete is detected on the very next request through that directory — no separate daemon is required.
19271920
19281921
#### Configuration directives
19291922
1930-
All full .htaccess caching directives go inside `<IfModule mod_maxcache.c>` in the Apache configuration. Full .htaccess caching is configured in `/etc/apache2/conf.d/maxcache_htcache.conf`.
1923+
All full .htaccess caching directives go inside `<IfModule mod_maxcache.c>` in the Apache configuration. Full .htaccess caching is configured in `/etc/apache2/conf.d/maxcache_htaccess.conf`.
19311924
1932-
#### MaxCacheHTCache
1925+
#### MaxCacheHtaccess
19331926
1934-
* **Syntax**: `MaxCacheHTCache On|Off`
1927+
* **Syntax**: `MaxCacheHtaccess On|Off`
19351928
* **Default**: On (in shipped config)
19361929
* **Context**: server config, virtual host
19371930
* **Description**: Master enable/disable switch for the full .htaccess caching subsystem.
19381931
1939-
#### MaxCacheHTCacheRevalidateInterval
1932+
#### MaxCacheHtaccessRevalidateInterval
19401933
1941-
* **Syntax**: `MaxCacheHTCacheRevalidateInterval <seconds>`
1942-
* **Default**: 60
1943-
* **Range**: 1–3600
1934+
* **Syntax**: `MaxCacheHtaccessRevalidateInterval <seconds>`
1935+
* **Default**: 0
1936+
* **Range**: 0–3600
19441937
* **Context**: server config, virtual host
1945-
* **Description**: Polling interval for `mtime` checks when the watchd daemon is not running or for event types not detected by `fanotify` on the current platform. Lower values mean faster detection of changes via polling; higher values reduce `stat()` syscalls.
1938+
* **Description**: Minimum seconds between `mtime` revalidation checks per cached entry on the request path. With the default of `0`, each entry is `stat()`'d on every request through that path for immediate change detection. Larger values reduce `stat()` syscall traffic on busy paths at the cost of slower pick-up of `.htaccess` edits.
19461939
1947-
#### MaxCacheHTCacheEntries
1940+
#### MaxCacheHtaccessEntries
19481941
1949-
* **Syntax**: `MaxCacheHTCacheEntries <count>`
1942+
* **Syntax**: `MaxCacheHtaccessEntries <count>`
19501943
* **Default**: 50000
19511944
* **Range**: 10–500000
19521945
* **Context**: server config, virtual host
19531946
* **Description**: Maximum number of cached `.htaccess` entries in shared memory. When this limit is reached, new directories fall back to Apache's standard processing.
19541947
1955-
#### MaxCacheHTCacheMemorySize
1948+
#### MaxCacheHtaccessMemorySize
19561949
1957-
* **Syntax**: `MaxCacheHTCacheMemorySize <MB>`
1958-
* **Default**: auto (derived from `MaxCacheHTCacheEntries`)
1950+
* **Syntax**: `MaxCacheHtaccessMemorySize <MB>`
1951+
* **Default**: auto (derived from `MaxCacheHtaccessEntries`)
19591952
* **Range**: 1–4096
19601953
* **Context**: server config, virtual host
1961-
* **Description**: Shared memory arena size in megabytes. Normally sized automatically — only set this if you see `htcache: arena memory exhausted` in the error log.
1954+
* **Description**: Shared memory arena size in megabytes. Normally sized automatically — only set this if you see `maxcache-htaccess: arena memory exhausted` in the error log.
19621955
1963-
#### MaxCacheHTCacheExclude
1956+
#### MaxCacheHtaccessExclude
19641957
1965-
* **Syntax**: `MaxCacheHTCacheExclude <path> [path2] ...`
1958+
* **Syntax**: `MaxCacheHtaccessExclude <path> [path2] ...`
19661959
* **Default**: none
19671960
* **Context**: server config, virtual host
19681961
* **Description**: Exclude directory trees from full .htaccess caching. The path is matched as a prefix.
19691962
* **Example**:
19701963
```
1971-
MaxCacheHTCacheExclude /home/staging /tmp
1964+
MaxCacheHtaccessExclude /home/staging /tmp
19721965
```
19731966
1974-
#### MaxCacheHTCacheMaxFileSize
1967+
#### MaxCacheHtaccessMaxFileSize
19751968
1976-
* **Syntax**: `MaxCacheHTCacheMaxFileSize <KB>`
1969+
* **Syntax**: `MaxCacheHtaccessMaxFileSize <KB>`
19771970
* **Default**: 256
19781971
* **Range**: 0–10240
19791972
* **Context**: server config, virtual host
19801973
* **Description**: Maximum `.htaccess` file size (in KB) that full .htaccess caching will process. Files exceeding this limit are skipped and served via Apache's standard processing. Set to `0` for unlimited.
19811974
1982-
#### MaxCacheHTCacheMaxEntriesPerDocroot
1975+
#### MaxCacheHtaccessMaxEntriesPerDocroot
19831976
1984-
* **Syntax**: `MaxCacheHTCacheMaxEntriesPerDocroot <count>`
1977+
* **Syntax**: `MaxCacheHtaccessMaxEntriesPerDocroot <count>`
19851978
* **Default**: 256
19861979
* **Range**: 0–100000
19871980
* **Context**: server config, virtual host
1988-
* **Description**: Maximum cached entries under a single document root. Prevents one user from monopolizing the shared cache on multi-tenant servers. Set to `0` for unlimited (the global `MaxCacheHTCacheEntries` limit still applies).
1981+
* **Description**: Maximum cached entries under a single document root. Prevents one user from monopolizing the shared cache on multi-tenant servers. Set to `0` for unlimited (the global `MaxCacheHtaccessEntries` limit still applies).
19891982
19901983
#### Configuration examples
19911984
19921985
##### Minimal setup
19931986
19941987
```
1995-
MaxCacheHTCache On
1988+
MaxCacheHtaccess On
19961989
```
19971990
19981991
Enables full .htaccess caching globally with default settings (50,000 max entries, 60-second revalidation).
@@ -2003,8 +1996,8 @@ For a server with ~5,000 WordPress sites:
20031996
20041997
```
20051998
<IfModule mod_maxcache.c>
2006-
MaxCacheHTCache On
2007-
MaxCacheHTCacheEntries 100000
1999+
MaxCacheHtaccess On
2000+
MaxCacheHtaccessEntries 100000
20082001
</IfModule>
20092002
```
20102003
@@ -2015,9 +2008,9 @@ For a server with ~5,000 WordPress sites:
20152008
ServerName example.com
20162009
DocumentRoot /home/example/public_html
20172010

2018-
MaxCacheHTCache On
2019-
MaxCacheHTCacheEntries 10000
2020-
MaxCacheHTCacheExclude /home/example/public_html/tmp
2011+
MaxCacheHtaccess On
2012+
MaxCacheHtaccessEntries 10000
2013+
MaxCacheHtaccessExclude /home/example/public_html/tmp
20212014
</VirtualHost>
20222015
```
20232016
@@ -2027,12 +2020,12 @@ Enable globally but opt out specific vhosts:
20272020
20282021
```
20292022
# httpd.conf (global)
2030-
MaxCacheHTCache On
2023+
MaxCacheHtaccess On
20312024

20322025
<VirtualHost *:443>
20332026
ServerName staging.example.com
20342027
DocumentRoot /home/staging/public_html
2035-
MaxCacheHTCache Off
2028+
MaxCacheHtaccess Off
20362029
</VirtualHost>
20372030
```
20382031
@@ -2041,23 +2034,23 @@ MaxCacheHTCache On
20412034
Full .htaccess caching provides a status handler for monitoring. To enable it, add a `<Location>` block to your Apache configuration:
20422035
20432036
```
2044-
<Location /htcache-status>
2045-
SetHandler htcache-status
2037+
<Location /maxcache-htaccess-status>
2038+
SetHandler maxcache-htaccess-status
20462039
Require local
20472040
</Location>
20482041
```
20492042
20502043
Then query it:
20512044
20522045
```
2053-
curl -s http://localhost/htcache-status
2046+
curl -s http://localhost/maxcache-htaccess-status
20542047
```
20552048
20562049
Example output:
20572050
20582051
```
2059-
mod_maxcache HTCache Status
2060-
===========================
2052+
MaxCache Htaccess Caching Status
2053+
================================
20612054

20622055
Mode: lazy on-demand
20632056
Enabled: yes
@@ -2074,8 +2067,7 @@ Patch Pool: 256KB / 12MB used (2%)
20742067
Compacting: no
20752068
Compaction threshold: 80%
20762069

2077-
Invalidation SHM: connected
2078-
Revalidate interval: 60s
2070+
Revalidate interval: 0s
20792071

20802072
Cache (global):
20812073
Hits: 45000
@@ -2088,9 +2080,8 @@ Key fields to check:
20882080
| --- | --- | --- |
20892081
| Enabled | `yes` | `no` — full .htaccess caching is turned off in config |
20902082
| Ready | `yes` | `no` — engine failed to initialize |
2091-
| Entries | below max | at max — increase `MaxCacheHTCacheEntries` |
2092-
| Arena usage | below 90% | above 90% — increase `MaxCacheHTCacheMemorySize` |
2093-
| Invalidation SHM | `connected` | `not available` — watchd is not running or SHM file is missing |
2083+
| Entries | below max | at max — increase `MaxCacheHtaccessEntries` |
2084+
| Arena usage | below 90% | above 90% — increase `MaxCacheHtaccessMemorySize` |
20942085
| Hits | increasing | staying at 0 — full .htaccess caching is not serving cached results |
20952086
20962087
:::warning
@@ -2101,13 +2092,13 @@ The status endpoint should be restricted to localhost or trusted IPs. Remove or
21012092
21022093
| Check | Command | Expected |
21032094
| --- | --- | --- |
2104-
| watchd running? | `systemctl is-active maxcache-htcache-watchd` | `active` |
2105-
| SHM file exists? | `ls -la /dev/shm/htcache_invalidate` | File present |
2106-
| File too large? | `wc -c /path/to/.htaccess` | Under 256 KB (default `MaxCacheHTCacheMaxFileSize`) |
2107-
| Path excluded? | `grep MaxCacheHTCacheExclude /etc/apache2/conf.d/maxcache_htcache.conf` | Path not listed |
2108-
| Log: `htcache: entry limit reached (50000/50000), skipping /path` | Cache is full — increase `MaxCacheHTCacheEntries` | Remaining directories use standard Apache processing |
2109-
| Log: `htcache: per-docroot entry limit reached (256/256) for /home/user` | Single user filled their quota — increase `MaxCacheHTCacheMaxEntriesPerDocroot` | Other users are not affected |
2110-
| Log: `htcache: arena memory exhausted (400MB/400MB)` | Shared memory arena is full — increase `MaxCacheHTCacheMemorySize` | Restart Apache after changing |
2095+
| Module loaded? | `httpd -M 2>&1 \| grep maxcache` | `maxcache_module` listed |
2096+
| Config valid? | `httpd -t` | `Syntax OK` |
2097+
| File too large? | `wc -c /path/to/.htaccess` | Under 256 KB (default `MaxCacheHtaccessMaxFileSize`) |
2098+
| Path excluded? | `grep MaxCacheHtaccessExclude /etc/apache2/conf.d/maxcache_htaccess.conf` | Path not listed |
2099+
| Log: `maxcache-htaccess: entry limit reached (50000/50000), skipping /path` | Cache is full — increase `MaxCacheHtaccessEntries` | Remaining directories use standard Apache processing |
2100+
| Log: `maxcache-htaccess: per-docroot entry limit reached (256/256) for /home/user` | Single user filled their quota — increase `MaxCacheHtaccessMaxEntriesPerDocroot` | Other users are not affected |
2101+
| Log: `maxcache-htaccess: arena memory exhausted (400MB/400MB)` | Shared memory arena is full — increase `MaxCacheHtaccessMemorySize` | Restart Apache after changing |
21112102
21122103
If changes must take effect immediately, restart Apache: `systemctl restart httpd`.
21132104

0 commit comments

Comments
 (0)