This tool helps analyze jemalloc statistics by providing various analysis modes and customizable queries.
$ je-analyze <database_path> [options]--mode <analysis_mode>: Specify the analysis type--table <table_name>: View raw table data--limit <n>: Limit the number of rows displayed--config <path>: Specify custom configuration file (default:config/analyzer_config.json)--list-tables: Lists all tables available in the database. Can be combined with--prefixto filter tables by a specific prefix.--prefix <prefix>: Filter tables by a specific prefix (e.g., "merged" or "arenas").
$ python ./config/schemas_generator.py ../stats3.db ./config/table_schemas_gen.json{
"schema_path": "config/table_schemas_gen.json",
"analyses": {
"bins_analysis": {
"table": "merged*stats__bins_v1",
"metrics": [
{"name": "total_allocated", "column": "allocated", "operation": "sum"},
{"name": "avg_utilization", "column": "util", "operation": "avg"},
{"name": "total_slabs", "column": "curslabs", "operation": "sum"}
],
"groupby": ["bins", "size"]
},
// rest of the json file
}View raw data from any table in the database.
# View first 10 rows of a specific table
$ je-analyze stats.db --table stats-merged_arena_stats__bins_v1 --limit 10
# View all tables in the database
$ je-analyze stats.db --list-tables
# View tables filtered by prefix
$ je-analyze stats.db --list-tables --prefix "merged"Analyze allocation patterns and activity across different bin sizes.
$ je-analyze stats.db --mode bin_activity_analysisThis analysis shows:
- Most active bins by request count
- Allocation/deallocation patterns
- Cache hit ratios
- Fill/flush operations
- Lock contention metrics
Example output:
Top 5 Most Active Bins (by total requests):
Bin 5 (size 48 bytes):
Total Requests: 16,075,645
Allocations: 6,739,560
Cache hit ratio: 58.08%
Current allocation rate: 106,977/s
...
Analyze page usage and memory efficiency.
$ je-analyze stats.db --mode bin_pages_analysisShows:
- Pages used per bin
- Memory utilization
- Slab allocation patterns
- Overall memory efficiency
Compare activity and memory usage across different arenas.
$ je-analyze stats.db --mode arena_comparisonDisplays:
- Memory distribution across arenas
- Allocation rates per arena
- Memory utilization per arena
- Lock contention patterns
Identify bins with high lock contention.
$ je-analyze stats.db --mode high_contention_binsShows:
- Lock wait times
- Contention rates
- Owner switch frequencies
- Impact on allocation performance
You can define custom analyses in the configuration file. Example configuration:
{
"custom_analysis": {
"table": "stats-merged_arena_stats__bins_v1",
"metrics": [
{
"name": "total_allocated",
"operation": "sum",
"column": "allocated"
},
{
"name": "efficiency",
"operation": "expression",
"formula": {
"row_operation": "util",
"aggregation": "avg",
"filter": "allocated > 1000",
"having": "< 0.5"
}
}
],
"groupby": ["bins"],
"sort": {
"by": "total_allocated",
"order": "desc"
}
}
}- Simple Aggregations:
{
"name": "total_allocated",
"operation": "sum",
"column": "allocated"
}- Expressions with Filtering:
{
"name": "efficiency",
"operation": "expression",
"formula": {
"row_operation": "CAST(nonfull_slabs AS FLOAT) / NULLIF(curslabs, 0)",
"aggregation": "avg",
"filter": "curslabs >= 5",
"having": "> 0.3"
}
}Add sorting to any analysis:
{
"sort": {
"by": "total_requests",
"order": "desc"
}
}Or multiple sort criteria:
{
"sort": [
{
"by": "total_requests",
"order": "desc"
},
{
"by": "utilization",
"order": "asc"
}
]
}# Find bins with poor utilization
$ je-analyze stats.db --mode inefficient_bins
# Analyze page usage
$ je-analyze stats.db --mode bin_pages_analysis# Check lock contention
$ je-analyze stats.db --mode high_contention_bins
# Analyze activity patterns
$ je-analyze stats.db --mode bin_activity_analysis# Compare arena usage
$ je-analyze stats.db --mode arena_comparison
# Analyze bin allocation patterns
$ je-analyze stats.db --mode bins_analysis- Use
arena_comparisonto understand memory distribution - Use
bin_activity_analysisto identify hot spots
- Use
high_contention_binsfor lock contention - Use
bin_pages_analysisfor memory efficiency
- Look at cache hit ratios
- Monitor lock contention rates
- Check fill/flush patterns
- Focus on bins with low utilization
- Check page usage efficiency
- Monitor fragmentation patterns
-
"No tables found matching pattern":
- Use
--list-tablesto list available tables - Check table name spelling
- Use
-
"Column not found in schema":
- Verify column names in your configuration
- Check table schema with
--table <table_name>
-
Performance issues with large datasets:
- Use
--limitto restrict output - Add appropriate filters in your analysis configuration
- Use