Conversation
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
a378267 to
172aa9a
Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
I assume the next step will be to parallelize every read operation that we can in the builder?
src/io/utils.rs
Outdated
| NETWORK_GRAPH_PERSISTENCE_SECONDARY_NAMESPACE, | ||
| NETWORK_GRAPH_PERSISTENCE_KEY, | ||
| )?); | ||
| let mut reader = Cursor::new( |
There was a problem hiding this comment.
nit: might be a good chance to drop the Cursor use - &mut &[u8] also implements a read stream so you can just use that, not that its critical.
There was a problem hiding this comment.
Done, across the codebase.
src/io/utils.rs
Outdated
| ) | ||
| .await?; | ||
|
|
||
| const BATCH_SIZE: usize = 20; |
There was a problem hiding this comment.
seems low tbh. maybe 100?
There was a problem hiding this comment.
seems low tbh. maybe 100?
Hmm, but firing off 100 requests in parallel seems also bit much, to the point where it actually hit some rate-limit once we get around to add proper per-user rate-limits to VSS? Now bumped it to 50 in a fixup.
There was a problem hiding this comment.
to the point where it actually hit some rate-limit once we get around to add proper per-user rate-limits to VSS?
Maybe? We should definitely set VSS rate limits to be appropriate for whatever the ldk-node code does :). Generally, IMO, rate-limits shouldn't be (and usually aren't) "max parallel requests" but rather a token bucket over a number of seconds/minutes, so batch size here won't actually impact our rate-limit chance at all.
firing off 100 requests in parallel seems also bit much
I was thinking of it in terms of RTTs to load the Node - if we have 1000 payments (pretty reasonable "high but common" use case?) a batch size of 100 is still 10 round-trips, which is pretty high. Batch size of 50 is 20 round-trips, and we start getting into 2-3 seconds to load, which is unacceptably bad IMO. Now, because there may be rate-limit concerns we can certainly just leave this at 50 and fix it properly later by doing actual batch requests to VSS, but I think we'll still get complaints at 50.
Not quite sure if next-next, but generally yes. Generally the plan is still to move most/all setup logic from For now addressed the feedback, let me know if I can squash the fixup. |
Rather than using `KVStoreSync` we now use the async `KVStore` implementation for most `read_X` util methods used during node building. This is a first step towards making node building/startup entirely async eventually.
4451974 to
7ee4bbb
Compare
TheBlueMatt
left a comment
There was a problem hiding this comment.
Fixups look fine, feel free to squash, I didn't check that no other changes slipped in.
Previously, we would read entries of our payment store sequentially. This is more or less fine when we read from a local store, but when we read from a remote (e.g., VSS) store, all the latency could result in considerable slowdown during startup. Here, we opt to read store entries in batches.
Previously, we consistently handed around `Arc` references for most objects to avoid unnecessary refactoring work. This approach however introduced a bunch of unnecessary allocations through `Arc::clone`. Here we opt to rather use plain references in a bunch of places, reducing the usage of `Arc`s.
d7ed295 to
dec6f22
Compare
Squashed without further changes. |
|
CI is quite sad |
Add integration test that verifies 200 payments are correctly persisted and retrievable via `list_payments` after restarting a node. Co-Authored-By: Claude AI
dec6f22 to
c724a89
Compare
Ah, force-pushed a fix: > git diff-tree -U2 dec6f220 c724a893
diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs
index 8771c51b..4d2a1742 100644
--- a/tests/integration_tests_rust.rs
+++ b/tests/integration_tests_rust.rs
@@ -24,5 +24,6 @@ use common::{
premine_and_distribute_funds, premine_blocks, prepare_rbf, random_config,
random_listening_addresses, setup_bitcoind_and_electrsd, setup_builder, setup_node,
- setup_node_for_async_payments, setup_two_nodes, wait_for_tx, TestChainSource, TestSyncStore,
+ setup_node_for_async_payments, setup_two_nodes, wait_for_tx, TestChainSource, TestStoreType,
+ TestSyncStore,
};
use ldk_node::config::{AsyncPaymentsRole, EsploraSyncConfig};
@@ -2326,5 +2327,6 @@ async fn payment_persistence_after_restart() {
// Setup nodes manually so we can restart node_a with the same config
println!("== Node A ==");
- let config_a = random_config(true);
+ let mut config_a = random_config(true);
+ config_a.store_type = TestStoreType::Sqlite;
let num_payments = 200; |
Previously, we would read entries of our payment store sequentially.
This is more or less fine when we read from a local store, but when we
read from a remote (e.g., VSS) store, all the latency could result in
considerable slowdown during startup. Here, we opt to read store entries
in batches.