RTL icon indicating copy to clipboard operation
RTL copied to clipboard

`CLNRest` high CPU usage

Open sha-265 opened this issue 1 year ago • 6 comments

Describe the bug When using RTL with CLNRest, the CLNRest's python process is using a lot of CPU, after login to RTL.

This high CPU usage didn't happen with c-lightning-REST.

To Reproduce Steps to reproduce the behavior:

  1. Config RTL to work with CLNRest
  2. Login to RTL
  3. See CLNRest CPU usage

Your environment

  • Version of RTL: v0.15.2-beta
  • Version of core lightning: 23.11.2
  • Version of bitcoind: 26.2
  • Operating system (uname -a on *Nix): Ubuntu 20.04

sha-265 avatar Sep 26 '24 12:09 sha-265

I tried the steps you provided above with CLN v23.11.2, RTL v0.15.2-beta & Ubuntu 22.04. But my CPU usage for clnrest reached maximum upto 0.1% & memory upto 0.2%. But I did not have much data in my node to test for.

Screenshot from 2024-09-26 09-46-32

Could you please confirm how much CPU usage clnrest takes when you login to RTL? Does your node have huge number of invoices/forwards/payments etc?

ShahanaFarooqui avatar Sep 26 '24 16:09 ShahanaFarooqui

And this is the usage from CLN v24.08.1 node which has decent data volume:

Screenshot from 2024-09-26 10-01-45

ShahanaFarooqui avatar Sep 26 '24 17:09 ShahanaFarooqui

Can you also confirm your Core lightning's log-level. clnrest uses the log-level set by Core lightning as described in the config. clnrest could be taking time in logging if the level is set to log everything.

ShahanaFarooqui avatar Sep 26 '24 17:09 ShahanaFarooqui

Could you please confirm how much CPU usage clnrest takes when you login to RTL? Does your node have huge number of invoices/forwards/payments etc?

image

This node is running for few years. I don't know what huge means, but there is ~10K failed forwards and pays.

Can you also confirm your Core lightning's log-level. clnrest uses the log-level set by Core lightning as described in the config. clnrest could be taking time in logging if the level is set to log everything.

The log level is the default one. It's not set in the config.

sha-265 avatar Sep 26 '24 17:09 sha-265

The default log level is set to info, which minimizes the amount of logging from clnrest.

Additionally, I created a new node with 6K invoices, 6K payments, 8K forwards & 10K local_failed forwards to test CPU usage. During testing, the CPU usage peaked at only 3% when loading the RTL dashboard. All other pages showed even lower CPU usage.

Running autoclean-once on failed forwards and payments might improve the node’s performance slightly.

What is your system configuration?

ShahanaFarooqui avatar Sep 26 '24 20:09 ShahanaFarooqui

You mean hardware wise? It's a dual core x64 PC, with 8GB memory.

The only think that I think could be related is the remote backup I have, which also use high CPU when logging in to RTL.

sha-265 avatar Sep 27 '24 19:09 sha-265