selfhosting icon indicating copy to clipboard operation
selfhosting copied to clipboard

Clickhouse default configuration

Open KaelWD opened this issue 2 years ago • 6 comments

The default log level is trace which uses loads of disk space for no reason: https://theorangeone.net/posts/calming-down-clickhouse/

It also expects at least 16GB of ram which could cause problems on smaller servers without some tweaks: https://clickhouse.com/docs/en/operations/tips#using-less-than-16gb-of-ram

KaelWD avatar Oct 26 '24 12:10 KaelWD

We disable Clickhouse query logs for selfhosted here, and set up proper error logging here.

Does Clickhouse use lots of disk space for you?

But I agree on that point, we should supply proper Clickhouse config to set up things like that. I'll try to get it done in the next release.

Blaumaus avatar Oct 26 '24 20:10 Blaumaus

I didn't actually check the query log before clearing it so that might have been ok already, /var/log/clickhouse/clickhouse-server.log was 800MB of trace level logs though so something is definitely not configured correctly.

KaelWD avatar Oct 27 '24 03:10 KaelWD

With this config clickhouse is using around 250MB of memory instead of 650. I only have a few hundred events at the moment though, I have another site that should generate over 200k per day so it'll be interesting to see how performance is impacted when I add that one.

<mark_cache_size>536870912</mark_cache_size>
<concurrent_threads_soft_limit_num>1</concurrent_threads_soft_limit_num>
<profiles>
	<default>
	    <max_block_size>2048</max_block_size>
	    <max_download_threads>1</max_download_threads>
	    <input_format_parallel_parsing>0</input_format_parallel_parsing>
	    <output_format_parallel_formatting>0</output_format_parallel_formatting>
	</default>
</profiles>

KaelWD avatar Oct 31 '24 16:10 KaelWD

Thank you for adding this. I'll play around with configs as well to see what works best for the next release. Please let me know how did Clickhouse end up performing for you if you test it on that 200k traffic site

Blaumaus avatar Oct 31 '24 22:10 Blaumaus

Got 150k over the weekend and the dashboard is still fast, clickhouse memory hasn't gone over 500MB. I might need to increase the limits a bit once there's a few months of data but I think this is probably totally fine as a starting point for smaller sites.

KaelWD avatar Nov 04 '24 05:11 KaelWD

https://github.com/Swetrix/selfhosting/pull/10 I've opened a PR with some configs. I've put your config to reduce RAM usage there as well.

It will be merged into the next self-hosted release, let me know if you have any further suggestions to these configuration files.

Also thank you very much for contributing to the project, it helps a lot!

Blaumaus avatar Nov 04 '24 22:11 Blaumaus