XWiki Runtime Architecture
Explanation
XWiki is a Java web application, so an instance is never a single program: it is a Java runtime, a servlet container serving the application, a relational database holding the content, and a directory on disk holding what the database does not. The installation methods differ mainly in how many of those you assemble yourself.
The pieces
| Piece | Why XWiki needs it | What it has to be |
|---|---|---|
| Java runtime | XWiki is compiled Java, so nothing runs without one. | A Java Runtime Environment in a supported version. A JDK is not needed. |
| Servlet container | It listens on the network, serves the web application and hands it each request. | Any container implementing Servlet 6.0 (XWiki <19.0.0 Servlet 5.0). Tomcat and Jetty are the supported ones. |
| XWiki web application | The wiki itself, deployed as the .war package the container unpacks. | One of the distributions below, or the .war from the Download page. |
| Relational database | It holds the Pages, their history and the objects attached to them. | Any database with a JDBC 4.2 driver, among the supported ones. HSQLDB is meant for evaluation rather than production. |
| Permanent directory | It holds what is not in the database and still has to survive a restart and an upgrade. | A directory outside the application, so that an upgrade replaces the application without touching the data. |
The version each of them has to be is in the prerequisites.
The distributions assemble the same pieces
Picking an installation method is deciding how much of that stack is yours to install and configure:
- The standalone (demo) distribution ships Jetty and HSQLDB inside the archive, so only the Java runtime is yours.
- The Docker image ships the runtime and the container; you point it at a database and at persistent storage.
- The Debian packages let the package manager pull in the runtime, the container and the database.
- The .war package leaves all of them to you, which is what makes it the method for a deployment you want to control.
Where an instance's state lives
The data is in two places, and a backup that takes only one of them is incomplete:
- The relational database holds the Pages and their history, the objects attached to them, and the metadata of every attachment.
- The permanent directory holds the attachment content, which is on the filesystem unless you switch to the database store, the installed extensions, the Solr search data and the statuses of the background jobs. Sub-Directories in the Permanent Directory lists all of it.
The temporary directory is not part of that: XWiki empties it at every startup.
Whatever the store, the fields holding page references, page titles and the short string properties of an object are limited to 768 characters, which is the longest value MySQL can index.
FAQ
Do I have to install Java, a servlet container and a database myself?
All three only with the .war package. Each of the other installation methods ships or pulls in part of the stack, rarely all of it: the standalone distribution still needs a Java runtime, the Docker image a database, and only the Debian packages pull in everything.
Why does XWiki need a directory on disk as well as a database?
Because some of what an instance keeps is files rather than rows: the installed extensions, the Solr search data and, unless you move it, the content of the attachments. The permanent directory is where they go.
Why did my instance lose its data after a restart?
Most likely because it never found a permanent directory and fell back to the directory the servlet container uses for temporary files. XWiki does not empty that one, but nothing preserves it either: the operating system clears its temporary directory, an upgrade of the servlet container replaces it, and a container image loses it when the container is recreated. XWiki logs a warning naming environment.permanentDirectory when that happens, and Find the Current Permanent Directory shows which directory it ended up with.