To enable profiling, it is required to restart proxysql with an environment variable MALLOC_CONF to override the embedded/default jemalloc configuration.The current jemalloc configuration is xmalloc:true,lg_tcache_max:16,purge:decay.To enable memory profiling, prof and prof_leak need to be enabled, while and lg_prof_interval need to be tuned.A suggested tuning for jemalloc memory profiler could be the follow:

Therefore, the environment variable should be:

using init script

If you are running proxysql using init script /etc/init.d/proxysql , it is enough to add the follow line before the point when the process is started, for example at around line 19 in /etc/init.d/proxysql:

without init script

If you are running proxysql without init script /etc/init.d/proxysql , you need to ensure that the environment variable is set before starting . For example, if you run proxysql in foreground, you need to execute it similar to the following:

  • if you used an rpm or a deb package, specify which one exactly

To disable profiling, ProxySQL needs to be restarted without MALLOC_CONF set.