5 #define NUM_APP_ARGS (1) 9 std::cerr <<
"Usage: " << argv[0] <<
" [ derecho-config-list -- ] <aio|bio>" << std::endl;
16 }
else if(strcmp(
"bio", argv[argc -
NUM_APP_ARGS]) != 0) {
17 std::cerr <<
"unrecognized argument:" << argv[argc -
NUM_APP_ARGS] <<
". Using bio (blocking io) instead." << std::endl;
20 struct timespec t_start, t_end;
22 std::cout <<
"Starting object store service..." << std::endl;
29 std::cout <<
"Object store service started. Is replica:" << std::boolalpha << oss.
isReplica()
30 << std::noboolalpha <<
"." << std::endl;
32 int runtime = 60 * 1000;
35 int msg_size = max_msg_size - 128;
36 if(msg_size > 2000000) {
41 for(
int i = 0; i < msg_size; i++) {
42 odata[i] =
'1' + (rand() % 74);
45 std::vector<objectstore::Object> objpool;
46 for(
int i = 0; i < num_msg; i++) {
51 clock_gettime(CLOCK_REALTIME, &t_start);
53 for(
int i = 0; i < num_msg; i++) {
54 oss.aio_put(objpool[i]);
57 for(
int i = 0; i < num_msg; i++) {
58 oss.bio_put(objpool[i]);
61 oss.bio_get(num_msg - 1);
62 clock_gettime(CLOCK_REALTIME, &t_end);
64 long long int nsec = (t_end.tv_sec - t_start.tv_sec) * 1000000000 + (t_end.tv_nsec - t_start.tv_nsec);
65 double msec = (double)nsec / 1000000;
69 multiplier = ceil(runtime / msec);
72 clock_gettime(CLOCK_REALTIME, &t_start);
74 for(
int i = 0; i < num_msg * multiplier; i++) {
75 oss.aio_put(objpool[i % num_msg]);
78 for(
int i = 0; i < num_msg * multiplier; i++) {
79 oss.bio_put(objpool[i % num_msg]);
82 oss.bio_get(num_msg - 1);
83 clock_gettime(CLOCK_REALTIME, &t_end);
85 nsec = (t_end.tv_sec - t_start.tv_sec) * 1000000000 + (t_end.tv_nsec - t_start.tv_nsec);
86 msec = (double)nsec / 1000000;
88 double thp_mBps = ((double)max_msg_size * num_msg * multiplier * 1000) / nsec;
89 double thp_ops = ((double)num_msg * multiplier * 1000000000) / nsec;
90 std::cout <<
"timespan:" << msec <<
" millisecond." << std::endl;
91 std::cout <<
"throughput:" << thp_mBps <<
"MB/s." << std::endl;
92 std::cout <<
"throughput:" << thp_ops <<
"op/s." << std::endl;
93 std::cout << std::flush;
#define CONF_SUBGROUP_DEFAULT_MAX_PAYLOAD_SIZE
static IObjectStoreService & getObjectStoreService(int argc, char **argv, const ObjectWatcher &ow={})
virtual const bool isReplica()=0
static void initialize(int argc, char *argv[], const char *conf_file=nullptr)
const uint64_t getConfUInt64(const std::string &key)