Page MenuHomePhabricator

D4581.id14680.diff
No OneTemporary

D4581.id14680.diff

diff --git a/services/commtest/tests/blob/blob_utils.rs b/services/commtest/tests/blob/blob_utils.rs
--- a/services/commtest/tests/blob/blob_utils.rs
+++ b/services/commtest/tests/blob/blob_utils.rs
@@ -5,6 +5,7 @@
pub use proto::blob_service_client::BlobServiceClient;
#[allow(dead_code)]
+#[derive(Clone)]
pub struct BlobData {
pub holder: String,
pub hash: String,
diff --git a/services/commtest/tests/blob_performance_test.rs b/services/commtest/tests/blob_performance_test.rs
--- a/services/commtest/tests/blob_performance_test.rs
+++ b/services/commtest/tests/blob_performance_test.rs
@@ -1,7 +1,65 @@
+#[path = "./blob/blob_utils.rs"]
+mod blob_utils;
+#[path = "./blob/get.rs"]
+mod get;
+#[path = "./blob/put.rs"]
+mod put;
+#[path = "./blob/remove.rs"]
+mod remove;
#[path = "./lib/tools.rs"]
mod tools;
+use bytesize::ByteSize;
+use std::env;
+
+use blob_utils::{BlobData, BlobServiceClient};
+use tokio::runtime::Runtime;
+use tools::Error;
+
#[tokio::test]
-async fn blob_performance_test() {
- assert!(false, "not implemented");
+async fn blob_performance_test() -> Result<(), Error> {
+ let port = env::var("COMM_SERVICES_PORT_BLOB")
+ .expect("port env var expected but not received");
+ let client =
+ BlobServiceClient::connect(format!("http://localhost:{}", port)).await?;
+
+ // change this value to test more simultaneous connections
+ const NUMBER_OF_THREADS: usize = 5;
+
+ let mut blob_data = vec![];
+
+ for i in 0..NUMBER_OF_THREADS {
+ let index: u64 = (i as u64) % 10;
+ blob_data.push(BlobData {
+ holder: format!("test_holder_{}", i),
+ hash: format!("test_hash_{}", i),
+ chunks_sizes: vec![
+ ByteSize::kib(200 + (300 - index * 20)).as_u64() as usize,
+ ByteSize::kib(500 + (400 - index * 20)).as_u64() as usize,
+ ByteSize::kib(700 + (500 - index * 25)).as_u64() as usize,
+ ],
+ })
+ }
+
+ let rt = Runtime::new().unwrap();
+ tokio::task::spawn_blocking(move || {
+ // PUT
+ rt.block_on(async {
+ println!("performing PUT operations");
+ });
+
+ // GET
+ rt.block_on(async {
+ println!("performing GET operations");
+ });
+
+ // REMOVE
+ rt.block_on(async {
+ println!("performing REMOVE operations");
+ });
+ })
+ .await
+ .expect("Task panicked");
+
+ Ok(())
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 8:37 PM (21 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2689001
Default Alt Text
D4581.id14680.diff (2 KB)

Event Timeline