Repository navigation
Storage

Storage backends, migration, backup, and performance tuning for DZEconomy v2.1.2.
| Backend | Type | Best For | Status |
|---|---|---|---|
| SQLite | File-based | Small-to-medium servers (<50 players) | Default. Recommended for most servers |
| MySQL | Remote database | Large servers, network setups | Production-ready with HikariCP pooling |
SQLite works out of the box. Nothing to configure, nothing to install.
SQLite is the default backend. Start the server, and the plugin creates plugins/DZEconomy/data.db automatically.
storage:
type: SQLITE
sqlite:
file: data.db| Setting | Type | Default | Description |
|---|---|---|---|
storage.sqlite.file |
String | data.db |
Database file name inside plugins/DZEconomy/
|
- Uses the bundled SQLite JDBC driver. No external dependencies.
- Data is cached in memory and flushed periodically.
- The auto-save interval is configurable (default: 5 minutes).
-
Increase the auto-save interval for large servers:
auto-save: interval: 600 # 10 minutes instead of 5
-
Keep the database file on an SSD for faster I/O.
- Not suitable for BungeeCord or Velocity networks. Each server has its own file.
- Write concurrency is limited. One writer at a time.
- Very large databases (100K+ players) may see slower queries.
MySQL suits large servers (50+ players) and network setups where multiple servers share one economy database.
storage:
type: MYSQL
mysql:
host: localhost
port: 3306
database: dzeconomy
username: root
password: "your_secure_password"
use-ssl: false
pool-size: 10| Setting | Type | Default | Description |
|---|---|---|---|
storage.mysql.host |
String | localhost |
MySQL server hostname |
storage.mysql.port |
Integer | 3306 |
MySQL server port |
storage.mysql.database |
String | dzeconomy |
Database name (must exist) |
storage.mysql.username |
String | root |
Database username |
storage.mysql.password |
String | changeme |
Database password |
storage.mysql.use-ssl |
Boolean | false |
Whether to connect with SSL |
storage.mysql.pool-size |
Integer | 10 |
HikariCP connection pool size |
-
Create the database on your MySQL server:
CREATE DATABASE dzeconomy CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
Create a dedicated user (recommended):
CREATE USER 'dzeconomy_user'@'%' IDENTIFIED BY 'your_secure_password'; GRANT ALL PRIVILEGES ON dzeconomy.* TO 'dzeconomy_user'@'%'; FLUSH PRIVILEGES;
-
Set
storage.type: MYSQLinconfig.yml. -
Restart the server. DZEconomy creates the required tables automatically.
DZEconomy pools MySQL connections with HikariCP:
- High-performance connection reuse
- Automatic connection validation
- Configurable pool size
Pool Size Tuning:
| Players | Recommended Pool Size |
|---|---|
| <20 | 5 |
| 20-50 | 10 (default) |
| 50-100 | 15 |
| 100+ | 20 |
Set storage.mysql.use-ssl: true to connect over SSL. Use this on remote connections or anything crossing an untrusted network. The JDBC driver handles certificate negotiation.
- Make sure the MySQL server accepts remote connections.
- Allow port 3306 through the firewall.
- Use SSL for remote connections (
use-ssl: true). - Increase
pool-sizeif the server handles many concurrent players.
Migrate live between storage backends with /economy migrate.
/economy migrate <from> <to>
Valid backends: sqlite, mysql (and flatfile/yaml for the legacy file backend).
# SQLite to MySQL (most common)
/economy migrate sqlite mysql
# MySQL to SQLite (downgrading)
/economy migrate mysql sqlite- Pre-check — verifies the target backend differs from the current one
- Initialization — creates a temporary storage provider for the target backend
- Reading — loads all player data from the source backend
- Writing — saves all player data to the target backend
- Verification — confirms the migration succeeded
-
Completion — updates
config.ymlwith the new storage type
Back up your data before migrating. Warn players the server may lag briefly. Run the command from console or in-game, wait for completion, then restart to confirm a clean state.
| Issue | Solution |
|---|---|
| "Already using X storage!" | You are migrating to the backend already in use |
| "Migration failed!" | Check the console for errors. Verify MySQL credentials |
| Data missing after migration | Check the source backend data. Restore from backup |
| Server lag during migration | Normal for large databases. Migration is async |
Run /economy backup to create a timestamped backup in plugins/DZEconomy/backups/.
Copy the whole data folder for a complete backup:
cp -r plugins/DZEconomy/ backups/DZEconomy_$(date +%Y%m%d_%H%M%S)/- Stop the server.
- Back up the current
plugins/DZEconomy/folder, just in case. - Replace the data files with the backup.
- Start the server.
For SQLite:
cp backups/DZEconomy_20250101/data.db plugins/DZEconomy/data.dbFor MySQL:
mysql -u dzeconomy_user -p dzeconomy < backup.sql| Tip | Impact | Details |
|---|---|---|
| Use MySQL for 50+ players | High | Better write concurrency and query performance |
| Increase auto-save interval | Medium | Less disk I/O. Risk of losing recent data on crash |
| Keep SQLite on an SSD | Medium | Faster writes for file-based storage |
| Use Paper or Folia | High | Async chunk loading improves overall performance |
auto-save:
interval: 600 # 10 minutes instead of 5- Keep
data.dbon an SSD. - For databases over 50MB, consider migrating to MySQL.
- Periodically back up and recreate the database to shrink the file.
storage:
mysql:
pool-size: 15 # Adjust based on player countMySQL server tuning (in my.cnf):
[mysqld]
innodb_buffer_pool_size = 256M
innodb_log_file_size = 64M
max_connections = 100DZEconomy caches player data in memory for fast access:
- Online players — always cached
- Offline players — loaded on demand, not cached by default
- PlaceholderAPI — 3-second placeholder cache with automatic eviction
See Configuration for storage-related config options.
DZEconomy GitHub • Discord Support • Wiki Home
Developed by DemonZ Development