Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[server + bench] Now start the batch maker, and integrate into bench #1154

Merged
merged 3 commits into from
Mar 31, 2022

Conversation

gdanezis
Copy link
Collaborator

This PR does three things:

  1. Starts the batch maker task when the server starts. This necessitated a little bit of reworking of function params in authority_server to pass around Arcs, but nothing drastic.
  2. Adapts the micro benchmark to listen to update items from the authority, to ensure these facilities do not lead to performance regressions, and also return results correctly.
  3. Provides a client facility to get update items as a stream rather than a channel, to avoid launching a separate task.

@gdanezis gdanezis requested a review from lavindir March 30, 2022 14:13
_tx_digest,
)))) => {
start = _tx_seq + 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have run this locally and confirmed that it is functioning as a stream now. 👍

We are only generating transaction load and not batch load so far, is that right or are we making batches somewhere, as alluded to in the title?

Copy link
Collaborator Author

@gdanezis gdanezis Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see batches when I increase the number of transactions in the microbench. See Client received batch up to sequence ...:

george@george-XPS-13-9310:~/Projects/fastnft$ cargo run --release --bin=microbench -- --num-transactions 1000000 --batch-size 100 --use-move   Compiling sui_core v0.1.0 (/home/george/Projects/fastnft/sui_core)
   Compiling sui v0.1.0 (/home/george/Projects/fastnft/sui)
    Finished release [optimized] target(s) in 40.83s
     Running `target/release/microbench --num-transactions 1000000 --batch-size 100 --use-move`
2022-03-31T09:19:01.534738Z  INFO microbench: Starting benchmark: TransactionsAndCerts
2022-03-31T09:19:01.534796Z  INFO microbench: Preparing accounts.
2022-03-31T09:19:01.535815Z  INFO microbench: Init Authority.
2022-03-31T09:19:01.535996Z  INFO microbench: Open database on path: "/tmp/DB_19AA4FBA3E838077C1929FF3FB6B53E7FF7CFBD7"
2022-03-31T09:19:01.763730Z  INFO microbench: Generate empty store with Genesis.
2022-03-31T09:19:07.675950Z  INFO microbench: Preparing transactions.
2022-03-31T09:19:10.508837Z  INFO sui_network::transport: Listening to TCP traffic on 127.0.0.1:9555
2022-03-31T09:19:10.508919Z  INFO microbench: Sending requests.
2022-03-31T09:19:10.508942Z  INFO microbench: Number of TCP connections: 8
2022-03-31T09:19:10.509096Z  INFO microbench: Start batch listener at sequence: 0.
2022-03-31T09:19:10.509153Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.509392Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.509425Z  INFO microbench: Client received batch up to sequence 0
2022-03-31T09:19:10.509668Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.509902Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.510135Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.510453Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.510718Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:10.510995Z  INFO sui_network::network: Sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:14.988668Z  INFO microbench: Client received batch up to sequence 1000
2022-03-31T09:19:15.958129Z  INFO sui_core::authority_server: 127.0.0.1:9555 has processed 5000 packets
2022-03-31T09:19:19.672465Z  INFO microbench: Client received batch up to sequence 2000
2022-03-31T09:19:21.763921Z  INFO sui_core::authority_server: 127.0.0.1:9555 has processed 10000 packets
2022-03-31T09:19:24.736939Z  INFO microbench: Client received batch up to sequence 3000
2022-03-31T09:19:27.950491Z  INFO sui_core::authority_server: 127.0.0.1:9555 has processed 15000 packets
2022-03-31T09:19:30.056884Z  INFO microbench: Client received batch up to sequence 4000
2022-03-31T09:19:34.156146Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:34.158119Z  INFO microbench: Client received batch up to sequence 5000
2022-03-31T09:19:34.160644Z  INFO microbench: Client received batch up to sequence 6000
2022-03-31T09:19:34.163405Z  INFO microbench: Client received batch up to sequence 7000
2022-03-31T09:19:34.164014Z  INFO microbench: Client received batch up to sequence 8000
2022-03-31T09:19:34.166854Z  INFO microbench: Client received batch up to sequence 9000
2022-03-31T09:19:34.369739Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:34.848897Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:34.923066Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:34.949682Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:34.988530Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:35.006763Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:35.046621Z  INFO sui_core::authority_server: 127.0.0.1:9555 has processed 20000 packets
2022-03-31T09:19:35.046776Z  INFO sui_network::network: Done sending TCP requests to 127.0.0.1:9555
2022-03-31T09:19:35.046929Z  INFO microbench: Received 20000 responses.
2022-03-31T09:19:35.047350Z  INFO microbench: Start batch listener at sequence: 10000.
2022-03-31T09:19:35.047553Z  INFO microbench: Client received batch up to sequence 10000
2022-03-31T09:19:37.330513Z  WARN microbench: Completed benchmark for TransactionsAndCerts
Total time: 24537974us, items: 1000000, tx/sec: 40753.16079477466

Maybe what makes the difference is --num-transactions 1000000 --batch-size 100. The default values are too low number of transactions, and too high level of batching them to observe a follower batch.

.await?;

let mut error_count = 0;
let TcpDataStream { framed_read, .. } = tcp_stream;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never seen this syntax before, this is useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah if you own something outright (not just & or &mut), you can break it up subject to some visibility constraints I think.

};
futures::future::ready(flag)
});
Ok(stream)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh. This is how we would do this functionally. I see the map function allows us to turn a "stream" into an iterator, and this is possible because the framed_read part of the tcpDataStream is iterable. I attempted to iterate on the entire stream and that doesn't work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the read part is a stream, and the write part is a sink. They offer interesting combinators to build more fancy streams and sinks.

@gdanezis gdanezis merged commit 0b58459 into main Mar 31, 2022
@gdanezis gdanezis deleted the start-batch-server branch March 31, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants