Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
346256f9
Commit
346256f9
authored
Aug 07, 2013
by
antirez
Browse files
redis-benchmark: max pipeline length hardcoded limit removed.
parent
6cbfdd95
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-benchmark.c
View file @
346256f9
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
#include "zmalloc.h"
#include "zmalloc.h"
#define REDIS_NOTUSED(V) ((void) V)
#define REDIS_NOTUSED(V) ((void) V)
#define RANDPTR_INITIAL_SIZE 8
static
struct
config
{
static
struct
config
{
aeEventLoop
*
el
;
aeEventLoop
*
el
;
...
@@ -81,12 +82,13 @@ static struct config {
...
@@ -81,12 +82,13 @@ static struct config {
typedef
struct
_client
{
typedef
struct
_client
{
redisContext
*
context
;
redisContext
*
context
;
sds
obuf
;
sds
obuf
;
char
*
randptr
[
32
];
/* needed for MSET against 10 keys */
char
**
randptr
;
/* Pointers to :rand: strings inside the command buf */
size_t
randlen
;
size_t
randlen
;
/* Number of pointers in client->randptr */
unsigned
int
written
;
/* bytes of 'obuf' already written */
size_t
randfree
;
/* Number of unused pointers in client->randptr */
long
long
start
;
/* start time of a request */
unsigned
int
written
;
/* Bytes of 'obuf' already written */
long
long
latency
;
/* request latency */
long
long
start
;
/* Start time of a request */
int
pending
;
/* Number of pending requests (sent but no reply received) */
long
long
latency
;
/* Request latency */
int
pending
;
/* Number of pending requests (replies to consume) */
int
selectlen
;
/* If non-zero, a SELECT of 'selectlen' bytes is currently
int
selectlen
;
/* If non-zero, a SELECT of 'selectlen' bytes is currently
used as a prefix of the pipline of commands. This gets
used as a prefix of the pipline of commands. This gets
discarded the first time it's sent. */
discarded the first time it's sent. */
...
@@ -306,6 +308,8 @@ static client createClient(char *cmd, size_t len) {
...
@@ -306,6 +308,8 @@ static client createClient(char *cmd, size_t len) {
for
(
j
=
0
;
j
<
config
.
pipeline
;
j
++
)
for
(
j
=
0
;
j
<
config
.
pipeline
;
j
++
)
c
->
obuf
=
sdscatlen
(
c
->
obuf
,
cmd
,
len
);
c
->
obuf
=
sdscatlen
(
c
->
obuf
,
cmd
,
len
);
c
->
randlen
=
0
;
c
->
randlen
=
0
;
c
->
randfree
=
RANDPTR_INITIAL_SIZE
;
c
->
randptr
=
zmalloc
(
sizeof
(
char
*
)
*
c
->
randfree
);
c
->
written
=
0
;
c
->
written
=
0
;
c
->
pending
=
config
.
pipeline
;
c
->
pending
=
config
.
pipeline
;
if
(
c
->
selectlen
)
c
->
pending
++
;
if
(
c
->
selectlen
)
c
->
pending
++
;
...
@@ -314,8 +318,12 @@ static client createClient(char *cmd, size_t len) {
...
@@ -314,8 +318,12 @@ static client createClient(char *cmd, size_t len) {
if
(
config
.
randomkeys
)
{
if
(
config
.
randomkeys
)
{
char
*
p
=
c
->
obuf
;
char
*
p
=
c
->
obuf
;
while
((
p
=
strstr
(
p
,
":rand:"
))
!=
NULL
)
{
while
((
p
=
strstr
(
p
,
":rand:"
))
!=
NULL
)
{
assert
(
c
->
randlen
<
(
signed
)(
sizeof
(
c
->
randptr
)
/
sizeof
(
char
*
)));
if
(
c
->
randfree
==
0
)
{
c
->
randptr
=
zrealloc
(
c
->
randptr
,
sizeof
(
char
*
)
*
c
->
randlen
*
2
);
c
->
randfree
+=
c
->
randlen
;
}
c
->
randptr
[
c
->
randlen
++
]
=
p
+
6
;
c
->
randptr
[
c
->
randlen
++
]
=
p
+
6
;
c
->
randfree
--
;
p
+=
6
;
p
+=
6
;
}
}
}
}
...
...
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