# Is Ray suitable for edge real time processing?

**URL:** <https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738>\
**Category:** Ray Core\
**Created:** [March 13, 2023, 2:55pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738 "2023-03-13T14:55:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![simone.zandara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@simone.zandara](https://discuss.ray.io/u/simone.zandara)\
**Post date:** [March 13, 2023, 2:55pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/1 "2023-03-13T14:55:25Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- None: Just asking a question out of curiosity

Hello

It seems that most of the use cases are related to batch/stream processing of incoming data either for training, online services or data processing (which is usually not necessarily real time).

I am exploring Ray for running inference at non-strict real-time speed on the edge (single Jetson). I need some multiprocessing where I can control CPU assignment and data sharing.

In specific I will be processing images incoming from a video in parallel (same image processed in different ways) and I will require some computation output as fast as possible to keep up with a certain frame rate.

Would Ray be able to keep up performances?  
Keen to hear your thoughts.

---

<div class="post-metadata">

**Author:** ![rickyyx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rickyyx/32/2671_2.png) [@rickyyx](https://discuss.ray.io/u/rickyyx)\
**Post date:** [March 13, 2023, 11:48pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/2 "2023-03-13T23:48:21Z")

</div>

@simone.zandara Thanks for the question! Definitely an interesting usecase.

Are you trying to process the images in a single host? Or if there are any multi-hosts (or cluster equivalent concepts)

Ray does have ray core’s APIs that are more generic and less ML specific, but tailored to general distributed computing.

But again, there is overheads comes with storage and computing with running ray.

---

<div class="post-metadata">

**Author:** ![simone.zandara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@simone.zandara](https://discuss.ray.io/u/simone.zandara)\
**Post date:** [March 14, 2023, 7:51am UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/3 "2023-03-14T07:51:04Z")

</div>

Storage is not a huge deal, mostly I am worried about the computing overhead. Can you point me to some resources or code? 🙂  
Resource management (such as GPU/CPU assignment) and multi threading is crucial for proper performances and Ray does seem to have few tooling to help with that.

Yea it would aim at processing images in a single host. I work with ML on the Edge with limited computing powers. The use case is close to robotics or autonomous devices such as cars. There are better suited tools for that such as GStreamer or Mediapipe, but overall they are pretty disruptive and more close to production readiness. We do a lot of Prototyping with Python instead.

Imagine maybe running one actor for ML detection in a Ray Actor while using the same image for Lane Following (maybe using classic computer vision). Just an example.

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [March 14, 2023, 3:01pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/4 "2023-03-14T15:01:15Z")

</div>

@simone.zandara Where are we this wrt resolution. Did you get your question answered from @rickyyx Seems like an interesting you case, but we not come across loads of Ray for edge devices.

As pointed Ray does have ray core’s APIs (actors and tasks) that are more generic and less ML specific, but tailored to general distributed computing. You you might be able to use Ray actors on the edge for single image reference.

Let us know how you progress. If this works, might be good to followup with a blog or lightning meetup talk.

Can we mark this as resolved?

---

<div class="post-metadata">

**Author:** ![simone.zandara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@simone.zandara](https://discuss.ray.io/u/simone.zandara)\
**Post date:** [March 14, 2023, 3:10pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/5 "2023-03-14T15:10:04Z")

</div>

If possible, could someone point at the aforementioned computational overhead of Ray with respect to task and actor scheduling?

---

<div class="post-metadata">

**Author:** ![rickyyx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rickyyx/32/2671_2.png) [@rickyyx](https://discuss.ray.io/u/rickyyx)\
**Post date:** [March 14, 2023, 6:59pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/6 "2023-03-14T18:59:52Z")

</div>

So we have microbenchmark covering running ray on a single machine with empty tasks, which translates to around 0.5 - 0.8 ms overheads for executing a ray task. See this microbenchmark in particular: [ray/ray\_perf.py at b29890d1607378aa144d764635b5dc51bce17150 · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/b29890d1607378aa144d764635b5dc51bce17150/python/ray/_private/ray_perf.py#L165-L168)

(This runs empty 1000 ray tasks sequentially and wait for each one to return, so it approximately reflects the overhead of running a single ray task in a single machine)

There are more benchmark results here (but not in the format that’s most readable by external users): [ray/release/release\_logs/2.3.0 at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/tree/master/release/release_logs/2.3.0)

Executing ray tasks in a distributed cluster has many more confounding factors, I don’t remember a test that produced direct result for this, but I could ask around.

---

<div class="post-metadata">

**Author:** ![simone.zandara](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@simone.zandara](https://discuss.ray.io/u/simone.zandara)\
**Post date:** [March 15, 2023, 6:47am UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/7 "2023-03-15T06:47:07Z")

</div>

Thanks a lot for the help. I will take a look at the material and maybe do some prototyping.

---

<div class="post-metadata">

**Author:** ![Jules\_Damji](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/jules_damji/32/4058_2.png) [@Jules\_Damji](https://discuss.ray.io/u/Jules_Damji)\
**Post date:** [March 15, 2023, 9:26pm UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/8 "2023-03-15T21:26:05Z")

</div>

@simone.zandara Thanks for your questions. Yes, there is an amortizing over time with many ray tasks; small ray tasks does add the overhead, but more complicated and compute intensive tasks, past the initial small overhead of scheduling and dispatching them, you see the merits.

Related is also using [too many small Ray tasks](https://docs.ray.io/en/latest/ray-core/patterns/too-fine-grained-tasks.html#anti-pattern-over-parallelizing-with-too-fine-grained-tasks-harms-speedup) is considered an anti-pattern too.

---

<div class="post-metadata">

**Author:** ![MacherelR](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/macherelr/32/5470_2.png) [@MacherelR](https://discuss.ray.io/u/MacherelR)\
**Post date:** [December 11, 2023, 8:32am UTC](https://discuss.ray.io/t/is-ray-suitable-for-edge-real-time-processing/9738/9 "2023-12-11T08:32:28Z")

</div>

Hello @simone.zandara, I’m currently having the same insights as you about using Ray on a single node cluster on a edge device (pretty sure to be jetson), have you had any luck trying it and would you recommend it ? Or would you provide any other insights or examples ?
