Open yaslama opened 1 year ago
We briefly discussed this in chat yesterday, and I think the vast majority is due to network latencies. The nodes in prod
are currently located in SF (GCP region us-west2), while the client/signer is in Israel, and the LSP node is in Paris.
This results in average RTTs of:
I'm assuming that you tested with a stock CLN node running in the same rough region as the signer or the LSP, so we can drop those to ~5ms for one direction, and ~50ms for the other latency.
Now, in the best case scenario a payment consists of 3 RTT over the LSP <-> node link
update_add_htlc
+ commitment_signed
revoke_and_ack
+ commitment_signed
revoke_and_ack
update_fulfill_htlc
+ commitment_signed
revoke_and_ack
+ commmitment_signed
revoke_and_ack
Each of the commitment_signed
sent, and revoke_and_ack
sent and received then triggers also a request to the signer to sign off on the state changes (hsmd_validate_commitment_tx
, hsmd_validate_revocation
).
3 * 160ms + 6 * 200ms = 480ms + 1200ms = 1680
There may be a bit more overhead due to the verification, which the stock CLN signer doesn't have to perform, but the network latencies are likely the far bigger contributor.
While we will always be slower than a local CLN signer that doesn't have to adhere to speed of light concerns, we have a number of improvements that we plan to add eventually:
eu-west6
and us-west2
, but we'd still have some overhead of getting from user to the proxy, so that'd be a lower bound anyway.Currently, sending payments takes 15-50s even for partners in the EU. A few months ago I was able to pay in 7s, but that's no longer the case. Weirdly, even w/o waiting for sync, initial payments take much longer than subsequent payments.
How do we deal with payment latency?
Paying from/to GL and comparing the time until the payment is settled to a payment with the same path except using a regular CLN node instead of GL node. The payment using GL is more than 2 seconds slower than the payment using CLN.