Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sds-keyval
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
sds-keyval
Commits
06960eab
Commit
06960eab
authored
Aug 13, 2019
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrected problem in length-multi and added length and length-multi benchmarks
parent
25005577
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
49 deletions
+124
-49
src/benchmark.json
src/benchmark.json
+16
-0
src/sdskv-benchmark.cc
src/sdskv-benchmark.cc
+102
-43
src/sdskv-client.c
src/sdskv-client.c
+6
-6
No files found.
src/benchmark.json
View file @
06960eab
...
...
@@ -42,6 +42,22 @@
"key-sizes"
:
32
,
"val-sizes"
:
[
56
,
64
],
"erase-on-teardown"
:
true
},
{
"type"
:
"length"
,
"repetitions"
:
10
,
"num-entries"
:
30
,
"key-sizes"
:
64
,
"val-sizes"
:
128
,
"erase-on-teardown"
:
true
},
{
"type"
:
"length-multi"
,
"repetitions"
:
10
,
"num-entries"
:
30
,
"key-sizes"
:
32
,
"val-sizes"
:
[
56
,
64
],
"erase-on-teardown"
:
true
}
]
}
src/sdskv-benchmark.cc
View file @
06960eab
...
...
@@ -100,11 +100,8 @@ std::map<std::string, AbstractBenchmark::benchmark_factory_function> AbstractBen
#define REGISTER_BENCHMARK(__name, __class) \
static BenchmarkRegistration<__class> __class##_registration(__name)
/**
* PutBenchmark executes a series of PUT operations and measures their duration.
*/
class
PutBenchmark
:
public
AbstractBenchmark
{
class
AbstractAccessBenchmark
:
public
AbstractBenchmark
{
protected:
uint64_t
m_num_entries
=
0
;
...
...
@@ -112,13 +109,10 @@ class PutBenchmark : public AbstractBenchmark {
std
::
pair
<
size_t
,
size_t
>
m_val_size_range
;
bool
m_erase_on_teardown
;
std
::
vector
<
std
::
string
>
m_keys
;
std
::
vector
<
std
::
string
>
m_vals
;
public:
template
<
typename
...
T
>
Put
Benchmark
(
Json
::
Value
&
config
,
T
&&
...
args
)
AbstractAccess
Benchmark
(
Json
::
Value
&
config
,
T
&&
...
args
)
:
AbstractBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{
// read the configuration
m_num_entries
=
config
[
"num-entries"
].
asUInt64
();
...
...
@@ -146,6 +140,23 @@ class PutBenchmark : public AbstractBenchmark {
}
m_erase_on_teardown
=
config
[
"erase-on-teardown"
].
asBool
();
}
};
/**
* PutBenchmark executes a series of PUT operations and measures their duration.
*/
class
PutBenchmark
:
public
AbstractAccessBenchmark
{
protected:
std
::
vector
<
std
::
string
>
m_keys
;
std
::
vector
<
std
::
string
>
m_vals
;
public:
template
<
typename
...
T
>
PutBenchmark
(
T
&&
...
args
)
:
AbstractAccessBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{
}
virtual
void
setup
()
override
{
// generate key/value pairs and store them in the local
...
...
@@ -206,49 +217,18 @@ REGISTER_BENCHMARK("put-multi", PutMultiBenchmark);
/**
* GetBenchmark executes a series of GET operations and measures their duration.
*/
class
GetBenchmark
:
public
AbstractBenchmark
{
class
GetBenchmark
:
public
Abstract
Access
Benchmark
{
protected:
uint64_t
m_num_entries
=
0
;
std
::
pair
<
size_t
,
size_t
>
m_key_size_range
;
std
::
pair
<
size_t
,
size_t
>
m_val_size_range
;
bool
m_erase_on_teardown
;
std
::
vector
<
std
::
string
>
m_keys
;
std
::
vector
<
std
::
string
>
m_vals
;
public:
template
<
typename
...
T
>
GetBenchmark
(
Json
::
Value
&
config
,
T
&&
...
args
)
:
AbstractBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{
// read the configuration
m_num_entries
=
config
[
"num-entries"
].
asUInt64
();
if
(
config
[
"key-sizes"
].
isIntegral
())
{
auto
x
=
config
[
"key-sizes"
].
asUInt64
();
m_key_size_range
=
{
x
,
x
+
1
};
}
else
if
(
config
[
"key-sizes"
].
isArray
()
&&
config
[
"key-sizes"
].
size
()
==
2
)
{
auto
x
=
config
[
"key-sizes"
][
0
].
asUInt64
();
auto
y
=
config
[
"key-sizes"
][
1
].
asUInt64
();
if
(
x
>
y
)
throw
std
::
range_error
(
"invalid key-sizes range"
);
m_key_size_range
=
{
x
,
y
};
}
else
{
throw
std
::
range_error
(
"invalid key-sizes range or value"
);
}
if
(
config
[
"val-sizes"
].
isIntegral
())
{
auto
x
=
config
[
"val-sizes"
].
asUInt64
();
m_val_size_range
=
{
x
,
x
+
1
};
}
else
if
(
config
[
"val-sizes"
].
isArray
()
&&
config
[
"val-sizes"
].
size
()
==
2
)
{
auto
x
=
config
[
"val-sizes"
][
0
].
asUInt64
();
auto
y
=
config
[
"val-sizes"
][
1
].
asUInt64
();
if
(
x
>=
y
)
throw
std
::
range_error
(
"invalid val-sizes range"
);
m_val_size_range
=
{
x
,
y
};
}
else
{
throw
std
::
range_error
(
"invalid val-sizes range or value"
);
}
m_erase_on_teardown
=
config
[
"erase-on-teardown"
].
asBool
();
}
GetBenchmark
(
T
&&
...
args
)
:
AbstractAccessBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{}
virtual
void
setup
()
override
{
// generate key/value pairs and store them in the local
...
...
@@ -315,6 +295,85 @@ class GetMultiBenchmark : public GetBenchmark {
};
REGISTER_BENCHMARK
(
"get-multi"
,
GetMultiBenchmark
);
/**
* LengthBenchmark executes a series of LENGTH operations and measures their duration.
*/
class
LengthBenchmark
:
public
AbstractAccessBenchmark
{
protected:
std
::
vector
<
std
::
string
>
m_keys
;
std
::
vector
<
std
::
string
>
m_vals
;
public:
template
<
typename
...
T
>
LengthBenchmark
(
T
&&
...
args
)
:
AbstractAccessBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{}
virtual
void
setup
()
override
{
// generate key/value pairs and store them in the local
m_keys
.
reserve
(
m_num_entries
);
m_vals
.
reserve
(
m_num_entries
);
for
(
unsigned
i
=
0
;
i
<
m_num_entries
;
i
++
)
{
size_t
ksize
=
m_key_size_range
.
first
+
(
rand
()
%
(
m_key_size_range
.
second
-
m_key_size_range
.
first
));
m_keys
.
push_back
(
gen_random_string
(
ksize
));
size_t
vsize
=
m_val_size_range
.
first
+
(
rand
()
%
(
m_val_size_range
.
second
-
m_val_size_range
.
first
));
m_vals
.
push_back
(
gen_random_string
(
vsize
));
}
// execute PUT operations (not part of the measure)
auto
&
db
=
remoteDatabase
();
for
(
unsigned
i
=
0
;
i
<
m_num_entries
;
i
++
)
{
auto
&
key
=
m_keys
[
i
];
auto
&
val
=
m_vals
[
i
];
db
.
put
(
key
,
val
);
}
}
virtual
void
execute
()
override
{
// execute LENGTH operations
auto
&
db
=
remoteDatabase
();
for
(
unsigned
i
=
0
;
i
<
m_num_entries
;
i
++
)
{
auto
&
key
=
m_keys
[
i
];
db
.
length
(
key
);
}
}
virtual
void
teardown
()
override
{
if
(
m_erase_on_teardown
)
{
// erase all the keys from the database
auto
&
db
=
remoteDatabase
();
for
(
unsigned
i
=
0
;
i
<
m_num_entries
;
i
++
)
{
db
.
erase
(
m_keys
[
i
]);
}
}
// erase keys and values from the local vectors
m_keys
.
resize
(
0
);
m_vals
.
resize
(
0
);
}
};
REGISTER_BENCHMARK
(
"length"
,
LengthBenchmark
);
/**
* LengthMultiBenchmark inherites from LengthBenchmark and does the same but
* executes a LENGTH-MULTI instead of a LENGTH.
*/
class
LengthMultiBenchmark
:
public
LengthBenchmark
{
public:
template
<
typename
...
T
>
LengthMultiBenchmark
(
T
&&
...
args
)
:
LengthBenchmark
(
std
::
forward
<
T
>
(
args
)...)
{}
virtual
void
execute
()
override
{
auto
&
db
=
remoteDatabase
();
std
::
vector
<
hg_size_t
>
sizes
(
m_num_entries
);
db
.
length
(
m_keys
,
sizes
);
}
};
REGISTER_BENCHMARK
(
"length-multi"
,
LengthMultiBenchmark
);
static
void
run_server
(
MPI_Comm
comm
,
Json
::
Value
&
config
);
static
void
run_client
(
MPI_Comm
comm
,
Json
::
Value
&
config
);
static
sdskv_db_type_t
database_type_from_string
(
const
std
::
string
&
type
);
...
...
src/sdskv-client.c
View file @
06960eab
...
...
@@ -919,17 +919,17 @@ int sdskv_length_multi(sdskv_provider_handle_t provider,
hret
=
margo_bulk_create
(
provider
->
client
->
mid
,
num
+
1
,
key_seg_ptrs
,
key_seg_sizes
,
HG_BULK_READ_ONLY
,
&
in
.
keys_bulk_handle
);
if
(
hret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"[SDSKV] margo_bulk_create() f
ailed in sdskv_get
_multi()
\n
"
);
fprintf
(
stderr
,
"[SDSKV] margo_bulk_create() f
or keys failed in sdskv_length
_multi()
\n
"
);
out
.
ret
=
SDSKV_ERR_MERCURY
;
goto
finish
;
}
/* create the bulk handle for the server to put the values sizes */
hg_size_t
vals_size_bulk_size
=
num
*
sizeof
(
hg_size_t
);
hret
=
margo_bulk_create
(
provider
->
client
->
mid
,
num
,
(
void
**
)
&
vsizes
,
&
vals_size_bulk_size
,
hret
=
margo_bulk_create
(
provider
->
client
->
mid
,
1
,
(
void
**
)
&
vsizes
,
&
vals_size_bulk_size
,
HG_BULK_WRITE_ONLY
,
&
in
.
vals_size_bulk_handle
);
if
(
hret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"[SDSKV] margo_bulk_create() f
ailed in sdskv_get
_multi()
\n
"
);
fprintf
(
stderr
,
"[SDSKV] margo_bulk_create() f
or vsizes failed in sdskv_length
_multi()
\n
"
);
out
.
ret
=
SDSKV_ERR_MERCURY
;
goto
finish
;
}
...
...
@@ -941,7 +941,7 @@ int sdskv_length_multi(sdskv_provider_handle_t provider,
provider
->
client
->
sdskv_length_multi_id
,
&
handle
);
if
(
hret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"[SDSKV] margo_create() failed in sdskv_
get
_multi()
\n
"
);
fprintf
(
stderr
,
"[SDSKV] margo_create() failed in sdskv_
length
_multi()
\n
"
);
out
.
ret
=
SDSKV_ERR_MERCURY
;
goto
finish
;
}
...
...
@@ -949,7 +949,7 @@ int sdskv_length_multi(sdskv_provider_handle_t provider,
/* forward the RPC handle */
hret
=
margo_provider_forward
(
provider
->
provider_id
,
handle
,
&
in
);
if
(
hret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"[SDSKV] margo_forward() failed in sdskv_
get
_multi()
\n
"
);
fprintf
(
stderr
,
"[SDSKV] margo_forward() failed in sdskv_
length
_multi()
\n
"
);
out
.
ret
=
SDSKV_ERR_MERCURY
;
goto
finish
;
}
...
...
@@ -957,7 +957,7 @@ int sdskv_length_multi(sdskv_provider_handle_t provider,
/* get the response */
hret
=
margo_get_output
(
handle
,
&
out
);
if
(
hret
!=
HG_SUCCESS
)
{
fprintf
(
stderr
,
"[SDSKV] margo_get_output() failed in sdskv_
put
_multi()
\n
"
);
fprintf
(
stderr
,
"[SDSKV] margo_get_output() failed in sdskv_
length
_multi()
\n
"
);
out
.
ret
=
SDSKV_ERR_MERCURY
;
goto
finish
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment