Skip to content

Commit 2a2c157

Browse files
committed
Revert "Async actor microbenchmark Script (#8275)"
This reverts commit 6a6eead.
1 parent 4908688 commit 2a2c157

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

python/ray/ray_perf.py

-58
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""This is the script for `ray microbenchmark`."""
22

3-
import asyncio
43
import os
54
import time
65
import numpy as np
@@ -23,18 +22,6 @@ def small_value_batch(self, n):
2322
ray.get([small_value.remote() for _ in range(n)])
2423

2524

26-
@ray.remote
27-
class AsyncActor:
28-
async def small_value(self):
29-
return b"ok"
30-
31-
async def small_value_with_arg(self, x):
32-
return b"ok"
33-
34-
async def small_value_batch(self, n):
35-
await asyncio.wait([small_value.remote() for _ in range(n)])
36-
37-
3825
@ray.remote(num_cpus=0)
3926
class Client:
4027
def __init__(self, servers):
@@ -203,51 +190,6 @@ def actor_multi2_direct_arg():
203190
timeit("n:n actor calls with arg async", actor_multi2_direct_arg,
204191
n * len(clients))
205192

206-
a = AsyncActor.remote()
207-
208-
def actor_sync():
209-
ray.get(a.small_value.remote())
210-
211-
timeit("1:1 async-actor calls sync", actor_sync)
212-
213-
a = AsyncActor.remote()
214-
215-
def async_actor():
216-
ray.get([a.small_value.remote() for _ in range(1000)])
217-
218-
timeit("1:1 async-actor calls async", async_actor, 1000)
219-
220-
a = AsyncActor.remote()
221-
222-
def async_actor():
223-
ray.get([a.small_value_with_arg.remote(i) for i in range(1000)])
224-
225-
timeit("1:1 async-actor calls with args async", async_actor, 1000)
226-
227-
n = 5000
228-
n_cpu = multiprocessing.cpu_count() // 2
229-
actors = [AsyncActor.remote() for _ in range(n_cpu)]
230-
client = Client.remote(actors)
231-
232-
def async_actor_async():
233-
ray.get(client.small_value_batch.remote(n))
234-
235-
timeit("1:n async-actor calls async", async_actor_async, n * len(actors))
236-
237-
n = 5000
238-
m = 4
239-
n_cpu = multiprocessing.cpu_count() // 2
240-
a = [AsyncActor.remote() for _ in range(n_cpu)]
241-
242-
@ray.remote
243-
def async_actor_work(actors):
244-
ray.get([actors[i % n_cpu].small_value.remote() for i in range(n)])
245-
246-
def async_actor_multi():
247-
ray.get([async_actor_work.remote(a) for _ in range(m)])
248-
249-
timeit("n:n async-actor calls async", async_actor_multi, m * n)
250-
251193

252194
if __name__ == "__main__":
253195
main()

0 commit comments

Comments
 (0)