getumbrel / umbrel-apps

The official app repository of the Umbrel App Store. Submit apps and updates here. Learn how → https://github.com/getumbrel/umbrel-apps#readme
https://apps.umbrel.com
491 stars 370 forks source link

Use Redis on BTC RPC Explorer #557

Open jaonoctus opened 3 years ago

jaonoctus commented 3 years ago

Expected Behavior

Load screens quickly, if they have been visited before.

Actual Behavior

Some pages loads slowly, since it needs to query the bitcoind / electrs on each access. e.g. Block Analysis or Block Stats.

Steps to Reproduce the Problem

1.0. Open any Block Analysis. 1.1. Change page. 1.2. Open the same Block Analysis again.

2.0. Open the Block Stats page (default block range 1d). 2.1. Change the block range to 30d. 2.2. It will load everything again, when it should already have the ~1d in memory.

Specifications

MiguelMedeiros commented 3 years ago

Great issue! I've reproduced the problem and thought the same thing. It would be much faster if it comes with a redis caching all the data.

lukechilds commented 3 years ago

Thanks for the detailed report!

How long is the wait without Redis, and how fast is it with Redis?

Also do you know roughly how large the Redis cache needs to be for BTCPay to make good use of it? Are we talking 10s of MB or hundreds of MB?

If we need to give Redis a large amount of memory it may not be a good tradeoff for our specific use case, RAM is quite scarce on Pi hardware which is what we're currently optimising for. While it's acceptable for a personal BTCPay instance to take a little longer to load, it's less acceptable for it to use a significant amount of the devices memory for a single application.

Definitely open to adding this, but just want to confirm the memory use is reasonably.

An alternative approach would be to bump up the memory use for BTCPay but not allow many other apps to be installed on lower memory devices if BTCPay is also installed. So people who want performant BTCPay can still do it with Umbrel, but users without much RAM would basically have to choose between BTCPay or other apps.

lukechilds commented 3 years ago

Oops sorry, just realised you guys were talking about BTC RPC Explorer, not BTCPay server!

Yeah after thinking about this a little more and discussing with the team we definitely think this is the best approach:

An alternative approach would be to bump up the memory use for BTCPay but not allow many other apps to be installed on lower memory devices if BTCPay is also installed.

It's not super high priority right now but definitely happy to add this when our current priorities are sorted. Thanks for the report guys!