DataBaseX icon

DataBaseX -----

Eliminate database lag! Transparently cache SELECT queries in 0ms, detect N+1 loops, hunter RAM leak




DATABASEX DOCUMENTATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Complete technical and architectural guide for administrators & developers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


1. INSTALLATION
────────────────────────────────────────────────────
  1. Download the DataBaseX.jar file.
  2. Place it in your server's /plugins/ directory.
  3. CRITICAL FOR JAVA 21+: DataBaseX uses Java's native Instrumentation API. It starts and injects itself 100% automatically without requiring any `-javaagent` startup flags!
  4. Restart your server to generate configuration files and attach the agent to the JVM.
  5. Customize config.yml to fine-tune your cache rules.

2. CONFIGURATION GUIDE
────────────────────────────────────────────────────
General Tuning Settings:
  • slow-query-threshold-ms: Maximum duration allowed for a query before it triggers the automatic Explain Advisor (default: 10.0ms).
  • alert-main-thread-queries: Prints a big red warning in console if a plugin executes a query on the Main Spigot Thread (which blocks the TPS tick).
  • auto-repair-leak-threshold-ms: Max idle lifespan of a JDBC Statement in RAM before the Leak Hunter auto-closes it to prevent RAM leaks (default: 300000 = 5min).
Smart Caffeine Cache Tuning:
  • cache.default-ttl-seconds: Default lifetime of database records stored in RAM cache. Recommended: 5 to 10s.
  • cache.rules:<tableName>: Define per-table TTL values. Lowercase tables only. Set to 0 to completely exclude high-sensitivity tables (like player balances) from being cached.
WAF Anti-Flood Firewall:
  • firewall.max-queries-per-second: Threshold of identical consecutive queries allowed per second. If a plugin gets stuck in an infinite loop, DataBaseX cuts the flow to save MySQL from crashing (default: 100).
Centralized SQL Provider:
  • database-provider.enabled: Enable the global shared pool. Allows other plugins to bypass configuring credentials.
  • pool.maximum-pool-size: Max concurrent MySQL connections allowed globally (default: 20).
  • pool.minimum-idle: Minimum idle connections maintained to avoid startup latency (default: 5).

3. DEVELOPER INTEGRATION (API)
────────────────────────────────────────────────────
Developers no longer need to bundle HikariCP or ask admins for DB passwords. DataBaseX provides a clean, enterprise-grade static gateway.

Get a Managed SQL Connection:
Add DataBaseX as a dependency in your pom.xml (provided) and call the gateway in your code:
Code (Java):

// 100% Managed, 100% Optimized, 0ms Configuration!
try ( Connection conn = fr. skynex. databasex. api. DataBaseXAPI. getConnection ( ) ) {
    try ( PreparedStatement ps = conn. prepareStatement ( "SELECT * FROM players WHERE uuid = ?" ) ) {
        ps. setString ( 1, uuid. toString ( ) ) ;
        // ... Rest of your business logic ...
    }
} catch ( SQLException e ) {
    e. printStackTrace ( ) ;
}
 

Under the hood: The Namespace Magic
When using our shared API, DataBaseX transparently uses **Bytecode Mutation** to rewrite your queries at the JVM level to isolate your tables!
If your plugin named "LootGlow" executes:
Code (SQL):

CREATE TABLE IF NOT EXISTS stats (uuid VARCHAR ( 36 ) , coins INT );
 
DataBaseX automatically intercept it and translates it behind your back into:
Code (SQL):

CREATE TABLE IF NOT EXISTS dbx_lootglow_stats (uuid VARCHAR ( 36 ) , coins INT );
 
Benefit: Absolute zero table name collision risk with other plugins, even on shared databases!

️ 4. COMMANDS & DASHBOARDS
────────────────────────────────────────────────────
/dbx Show active stats, Cache Hits, Cache Misses and Coalesced queries.
/dbx active The SQL "htop". Shows running background queries, their thread names, and live elapsed time.
/dbx top List the Top 10 slowest recorded queries, with automatic diagnostic advice.
/dbx explain <sql> Simulate a SELECT query and get indexing advice directly in the game chat.
/dbx purge Purges the Caffeine RAM Cache (instantly frees memory).


5. PERMISSIONS
────────────────────────────────────────────────────
  • databasex.admin — Access to all administrative commands (/dbx active, explain, top, purge, reload). Recommended only for high-level technical administrators.
  • databasex.notify — Admins with this node will receive live red-alert notifications in-game when an N+1 Loop or a critical Main Thread execution is detected.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Questions? Technical issues? Join us on Discord!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[​IMG]
Resource Information
Author:
----------
Total Downloads: 18
First Release: May 14, 2026
Last Update: May 24, 2026
Category: ---------------
All-Time Rating:
1 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings