Database

The New Economy – Database & Data Settings


Overview

The data.yml file controls how The New Economy (TNE) stores and syncs player data, transactions, and configurations across servers. It includes settings for:

  • Syncing data between servers (BungeeCord, Velocity, Redis).

  • Database backend (YAML, MySQL, MariaDB).

  • Purging inactive accounts and old transactions.

  • Connection pools for Redis and SQL.

  • Auto-saving data at intervals.


Config Version

config-version: 4

1. Sync Settings

The Sync block controls how data and configs are synchronized across multiple servers.

Reload

Reload:
  Enabled: false
  Time: 120
  • Enabled → If true, reloads data from the database on the first player to join after downtime.

  • Time → Delay (minutes) between reloads.

Type

Type: Bungee
  • Options: Bungee, Redis

  • Determines sync mechanism across a network.

  • Use Redis for large or multi-proxy setups.

Redis

Redis:
  Host: "localhost"
  Port: 6379
  User: "user"
  Password: "password"
  Index: 1
  Timeout: 2000
  SSL: false

Basic Redis connection details.

Redis Connection Pool

Pool:
  MaxSize: 10
  MaxIdle: 10
  MinIdle: 1
  MaxWait: 15000
  BlockWhenExhausted: true
  TimeBetweenEvictionRunsMillis: 30000
  MinEvictableIdleTimeMillis: 300000
  SoftMinEvictableIdleTimeMillis: 120000
  NumTestsPerEvictionRun: 3
  TestOnCreate: false
  TestWhileIdle: true
  TestOnBorrow: true
  TestOnReturn: false
  Lifo: true
  JmxEnabled: false

Standard Jedis pool settings for Redis stability.

  • Adjust MaxSize/MaxIdle for your player count.

  • Keep TestWhileIdle: true to avoid stale sockets.

JMX Settings

  • JmxEnabled → Enables or disables JMX monitoring for the connection pool. Should remain false unless you are actively monitoring with JConsole, Prometheus, or another JMX client.

  • JmxNamePrefix → A string prefix applied to JMX MBeans (e.g., "tne_redis_pool"). Use this to differentiate between multiple Redis pools.

  • JmxNameBase → The base identifier for JMX object names. Defaults to "pool", but can be changed to something descriptive (e.g., "economy_pool").

⚠️ Performance Note: JMX introduces a small overhead. Only enable and configure these if you are doing advanced monitoring or troubleshooting.


2. Purge Settings

Controls removal of inactive data to reduce database size.

Purge:
  Enabled: true
  Transaction:
    Archive: true
    Days: 20
  Accounts:
    Days: 90
  • Enabled → Whether purging is active.

  • Transaction.Archive → Skip archived transactions.

  • Transaction.Days → Days before transactions are purged.

  • Accounts.Days → Days of inactivity before an account is purged.


3. Database Settings

The database backend where economy data is stored.

Database:
  Type: "yaml"
  Prefix: "tne_"
  File: "Economy"

Types

  • YAML → File-based storage (default, simple single-server).

  • MySQL / Maria → Recommended for production/multi-server.

  • maria-outdated → For MariaDB < 10.7.0 or MySQL < 8.0.0.

SQL Options

SQL:
  Host: "localhost"
  SSL: false
  PublicKey: false
  Port: 3306
  DB: "TheNewEconomy"
  User: "user"
  Password: "password"
  • Host/Port → Database connection target.

  • DB → Database name.

  • User/Password → SQL user credentials.

  • SSL/PublicKey → Security options depending on host.


4. AutoSaver

Controls periodic saving of player data.

AutoSaver:
  Enabled: true
  Interval: 600
  • Enabled → If true, data is auto-saved.

  • Interval → Frequency in seconds (default: 10 minutes).


5. SQL Connection Pool

For SQL-based backends.

Pool:
  MaxSize: 10
  MaxIdle: 10
  MaxLife: 180000
  Timeout: 60000
  • MaxSize → Maximum connections.

  • MaxIdle → Idle connections allowed.

  • MaxLife → Max connection lifetime (ms).

  • Timeout → Timeout per connection (ms).


📌 Recommendations

  • Small servers → Use YAML or SQLite (lightweight, no external DB).

  • Multi-server setups → Use MySQL or MariaDB with Redis syncing.

Suggested Jedis Connection Pool Profiles

This is used for when Data.Sync.Type is set to Redis in data.yml.

Setting
Recommended (High-Throughput)
Low-RAM Profile
Heavy-Burst Profile
Notes

MaxTotal

64

24

96

Total connections (active + idle). Heavy-Burst raises ceiling to absorb auction/shop spikes.

MaxIdle

16

6

32

Keep more idle connections for sudden bursts.

MinIdle

8

2

16

Warm pool for rapid expansion under spikes.

BlockWhenExhausted

true

true

true

Always safer to block than error out.

MaxWait

15000 ms (15s)

10000 ms (10s)

20000 ms (20s)

Longer tolerance for bursts; lets threads queue during peak auctions.

TimeBetweenEvictionRunsMillis

30000 ms (30s)

20000 ms (20s)

45000 ms (45s)

Slightly slower runs to reduce CPU overhead during spikes.

MinEvictableIdleTimeMillis

300000 ms (5m)

120000 ms (2m)

600000 ms (10m)

Allow more idle time before eviction; keeps burst pool available.

SoftMinEvictableIdleTimeMillis

120000 ms (2m)

60000 ms (1m)

300000 ms (5m)

Evict idle later to maintain larger pools during busy hours.

NumTestsPerEvictionRun

3

2

5

Validate more connections per cycle to keep larger pools healthy.

TestWhileIdle

true

true

true

Strongly recommended; protects against dead sockets.

TestOnBorrow

true

true

true

Ensures stable connections under load.

TestOnReturn

false

false

false

Leave disabled unless debugging.

TestOnCreate

false

false

false

Only enable if Redis/network instability is observed.

Lifo

true

true

true

Always reuse hottest connections first.

JmxEnabled

false

false

false

Disable unless actively monitoring.


Profile Overview

  • Recommended (High-Throughput) → Balanced defaults for medium–large servers (auctions, player economies).

  • Low-RAM Profile → Tight footprint for JVM heaps under ~4 GB; aggressive trimming.

  • Heavy-Burst Profile → Optimized for peak loads (auctions, mass shop scans, large events); keeps a bigger warm pool at a higher memory cost.

Last updated