Skip to content

Commit d0ca710

Browse files
committed
[fix] fixing kn.py script. improving readability of our use cases
1 parent aab620a commit d0ca710

File tree

4 files changed

+34
-27
lines changed

4 files changed

+34
-27
lines changed

benchmark/redisgraph/README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ sudo pip install --upgrade pip
2727
## Current use cases
2828
This article documents the details on how to reproduce the graph database benchmark result on RedisGraph.
2929
Currently, RedisGraph benchmark supports two use cases:
30-
- graph500
31-
- twitter
32-
30+
31+
32+
Name | Description and Source | Vertices | Edges
33+
-- | -- | -- | --
34+
graph500 | Synthetic Kronecker graphhttp://graph500.org | 2.4 M | 64 M
35+
twitter | Twitter user-follower directed graphhttp://an.kaist.ac.kr/traces/WWW2010.html | 41.6 M | 1.47 B
3336

3437
### How to use the benchmark
3538

@@ -95,26 +98,26 @@ Results will be stored in "result_redisgraph" output directory.
9598
##### Graph500
9699

97100
```bash
98-
# 300 seeds, depth 1
99-
nohup python kn.py -g graph500 -s graph500_22_seed -c 300 -d 6 -p redisgraph -l graph500_22_unique_node -t 22 -i 1
100-
# 300 seeds, depth 2
101-
nohup python kn.py -g graph500 -s graph500_22_seed -c 300 -d 6 -p redisgraph -l graph500_22_unique_node -t 22 -i 2
102-
# 10 seeds, depth 3
101+
# 300 seeds, depth 1, 3 iterations per query
102+
nohup python kn.py -g graph500 -s graph500_22_seed -c 300 -d 1 -p redisgraph -l graph500_22_unique_node -t 22 -i 3
103+
# 300 seeds, depth 2, 3 iterations per query
104+
nohup python kn.py -g graph500 -s graph500_22_seed -c 300 -d 2 -p redisgraph -l graph500_22_unique_node -t 22 -i 3
105+
# 10 seeds, depth 3, 3 iterations per query
106+
nohup python kn.py -g graph500 -s graph500_22_seed -c 10 -d 3 -p redisgraph -l graph500_22_unique_node -t 22 -i 3
107+
# 10 seeds, depth 6, 3 iterations per query
103108
nohup python kn.py -g graph500 -s graph500_22_seed -c 10 -d 6 -p redisgraph -l graph500_22_unique_node -t 22 -i 3
104-
# 10 seeds, depth 6
105-
nohup python kn.py -g graph500 -s graph500_22_seed -c 10 -d 6 -p redisgraph -l graph500_22_unique_node -t 22 -i 6
106109
```
107110

108111

109112
##### Twitter Benchmark
110113

111114
```bash
112-
# 300 seeds, depth 1
113-
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 300 -d 6 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 1
114-
# 300 seeds, depth 2
115-
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 300 -d 6 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 2
116-
# 10 seeds, depth 3
115+
# 300 seeds, depth 1, 3 iterations per query
116+
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 300 -d 1 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 3
117+
# 300 seeds, depth 2, 3 iterations per query
118+
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 300 -d 2 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 3
119+
# 10 seeds, depth 3, 3 iterations per query
120+
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 10 -d 3 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 3
121+
# 10 seeds, depth 6, 3 iterations per query
117122
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 10 -d 6 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 3
118-
# 10 seeds, depth 6
119-
nohup python kn.py -g twitter_rv -s twitter_rv_net_seed -c 10 -d 6 -p redisgraph -l twitter_rv_net_unique_node -t 22 -i 6
120123
```

benchmark/redisgraph/graph_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131

3232
# Attempt to verify that RedisGraph module is loaded
3333
try:
34-
module_list = client.execute_command("GRAPH.QUERY {} {}".format(args.name, args.query))
34+
module_list = client.execute_command("GRAPH.QUERY {} \"{}\"".format(args.name, args.query))
3535
except redis.exceptions.ResponseError as e:
3636
raise e

benchmark/redisgraph/kn.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def GetSeeds(seed_file_path, count):
104104
# function: thread worker, pull work item from pool
105105
# and execute query via runner
106106
################################################################
107-
def RunKNLatencyThread(graphid, threadId, depth, provider, label, seedPool, reportQueue, iterations):
107+
def RunKNLatencyThread(graphid, threadId, depth, provider, label, seedPool, reportQueue, iterations, url):
108108
if provider == "redisgraph":
109-
runner = RedisGraphQueryRunner(graphid, label)
109+
runner = RedisGraphQueryRunner(graphid, label, url)
110110
elif provider == "tigergraph":
111111
runner = TigerGraphQueryRunner()
112112
else:
@@ -151,19 +151,22 @@ def RunKNLatencyThread(graphid, threadId, depth, provider, label, seedPool, repo
151151
# query for a given set of seeds.
152152
################################################################
153153
@click.command()
154-
@click.option('--graphid', '-g', default='graph500-22',
155-
type=click.Choice(['graph500-22', 'twitter_rv_net']), help="graph id")
154+
@click.option('--graphid', '-g', default='graph500_22',
155+
type=click.Choice(['graph500_22', 'twitter_rv_net']), help="graph id")
156156
@click.option('--count', '-c', default=20, help="number of seeds")
157157
@click.option('--depth', '-d', default=1, help="number of hops to perform")
158158
@click.option('--provider', '-p', default='redisgraph', help="graph identifier")
159+
@click.option('--url', '-u', default='127.0.0.1:6379', help="DB url")
159160
@click.option('--label', '-l', default='label', help="node label")
161+
# @click.option('--seed', '-s', default='seed', help="seed file")
160162
@click.option('--threads', '-t', default=2, help="number of querying threads")
161163
@click.option('--iterations', '-i', default=10, help="number of iterations per query")
162-
def RunKNLatency(graphid, count, depth, provider, label, threads, iterations):
164+
def RunKNLatency(graphid, count, depth, provider, label, threads, iterations,url):
163165
# create result folder
164166
global seedReports
165-
seedfile = os.path.join('data', graphid + '-seed')
167+
seedfile = os.path.join('data', graphid + '_seed')
166168
seeds = GetSeeds(seedfile, count)
169+
print "## Seeds len {}".format(len(seeds))
167170

168171
# Create a pool of seeds.
169172
seedPool = multiprocessing.Queue(len(seeds) * iterations)
@@ -181,7 +184,7 @@ def RunKNLatency(graphid, count, depth, provider, label, threads, iterations):
181184
threadsProc = []
182185
for tid in range(threads):
183186
p = multiprocessing.Process(target=RunKNLatencyThread,
184-
args=(graphid, tid, depth, provider, label, seedPool, reportQueue, iterations))
187+
args=(graphid, tid, depth, provider, label, seedPool, reportQueue, iterations,url))
185188
threadsProc.append(p)
186189

187190
# Launch threads

benchmark/redisgraph/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
redis>=2.10.6
2-
click>=6.7
1+
Click>=7.0
2+
redis>=3.3.8
3+
requests>=2.22.0

0 commit comments

Comments
 (0)