Data Layer Diagnostics
Diagnose cache performance, datasource health, slow SQL queries, and slow outbound HTTP/SOAP calls.
This guide covers how to diagnose data layer issues using the bx-mcp tools β cache performance, datasource connectivity, slow SQL queries, and slow outbound HTTP/SOAP calls.
ποΈ Cache Analysis
View All Caches
curl -s http://localhost:8080/~bxmcp/boxlang.bxm \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-token" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"cache_get_all","arguments":{}},"id":"1"}'Returns configuration, statistics, and status for every registered cache provider.
Cache Health Assessment
curl -s http://localhost:8080/~bxmcp/boxlang.bxm \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-token" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"cache_get_health","arguments":{}},"id":"1"}'The health report flags issues like:
CACHE_DISABLED
warning
Cache not enabled
CACHE_LOW_HIT_RATE
warning
Hit rate < 30%
CACHE_HIGH_EVICTIONS
warning
Evictions >= cache size (thrashing)
Detailed Cache Statistics
Cache Maintenance Operations
π Datasource Connectivity
View All Datasources
Datasource Health Assessment
The health report flags issues like:
DS_POOL_NOT_STARTED
warning
Pooling not started
DS_POOL_HIGH_UTILIZATION
warning
> 80% utilization
DS_POOL_SATURATED
critical
>= 95% utilization
DS_POOL_THREADS_AWAITING
warning
Waiting threads > 0
Test a Specific Connection
Returns success/failure with timing information to quickly identify connectivity issues.
Pool Metrics and Latency
The pool latency tool returns p50/p95/p99/max for acquire, usage, and creation times, plus timeout counts. Enable it in your configuration:
Requires BoxLang 1.14+ with
ON_DATASOURCE_INITIALIZEDevent support.
π’ Slow SQL Diagnosis
The bx-mcp module captures slow SQL queries automatically when slowSQL.enabled is true (default).
Configuration
View Captured Slow Queries
Aggregate Query Statistics
This groups captured queries by their original SQL and datasource, showing counts, average latency, and max latency.
Runtime Configuration
π Slow HTTP/SOAP Diagnosis
The module captures slow outbound HTTP and SOAP calls automatically when slowHttp.enabled is true (default). Since SOAP calls transit through the same BoxHttpClient pipeline, they are captured automatically.
Configuration
View Captured Slow Calls
Aggregate Call Statistics
Groups slow calls by destination host with count, average latency, and max latency.
Runtime Configuration
π Troubleshooting Example: Slow Application Response
Here's a systematic approach to diagnose a slow-responding application:
1. Check system health:
2. Look for slow queries:
3. Check for slow HTTP calls to downstream services:
4. Inspect connection pools:
5. Check for thread contention:
π Next Steps
Operations & Monitoring β Health checks and performance monitoring
Incident Response β Triage and error response workflows
MCP Tools Reference β Complete tool catalog
Last updated
Was this helpful?
