A persistent process keeps the indexes of all sets in memory and answers filter AJAX requests without starting MODX. Measured on 500k products: regular endpoint 37–45 ms, turbo 17–27 ms, the same request repeated ~4 ms; on 2k products — 7–11 ms instead of 21–24 ms. The first page load goes through MODX as usual.
Needed: a VDS with console access, PHP CLI with the pcntl and posix extensions, nginx, systemd (or supervisor). Memory — about the size of all set indexes; workers share it with the main process.
publicConnector.php.The texts below contain this site's paths. The service user is the same user the site's php-fpm pool runs as.
@@unit@@server { } and reload nginx (nginx -t && systemctl reload nginx). The nginx user needs access to the socket (mode 0660 — nginx must be in the site user's group):
@@nginx@@/bitfacet-turbo (the bitfacet.turbo_url system setting) → "Check connection": both items must be green.X-BitFacet: turbo header.bitfacet.turbo_url setting: cleared — within 2 s the process sleeps and frees memory, filled — it wakes up. No need to touch the service.[[+name]], [[%key]]). A request with a Fenom chunk or MODX tags is passed to the regular endpoint — it works, without the speed-up.--workers=4 | concurrent requests (usually the number of cores) |
--max-requests=10000 | a worker restarts after this many requests |
--memory=256 | a worker restarts if its memory grew by this many MB |
--socket= | own socket path (default turbo.sock in the index folder) |
systemctl status @@service@@ # status
systemctl restart @@service@@ # restart
journalctl -u @@service@@ -n 50 # process log
Several shops on one server — each has its own service (named after the site address), socket and nginx block; they share only the server's memory and CPU. On a small server use --workers=2.