@@ -339,7 +339,7 @@ struct LevelDBConfig {
339339fn s11_rackscale_shmem_leveldb_benchmark ( ) {
340340 // TODO(rackscale): because this test is flaky, always just run smoke test.
341341 // Seen bugs include mutex locking against itself, _lwp_exit returning after a thread has blocked.
342- let is_smoke = cfg ! ( feature = "smoke" ) ;
342+ let is_smoke = true ; // cfg!(feature = "smoke");
343343
344344 let file_name = "rackscale_shmem_leveldb_benchmark.csv" ;
345345 let _ignore = std:: fs:: remove_file ( file_name) ;
@@ -661,12 +661,13 @@ fn rackscale_memcached_benchmark(transport: RackscaleTransport) {
661661}
662662
663663#[ derive( Clone ) ]
664- struct MemcachedShardedConfig < ' a > {
664+ struct MemcachedShardedConfig {
665+ pub num_servers : usize ,
665666 pub num_queries : usize ,
666667 pub mem_size : usize ,
667668 pub protocol : & ' static str ,
668669 pub num_threads : usize ,
669- pub path : & ' a Path ,
670+ pub path : PathBuf ,
670671}
671672
672673#[ derive( Clone , Debug ) ]
@@ -810,20 +811,22 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
810811 // stuff has been built, now we can run the benchmark
811812 let mut config = if is_smoke {
812813 MemcachedShardedConfig {
814+ num_servers : 1 ,
813815 num_queries : 100_000 ,
814816 mem_size : 16 ,
815817 protocol : "tcp" ,
816818 num_threads : 4 ,
817- path : out_dir_path. as_path ( ) ,
819+ path : out_dir_path,
818820 }
819821 } else {
820822 // keep in sync with the s10_memcached_benchmark_internal configuration
821823 MemcachedShardedConfig {
824+ num_servers : 1 ,
822825 num_queries : 100_000_000 ,
823826 mem_size : 128 * 1024 ,
824827 protocol : "tcp" ,
825828 num_threads : 4 ,
826- path : out_dir_path. as_path ( ) ,
829+ path : out_dir_path,
827830 }
828831 } ;
829832
@@ -838,7 +841,7 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
838841 command. arg ( "./build/bin/memcached" ) ;
839842 command. arg ( format ! ( "--x-benchmark-queries={}" , config. num_queries) . as_str ( ) ) ;
840843 command. arg ( format ! ( "--x-benchmark-mem={}" , config. mem_size) . as_str ( ) ) ;
841- command. current_dir ( config. path ) ;
844+ command. current_dir ( config. path . as_path ( ) ) ;
842845 spawn_command ( command, Some ( timeout_ms) ) . expect ( "failed to spawn memcached" )
843846 }
844847
@@ -851,24 +854,24 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
851854 config. mem_size . to_string ( ) . as_str ( ) ,
852855 config. num_threads . to_string ( ) . as_str ( ) ,
853856 ] ) ;
854- command. current_dir ( config. path ) ;
857+ command. current_dir ( config. path . as_path ( ) ) ;
855858 let mut memcached =
856859 spawn_command ( command, Some ( timeout_ms) ) . expect ( "failed to spawn memcached" ) ;
857860 std:: thread:: sleep ( Duration :: from_secs ( 2 ) ) ;
858861 }
859862
860863 fn spawn_loadbalancer (
861- num_servers : usize ,
862- config : & MemcachedShardedConfig ,
864+ config : Option < & MemcachedShardedConfig > ,
863865 timeout_ms : u64 ,
864866 ) -> PtySession {
867+ let config = config. unwrap ( ) ;
865868 let mut command = Command :: new ( "./loadbalancer/loadbalancer" ) ;
866869 command. args ( & [ "--binary" ] ) ;
867870 command. arg ( format ! ( "--num-queries={}" , config. num_queries) . as_str ( ) ) ;
868871 command. arg ( format ! ( "--num-threads={}" , config. num_threads) . as_str ( ) ) ;
869872 command. arg ( format ! ( "--max-memory={}" , config. mem_size) . as_str ( ) ) ;
870873 let mut servers = String :: from ( "--servers=" ) ;
871- for i in 0 ..num_servers {
874+ for i in 0 ..config . num_servers {
872875 if i > 0 {
873876 servers. push_str ( "," ) ;
874877 }
@@ -879,7 +882,7 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
879882 }
880883 }
881884 command. arg ( servers. as_str ( ) ) ;
882- command. current_dir ( config. path ) ;
885+ command. current_dir ( config. path . as_path ( ) ) ;
883886
884887 spawn_command ( command, Some ( timeout_ms) ) . expect ( "failed to spawn load balancer" )
885888 }
@@ -901,6 +904,8 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
901904 for num_nodes in 1 ..=machine. max_numa_nodes ( ) {
902905 let threads_per_node = max_threads_per_node / num_nodes;
903906
907+ config. num_servers = num_nodes;
908+
904909 for num_threads in 1 ..=threads_per_node {
905910 config. num_threads = num_threads;
906911
@@ -929,7 +934,7 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
929934 spawn_memcached ( i. to_string ( ) . as_str ( ) , & config, timeout_ms) ;
930935 }
931936
932- let mut pty = spawn_loadbalancer ( num_nodes , & config, timeout_ms) ;
937+ let mut pty = spawn_loadbalancer ( Some ( & config) , timeout_ms) ;
933938 let mut output = String :: new ( ) ;
934939 let res = parse_memcached_output ( & mut pty, & mut output) ;
935940
@@ -949,6 +954,70 @@ fn rackscale_memcached_benchmark_sharded(is_shmem: bool) {
949954
950955 // terminate the memcached instance
951956 Command :: new ( "killall" ) . args ( & [ "memcached" ] ) . status ( ) ;
957+
958+ // run with NrOS as host
959+ let built = BuildArgs :: default ( )
960+ . module ( "rkapps" )
961+ . user_feature ( "rkapps:memcached-bench" )
962+ . kernel_feature ( "pages-4k" )
963+ . release ( )
964+ . build ( ) ;
965+
966+ fn controller_match_fn (
967+ proc : & mut PtySession ,
968+ output : & mut String ,
969+ _cores_per_client : usize ,
970+ num_clients : usize ,
971+ file_name : & str ,
972+ is_baseline : bool ,
973+ arg : Option < MemcachedShardedConfig > ,
974+ ) -> Result < ( ) > {
975+ // here we should wait
976+ Ok ( ( ) )
977+ }
978+
979+ let mut test = RackscaleRun :: new ( "userspace-smp" . to_string ( ) , built) ;
980+ test. controller_match_fn = controller_match_fn;
981+ test. use_qemu_huge_pages = cfg ! ( feature = "affinity-shmem" ) ;
982+ test. file_name = file_name. to_string ( ) ;
983+ test. arg = Some ( config) ;
984+ test. run_dhcpd_for_baseline = true ;
985+ test. is_multi_node = true ;
986+
987+ fn cmd_fn ( num_cores : usize , arg : Option < MemcachedShardedConfig > ) -> String {
988+ let config = arg. expect ( "missing configuration" ) ;
989+ format ! (
990+ r#"init=memcachedbench.bin initargs={} appcmd='--x-benchmark-no-run --disable-evictions --threads={} --x-benchmark-mem={} --memory-limit={} "# ,
991+ num_cores, num_cores, config. mem_size, config. mem_size
992+ )
993+ }
994+
995+ fn baseline_timeout_fn ( num_cores : usize ) -> u64 {
996+ 120_000 + 500 * num_cores as u64
997+ }
998+
999+ fn rackscale_timeout_fn ( num_cores : usize ) -> u64 {
1000+ 180_000 + 1_500 * num_cores as u64
1001+ }
1002+
1003+ fn mem_fn ( num_cores : usize , is_smoke : bool ) -> usize {
1004+ if is_smoke {
1005+ 8192
1006+ } else {
1007+ // Memory must also be divisible by number of nodes, which could be 1, 2, 3, or 4
1008+ 256 * 1024 //2048 * (((((num_cores + 1) / 2) + 3 - 1) / 3) * 3)
1009+ }
1010+ }
1011+
1012+ // construct bench and run it!
1013+ let bench = RackscaleBench {
1014+ test,
1015+ cmd_fn,
1016+ baseline_timeout_fn,
1017+ rackscale_timeout_fn,
1018+ mem_fn,
1019+ } ;
1020+ bench. run_bench ( false , is_smoke) ;
9521021}
9531022
9541023#[ test]
@@ -963,7 +1032,7 @@ fn rackscale_monetdb_benchmark(transport: RackscaleTransport) {
9631032
9641033 // TODO(rackscale): because this test is flaky, always just run smoke test.
9651034 // Seen bugs include mutex locking against itself, _lwp_exit returning after a thread has blocked.
966- let is_smoke = cfg ! ( feature = "smoke" ) ;
1035+ let is_smoke = true ; // cfg!(feature = "smoke");
9671036
9681037 let file_name = format ! ( "rackscale_{}_monetdb_benchmark.csv" , transport. to_string( ) , ) ;
9691038 let _ignore = std:: fs:: remove_file ( file_name. clone ( ) ) ;
0 commit comments