Rank 1: Thread
I've noticed on self-hosted Appwrite 2.1.0 that usage stats take a lot of CPU resources. More specifically, clickhouse-serv process uses that resources. When stats are enabled, this process takes 100-200% of my VPS CPU, whereas when disabled, it takes 10-30%. My machine is 4.5GB RAM, 3 Intel E5-2680 cores KVM VPS.
I'm using functions, which may have hundreds of executions per minute. I've set _APP_EXECUTIONS_DUAL_WRITE=disabled but it seems not to make much of a difference. Even when I disabled functions temporarily, so they won't generate executions, it didn't affect CPU usage. Similarly, when I disabled entire inbound or outbound traffic to Appwrite, the Clickhouse still used a lot of CPU. When I disabled logs entirely _APP_USAGE_STATS=disabled, the CPU usage dropped, but it still used 10-40% of CPU, which is pretty high considering it should log barely anything.
Is there any way to optimize it by changing any setting, so storing stats won't take that much resources?