Compare commits

...

3 Commits

Author SHA1 Message Date
77949a4be6 cherry pick readme update 2018-09-13 19:19:48 -07:00
af58940964 Fix missing recycle in recv_from (#1205)
In the error case that i>0 (we have blobs to send)
we break out of the loop and do not push the allocated r
to the v array. We should recycle this blob, otherwise it
will be dropped.
2018-09-13 10:27:24 -07:00
21963b8c82 fix "leak" in Blob::recv_from (#1198)
* fix "leak" in Blob::recv_from

fixes #1199
2018-09-13 10:27:24 -07:00
4 changed files with 60 additions and 43 deletions

View File

@ -62,7 +62,7 @@ your odds of success if you check out the
before proceeding: before proceeding:
```bash ```bash
$ git checkout v0.7.2 $ git checkout v0.8.0
``` ```
Configuration Setup Configuration Setup
@ -113,7 +113,7 @@ To run a multinode testnet, after starting a leader node, spin up some validator
separate shells: separate shells:
```bash ```bash
$ ./multinode-demo/validator.sh ubuntu@10.0.1.51:~/solana 10.0.1.51 $ ./multinode-demo/validator.sh
``` ```
To run a performance-enhanced leader or validator (on Linux), To run a performance-enhanced leader or validator (on Linux),
@ -123,22 +123,20 @@ your system:
```bash ```bash
$ ./fetch-perf-libs.sh $ ./fetch-perf-libs.sh
$ SOLANA_CUDA=1 ./multinode-demo/leader.sh $ SOLANA_CUDA=1 ./multinode-demo/leader.sh
$ SOLANA_CUDA=1 ./multinode-demo/validator.sh ubuntu@10.0.1.51:~/solana 10.0.1.51 $ SOLANA_CUDA=1 ./multinode-demo/validator.sh
``` ```
Testnet Client Demo Testnet Client Demo
--- ---
Now that your singlenode or multinode testnet is up and running let's send it some transactions! Note that we pass in Now that your singlenode or multinode testnet is up and running let's send it
the expected number of nodes in the network. If running singlenode, pass 1; if multinode, pass the number some transactions!
of validators you started.
In a separate shell start the client: In a separate shell start the client:
```bash ```bash
$ ./multinode-demo/client.sh ubuntu@10.0.1.51:~/solana 1 $ ./multinode-demo/client.sh # runs against localhost by default
``` ```
What just happened? The client demo spins up several threads to send 500,000 transactions What just happened? The client demo spins up several threads to send 500,000 transactions
@ -155,7 +153,7 @@ Public Testnet
In this example the client connects to our public testnet. To run validators on the testnet you would need to open udp ports `8000-10000`. In this example the client connects to our public testnet. To run validators on the testnet you would need to open udp ports `8000-10000`.
```bash ```bash
$ ./multinode-demo/client.sh testnet.solana.com 1 #The minumum number of nodes to discover on the network $ ./multinode-demo/client.sh --network $(dig +short testnet.solana.com):8001 --identity config-private/client-id.json --duration 60
``` ```
You can observe the effects of your client's transactions on our [dashboard](https://metrics.solana.com:3000/d/testnet/testnet-hud?orgId=2&from=now-30m&to=now&refresh=5s&var-testnet=testnet) You can observe the effects of your client's transactions on our [dashboard](https://metrics.solana.com:3000/d/testnet/testnet-hud?orgId=2&from=now-30m&to=now&refresh=5s&var-testnet=testnet)

View File

@ -18,4 +18,8 @@ usage() {
exit 1 exit 1
} }
$solana_bench_tps "$@" if [[ -z $1 ]]; then # default behavior
$solana_bench_tps --identity config-private/client-id.json --network 127.0.0.1:8001 --duration 90
else
$solana_bench_tps "$@"
fi

View File

@ -34,6 +34,7 @@ ip_address_arg=-l
num_tokens=1000000000 num_tokens=1000000000
node_type_leader=true node_type_leader=true
node_type_validator=true node_type_validator=true
node_type_client=true
while getopts "h?n:lpt:" opt; do while getopts "h?n:lpt:" opt; do
case $opt in case $opt in
h|\?) h|\?)
@ -55,10 +56,17 @@ while getopts "h?n:lpt:" opt; do
leader) leader)
node_type_leader=true node_type_leader=true
node_type_validator=false node_type_validator=false
node_type_client=false
;; ;;
validator) validator)
node_type_leader=false node_type_leader=false
node_type_validator=true node_type_validator=true
node_type_client=false
;;
client)
node_type_leader=false
node_type_validator=false
node_type_client=true
;; ;;
*) *)
usage "Error: unknown node type: $node_type" usage "Error: unknown node type: $node_type"
@ -74,13 +82,19 @@ done
set -e set -e
if $node_type_leader; then for i in "$SOLANA_CONFIG_DIR" "$SOLANA_CONFIG_VALIDATOR_DIR" "$SOLANA_CONFIG_PRIVATE_DIR"; do
for i in "$SOLANA_CONFIG_DIR" "$SOLANA_CONFIG_PRIVATE_DIR"; do echo "Cleaning $i"
echo "Cleaning $i" rm -rvf "$i"
rm -rvf "$i" mkdir -p "$i"
mkdir -p "$i" done
done
if $node_type_client; then
client_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/client-id.json
$solana_keygen -o "$client_id_path"
ls -lhR "$SOLANA_CONFIG_PRIVATE_DIR"/
fi
if $node_type_leader; then
leader_address_args=("$ip_address_arg") leader_address_args=("$ip_address_arg")
leader_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/leader-id.json leader_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/leader-id.json
mint_path="$SOLANA_CONFIG_PRIVATE_DIR"/mint.json mint_path="$SOLANA_CONFIG_PRIVATE_DIR"/mint.json
@ -102,11 +116,6 @@ fi
if $node_type_validator; then if $node_type_validator; then
echo "Cleaning $SOLANA_CONFIG_VALIDATOR_DIR"
rm -rvf "$SOLANA_CONFIG_VALIDATOR_DIR"
mkdir -p "$SOLANA_CONFIG_VALIDATOR_DIR"
validator_address_args=("$ip_address_arg" -b 9000) validator_address_args=("$ip_address_arg" -b 9000)
validator_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/validator-id.json validator_id_path="$SOLANA_CONFIG_PRIVATE_DIR"/validator-id.json

View File

@ -441,6 +441,18 @@ impl Blob {
self.meta.size = new_size; self.meta.size = new_size;
self.set_data_size(new_size as u64).unwrap(); self.set_data_size(new_size as u64).unwrap();
} }
pub fn recv_blob(socket: &UdpSocket, r: &SharedBlob) -> io::Result<()> {
let mut p = r.write().expect("'r' write lock in pub fn recv_from");
trace!("receiving on {}", socket.local_addr().unwrap());
let (nrecv, from) = socket.recv_from(&mut p.data)?;
p.meta.size = nrecv;
p.meta.set_addr(&from);
trace!("got {} bytes from {}", nrecv, from);
Ok(())
}
pub fn recv_from(re: &BlobRecycler, socket: &UdpSocket) -> Result<SharedBlobs> { pub fn recv_from(re: &BlobRecycler, socket: &UdpSocket) -> Result<SharedBlobs> {
let mut v = Vec::new(); let mut v = Vec::new();
//DOCUMENTED SIDE-EFFECT //DOCUMENTED SIDE-EFFECT
@ -452,29 +464,23 @@ impl Blob {
socket.set_nonblocking(false)?; socket.set_nonblocking(false)?;
for i in 0..NUM_BLOBS { for i in 0..NUM_BLOBS {
let r = re.allocate(); let r = re.allocate();
{
let mut p = r.write().expect("'r' write lock in pub fn recv_from"); match Blob::recv_blob(socket, &r) {
trace!("receiving on {}", socket.local_addr().unwrap()); Err(_) if i > 0 => {
match socket.recv_from(&mut p.data) { trace!("got {:?} messages on {}", i, socket.local_addr().unwrap());
Err(_) if i > 0 => { re.recycle(r, "Bob::recv_from::i>0");
trace!("got {:?} messages on {}", i, socket.local_addr().unwrap()); break;
break;
}
Err(e) => {
if e.kind() != io::ErrorKind::WouldBlock {
info!("recv_from err {:?}", e);
}
return Err(Error::IO(e));
}
Ok((nrecv, from)) => {
p.meta.size = nrecv;
p.meta.set_addr(&from);
trace!("got {} bytes from {}", nrecv, from);
if i == 0 {
socket.set_nonblocking(true)?;
}
}
} }
Err(e) => {
if e.kind() != io::ErrorKind::WouldBlock {
info!("recv_from err {:?}", e);
}
re.recycle(r, "Blob::recv_from::empty");
return Err(Error::IO(e));
}
Ok(()) => if i == 0 {
socket.set_nonblocking(true)?;
},
} }
v.push(r); v.push(r);
} }