SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Use jemalloc in standalone and add stats.

Open jsdt opened this issue 10 months ago • 6 comments

Description of Changes

This uses jemalloc in standalone instead of mimalloc, unless the target env is msvc. The main reason is that jemalloc exposes better stats, and has a way to do heap profiling. This PR doesn't set up profiling, but it does add stats on jemalloc's memory usage.

Expected complexity level and risk

  1. The risk here is that there could be an issue on some platforms.

Testing

This works on mac and at least some linux platforms.

jsdt avatar Mar 14 '25 17:03 jsdt

I suspect we should probably figure out if there are any platforms that this won't work on, since we just went through the work to expand our platform support (https://github.com/clockworklabs/SpacetimeDB/issues/2415).

I guess alternatively we could wait to see if any users complain..

bfops avatar Mar 14 '25 22:03 bfops

this broadly looks good to me, but I'm not very familiar with different allocator behavior or with the stats part of our code, so I wonder if we can get someone to review who's more confident.

bfops avatar Mar 14 '25 22:03 bfops

Could you please run subscription benchmarks before/after as well as the update 10^6 benchmark before/after?

Centril avatar Mar 18 '25 14:03 Centril

benchmarks please

jsdt avatar Mar 18 '25 18:03 jsdt

Criterion benchmark results

Error when comparing benchmarks: Couldn't find AWS credentials in environment, credentials file, or IAM role.

Caused by: Couldn't find AWS credentials in environment, credentials file, or IAM role.

github-actions[bot] avatar Mar 18 '25 18:03 github-actions[bot]

Callgrind benchmark in progress...

github-actions[bot] avatar Mar 18 '25 18:03 github-actions[bot]