Dedicated servers
This page is for hosting companies that put Exponential on a dedicated (physical) server: either one large customer site on a machine of its own, or many customer sites on one big machine. It answers how the project's sources say to use the resources of such a machine, which figures they give, and what you must measure yourself.
Contents
- Two ways to use a dedicated server
- Using the cores: workers and instances
- Memory: read PSS, not RSS
- The database on a dedicated server
- Many sites on one machine
- Measuring before you buy
- Checklist
Two ways to use a dedicated server
| Use | Shape | Main concern |
|---|---|---|
| One large site | Velocity facing visitors, a large worker pool, possibly several instances; the database on the same machine or a second one | using all cores; database writes |
| Many customer sites | one PHP-FPM pool or one Velocity instance per site, each as its own user | isolation; fair sharing of memory and CPU |
A dedicated server is tier 1, 2 or 3 by the distribution you install, exactly as a virtual machine is (Operating system support). The project's own development server is an AlmaLinux 9 machine with Plesk, running Apache with PHP-FPM 8.5 and Exponential Velocity on the same installation (Tier 1).
Using the cores: workers and instances
Velocity's capacity is set in settings/override/velocity.ini.append.php, [ServerSettings]
(8.3.6):
| Setting | Shipped | Meaning |
|---|---|---|
Workers | 4 | the size of the pool; with SpareWorkers, the most it grows to |
SpareWorkers | 0 | above 0: a dynamic pool that keeps this many idle workers |
IdleWorkerTimeout | 60 | seconds an extra worker may stay idle before it is retired |
Instances | 1 | servers sharing the same ports with SO_REUSEPORT (Linux and the BSDs); Workers and SpareWorkers are per instance |
Chapter 8 suggests "a good start for a production site" as a dynamic pool:
# settings/override/velocity.ini.append.php
[ServerSettings]
Workers=64
SpareWorkers=8
IdleWorkerTimeout=60What the sources measured: "One server answers cached pages in its own process and is bounded by one core
(measured: about 2,950 cached pages a second over TLS; four instances, about 12,000). Rendered pages are bounded by
the workers, not by the number of instances." On a machine with many cores, Instances above 1 spreads the cached
traffic; the worker count decides the rendered traffic.
Note
Those figures are the project's own measurement on its own machine, quoted so you know the shape of the scaling. They are not a promise for your hardware. Measure your own (see Measuring before you buy).
With Apache or nginx and PHP-FPM, the PHP-FPM pool's process settings play the role of Workers; see
PHP-FPM tuning.
Memory: read PSS, not RSS
"A worker of a full Exponential costs about 10 to 11 MB of its own memory (measured as PSS on 12 cores and PHP 8.5); the shared part, about 47 MB, is paid once. Judge memory by PSS or private memory, never by RSS, which counts every shared page once per worker and overstates a pool many times." (8.3.6)
For a dedicated server this means a large pool is cheap in memory; the limits come from CPU, the database and the caches. Velocity's control panel shows memory as PSS (Velocity control panel).
Workers are also replaced on their own after maxRequests (1000), when the heap passes workerMemoryCeiling, or
when a request runs past requestTimeout (30 seconds, the client gets 504). These are engine settings
(Velocity worker pool).
The database on a dedicated server
In the official order: 1. SQLite 3 (the default) · 2. PostgreSQL · 3. MongoDB · 4. MariaDB · 5. Oracle · 6. MySQL. Microsoft SQL Server is known to be possible with additional work at this time.
- 1. SQLite 3 on the same machine "scales reads with the number of processes; writes queue". It is a full
production database for one machine. Count "up to 64 MB of page cache per process that has opened the database"
when you size memory for a large worker pool (
SQLitePragmas[]=cache_size=-16384lowers it to 16 MB) (Performance and scaling). - 2. PostgreSQL (and 4. MariaDB, 6. MySQL) "scale writes with row-level locking"; under Velocity each worker keeps its connection, so the database server must accept as many connections as there are workers across all instances.
- A second machine for the database is the step towards several web nodes.
Most requests never reach the database: Velocity's response cache, the view cache and the template-block cache answer first (Caching layers).
Many sites on one machine
For many customers on one dedicated server, follow the isolation rule of the root README.md: "run one Velocity
instance per site behind a proxy, each as its own operating-system user", or use a traditional server with one
PHP-FPM pool per site (8.1). One Exponential
installation with several siteaccesses is not a boundary between customers
(Multi-tenant isolation).
Each site then has its own var/, its own cron lines in its own user's crontab and its own backups.
Measuring before you buy
The installation book "gives few hard numbers, and this book does not invent others" (2.10 Memory, CPU and disk). Measure a representative site on candidate hardware:
php bin/php/console exp:benchmark
php bin/php/console exp:benchmark --compare=https://example.com,https://example.com:8080The second form compares two addresses, for example Apache and Velocity on the same installation (Benchmark, Benchmarking a hosted site). Record the hardware, PHP version, engine, worker settings and cache state with each result.
Checklist
- To do: One large site or many sites decided; isolation per site for many customers.
- To do:
Workers,SpareWorkersandInstancesset explicitly and measured. - To do: Memory judged by PSS; database connection limits match the worker count.
- To do: Database in the official order, on this machine or a second one.
- To do: Benchmarks recorded for the machine type before it is sold as a plan.
- To do: Boot service for Velocity, monitoring and backups in place.
Related pages
- Choosing a hosting model, VPS hosting
- Sizing memory, CPU and disk
- Velocity workers and pools
- Velocity web server
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.