Ride-The-Lightning / RTL

Ride The Lightning - A full function web browser app for LND, C-Lightning and Eclair
MIT License
749 stars 158 forks source link

`CLNRest` high CPU usage #1443

Open sha-265 opened 2 months ago

sha-265 commented 2 months ago

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

ShahanaFarooqui commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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.

sha-265 commented 2 months ago

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.

ShahanaFarooqui commented 2 months ago

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?

sha-265 commented 2 months ago

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.