Add `ran_string()` to `tdb-bench`

Also, dependencies were upgraded across all crates and the version for
`tdb-macros` was streamlined to 0.5.0 like the other crates.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
next
Sayan Nandan 4 years ago
parent d3387b68d0
commit 4722e01d23
No known key found for this signature in database
GPG Key ID: C31EFD7DDA12AEE0

84
Cargo.lock generated

@ -245,17 +245,6 @@ dependencies = [
"slab",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.1"
@ -264,7 +253,7 @@ checksum = "4060f4657be78b8e766215b02b18a2e862d83745545de804638e2b545e81aee6"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"wasi",
]
[[package]]
@ -568,37 +557,14 @@ dependencies = [
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc 0.2.0",
]
[[package]]
name = "rand"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34"
checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e"
dependencies = [
"libc",
"rand_chacha 0.3.0",
"rand_core 0.6.1",
"rand_hc 0.3.0",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[package]]
@ -608,16 +574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [
"ppv-lite86",
"rand_core 0.6.1",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
"rand_core",
]
[[package]]
@ -626,16 +583,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"
dependencies = [
"getrandom 0.2.1",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
"getrandom",
]
[[package]]
@ -644,7 +592,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [
"rand_core 0.6.1",
"rand_core",
]
[[package]]
@ -796,18 +744,18 @@ dependencies = [
"clap",
"devtimer",
"libtdb",
"rand 0.7.3",
"rand",
"serde",
"serde_json",
]
[[package]]
name = "tdb_macros"
version = "0.2.2"
version = "0.5.0"
dependencies = [
"proc-macro2",
"quote",
"rand 0.8.1",
"rand",
"syn",
]
@ -845,7 +793,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"wasi",
"winapi",
]
@ -939,12 +887,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"

@ -26,7 +26,7 @@ use libtdb::terrapipe::ADDR;
use protocol::{Con, Connection, SslConnection};
use std::io::{self, prelude::*};
use std::process;
const MSG_WELCOME: &'static str = "TerrabaseDB v0.5.0";
const MSG_WELCOME: &'static str = "TerrabaseDB v0.5.1";
/// This creates a REPL on the command line and also parses command-line arguments
///

@ -20,7 +20,7 @@
#
name: TerrabaseDB Shell
version: 0.5.0
version: 0.5.1
author: Sayan N. <ohsayan@outlook.com>
about: The TerrabaseDB Shell (tsh)
args:

@ -12,7 +12,7 @@ port = 2003 # The port to which you want TDB to bind to
# Set `noart` to true if you want to disable terminal artwork
noart = false
# This key is *OPTIONAL*, but will be required post 0.5.0
# This key is *OPTIONAL*, but will be required post 0.5.1
[bgsave]
# Run `BGSAVE` `every` seconds. For example, setting this to 60 will cause BGSAVE to run
# after every 2 minutes

@ -1,5 +1,5 @@
name: TerrabaseDB Server
version: 0.5.0
version: 0.5.1
author: Sayan N. <ohsayan@outlook.com>
about: The TerrabaseDB Database server
args:

@ -44,7 +44,7 @@ pub struct Config {
/// The `server` key
server: ConfigKeyServer,
/// The `bgsave` key
/* TODO(@ohsayan): As of now, we will keep this optional, but post 0.5.0,
/* TODO(@ohsayan): As of now, we will keep this optional, but post 0.5.1,
* we will make it compulsory (so that we don't break semver)
* See the link below for more details:
* https://github.com/terrabasedb/terrabasedb/issues/21#issuecomment-693217709

@ -54,7 +54,7 @@ use jemallocator::Jemalloc;
static GLOBAL: Jemalloc = Jemalloc;
/// The version text
static MSG: &'static str = "TerrabaseDB v0.5.0 | https://github.com/terrabasedb/terrabasedb";
static MSG: &'static str = "TerrabaseDB v0.5.1 | https://github.com/terrabasedb/terrabasedb";
/// The terminal art for `!noart` configurations
static TEXT: &'static str = "
_______ _ _____ ____

@ -7,9 +7,9 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.7.3"
devtimer = "4.0.0"
rand = "0.8.2"
devtimer = "4.0.1"
libtdb = {path="../libtdb"}
clap = {version = "2.33.3", features=["yaml"]}
serde = {version="1.0.118", features=["derive"]}
serde_json = "1.0.60"
serde = {version="1.0.119", features=["derive"]}
serde_json = "1.0.61"

@ -20,7 +20,7 @@
#
name: TerrabaseDB Benchmark Tool
version: 0.5.0
version: 0.5.1
author: Sayan N. <ohsayan@outlook.com>
about: |
The TerrabaseDB benchmark tool can be used to benchmark TerrabaseDB installations.

@ -28,7 +28,7 @@ mod benchtool {
use devtimer::DevTime;
use libtdb::terrapipe;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::thread_rng;
use serde::Serialize;
use std::io::prelude::*;
use std::net::{self, TcpStream};
@ -167,7 +167,7 @@ mod benchtool {
},
None => host.push_str("2003"),
}
let rand = thread_rng();
let mut rand = thread_rng();
if let Some(matches) = matches.subcommand_matches("testkey") {
let numkeys = matches.value_of("count").unwrap();
if let Ok(num) = numkeys.parse::<usize>() {
@ -175,17 +175,11 @@ mod benchtool {
println!("Generating keys ...");
let keys: Vec<String> = (0..num)
.into_iter()
.map(|_| {
let rand_string: String = rand.sample_iter(&Alphanumeric).take(8).collect();
rand_string
})
.map(|_| ran_string(8, &mut rand))
.collect();
let values: Vec<String> = (0..num)
.into_iter()
.map(|_| {
let rand_string: String = rand.sample_iter(&Alphanumeric).take(8).collect();
rand_string
})
.map(|_| ran_string(8, &mut rand))
.collect();
let set_packs: Vec<Vec<u8>> = (0..num)
.map(|idx| terrapipe::proc_query(format!("SET {} {}", keys[idx], values[idx])))
@ -225,26 +219,18 @@ mod benchtool {
max_queries,
(packet_size * 2), // key size + value size
);
let rand = thread_rng();
let mut rand = thread_rng();
let mut dt = DevTime::new_complex();
// Create separate connection pools for get and set operations
let mut setpool = Netpool::new(max_connections, &host);
let mut getpool = Netpool::new(max_connections, &host);
let keys: Vec<String> = (0..max_queries)
.into_iter()
.map(|_| {
let rand_string: String =
rand.sample_iter(&Alphanumeric).take(packet_size).collect();
rand_string
})
.map(|_| ran_string(packet_size, &mut rand))
.collect();
let values: Vec<String> = (0..max_queries)
.into_iter()
.map(|_| {
let rand_string: String =
rand.sample_iter(&Alphanumeric).take(packet_size).collect();
rand_string
})
.map(|_| ran_string(packet_size, &mut rand))
.collect();
/*
We create three vectors of vectors: `set_packs`, `get_packs` and `del_packs`
@ -309,6 +295,15 @@ mod benchtool {
fn calc(reqs: usize, time: u128) -> f64 {
reqs as f64 / (time as f64 / 1_000_000_000 as f64)
}
fn ran_string(len: usize, rand: impl rand::Rng) -> String {
let rand_string: String = rand
.sample_iter(&Alphanumeric)
.take(len)
.map(char::from)
.collect();
rand_string
}
}
fn main() {

@ -1,6 +1,6 @@
[package]
name = "tdb_macros"
version = "0.2.2"
version = "0.5.0"
authors = ["Sayan Nandan <ohsayan@outlook.com>"]
edition = "2018"
@ -12,5 +12,5 @@ proc-macro = true
[dependencies]
syn = {version = "1.0.58", features = ["full"]}
quote = "1.0.8"
rand = "0.8.1"
rand = "0.8.2"
proc-macro2 = "1.0.24"

Loading…
Cancel
Save