Skip to content

Commit cba9545

Browse files
authored
Add plasma store benchmark for small objects (#9549)
1 parent 87630cf commit cba9545

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

python/ray/ray_perf.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""This is the script for `ray microbenchmark`."""
22

33
import asyncio
4+
import json
45
import logging
56
import os
67
import time
@@ -108,10 +109,13 @@ def main():
108109
check_optimized_build()
109110

110111
print("Tip: set TESTS_TO_RUN='pattern' to run a subset of benchmarks")
111-
ray.init()
112+
113+
ray.init(
114+
_internal_config=json.dumps({
115+
"put_small_object_in_memory_store": True
116+
}))
112117

113118
value = ray.put(0)
114-
arr = np.zeros(100 * 1024 * 1024, dtype=np.int64)
115119

116120
def get_small():
117121
ray.get(value)
@@ -123,11 +127,6 @@ def put_small():
123127

124128
timeit("single client put calls", put_small)
125129

126-
def put_large():
127-
ray.put(arr)
128-
129-
timeit("single client put gigabytes", put_large, 8 * 0.1)
130-
131130
@ray.remote
132131
def do_put_small():
133132
for _ in range(100):
@@ -138,6 +137,26 @@ def put_multi_small():
138137

139138
timeit("multi client put calls", put_multi_small, 1000)
140139

140+
ray.shutdown()
141+
ray.init(
142+
_internal_config=json.dumps({
143+
"put_small_object_in_memory_store": False
144+
}))
145+
146+
value = ray.put(0)
147+
arr = np.zeros(100 * 1024 * 1024, dtype=np.int64)
148+
149+
timeit("single client get calls (Plasma Store)", get_small)
150+
151+
timeit("single client put calls (Plasma Store)", put_small)
152+
153+
timeit("multi client put calls (Plasma Store)", put_multi_small, 1000)
154+
155+
def put_large():
156+
ray.put(arr)
157+
158+
timeit("single client put gigabytes", put_large, 8 * 0.1)
159+
141160
@ray.remote
142161
def do_put():
143162
for _ in range(10):

0 commit comments

Comments
 (0)