breezmobile icon indicating copy to clipboard operation
breezmobile copied to clipboard

Performance optimization

Open rkfg opened this issue 2 years ago • 8 comments

Can't really say it's a big issue but would be nice to speed the payments up. Currently on my Moto G7 Power it takes about 14 seconds to process a payment. I ran adb shell and top shows that Breez utilizes more than 300% of CPU during that process. Probably an LND issue/path finding or such but not networking for sure. This time is mostly constant no matter the amount so even when I send 10-100 sats it takes this long. I have channels opened to my node from both Breez and Electrum and payment goes instantly from Electrum to Breez but takes 14-17 seconds the other way (it really shouldn't take this long to find a route that only involves one hope between them).

For comparison, Muun sends in 2-3 seconds but their model is quite unusual, the wallet is semi-custodial (the node processes your payments and you interact with it using their prorietary HTTPS API but you can withdraw money on chain at any time) so the phone acts like a lightweight client.

rkfg avatar Jul 17 '21 20:07 rkfg

@rkfg Thanks for this issue and details. We started working on profiling the payment process and I might need your help in installing a custom build that I will create (if you are willing too of course). Path finding is certainly a candidate but I guess I will be able to tell more in the following days. Meantime can you tell us how many channels you have on your breez app?

roeierez avatar Jul 21 '21 17:07 roeierez

Thanks! Of course, I'm ready to help. I've built Breez myself and installed it under a different applicationId so I can rebuild the core and UI from another branch if needed, no problem. In that debug version I only have one channel (to Breez) and I see more or less similar performance there. I had to extract the configs from the official APK because those in the repo lack quite a lot of parameters and keys...

In the main production version (from Google Play) I currently have 4 channels opened, 3 of them to the Breez node and 1 to my own.

rkfg avatar Jul 21 '21 17:07 rkfg

I experimented with Blixt wallet that also uses lnd internally, looks like its processing is faster than Breez's. Takes about 3 seconds to send from Blixt to Breez (both have channels opened to my RPi node), about 10 seconds to Muun (Breez spends 25 seconds). Blixt's lnd version is 0.13.1-beta while Breez uses 0.12.1-beta.

It might be coincidental but the debug version is slightly faster, it sends to Muun in ~17 seconds like I wrote 3 weeks ago but the production version now needs 25 seconds. Maybe it slows down due to the accumulated invoices? I use it quite often and there's already quite a big log of transactions. If it's true I expect Blixt to also slow down if I keep using it extensively.

rkfg avatar Aug 13 '21 20:08 rkfg

Any progress? Simple Bitcoin Wallet is able to send an LN transaction in 2-3 seconds and it's instant when I'm sending to my own neighboring node I have a channel with. Breez became so slow I stopped using it at all. lnd recently released v0.14 that caches the channel graph in memory and it gave a huge boost in path finding, meanwhile Breez is still stuck on 0.12.

rkfg avatar Dec 04 '21 10:12 rkfg

We're planning a 0.14 upgrade.

kingonly avatar Dec 04 '21 11:12 kingonly

Please wait until you can upgrade to at least 0.14.2. Cause current version has some inconvenient issues.

tlindi avatar Feb 03 '22 13:02 tlindi

0.15.1 is out and it's better than ever. Any plans to upgrade from the ancient 0.12?

rkfg avatar Sep 09 '22 01:09 rkfg

We're working on it. In the next few weeks.

kingonly avatar Sep 09 '22 04:09 kingonly

Package updated to 15.3. Our LSP was optimized as well. Could you please take another look?

kingonly avatar Oct 23 '22 12:10 kingonly

Thank you, now it takes just a few seconds with the same channel I used before! I consider this performance to be on-par with other implementations.

rkfg avatar Oct 23 '22 12:10 rkfg

Thank you 🙏 More optimizations are planned in the near future.

kingonly avatar Oct 23 '22 13:10 kingonly