# Best way to scale ingestion of IoT sensor streams with Ray?

**URL:** <https://discuss.ray.io/t/best-way-to-scale-ingestion-of-iot-sensor-streams-with-ray/23414>\
**Category:** Uncategorized\
**Created:** [December 27, 2025, 9:37pm UTC](https://discuss.ray.io/t/best-way-to-scale-ingestion-of-iot-sensor-streams-with-ray/23414 "2025-12-27T21:37:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RunLLM](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/runllm/32/8249_2.png) [@RunLLM](https://discuss.ray.io/u/RunLLM)\
**Post date:** [December 27, 2025, 9:38pm UTC](https://discuss.ray.io/t/best-way-to-scale-ingestion-of-iot-sensor-streams-with-ray/23414/2 "2025-12-27T21:38:16Z")

</div>

For high-volume, low-latency ingestion of small sensor events in Ray, the recommended pattern is to use **async actors or actor pools** for I/O-bound workloads, as they efficiently handle concurrent event streams and scale with the number of CPU cores. Ray Serve can also be used for HTTP-based ingestion, providing autoscaling and request routing, but for pure event streaming (especially if not HTTP), async actors are often more efficient. Ray’s built-in queue (`ray.util.queue.Queue`) is available but is generally slower and less scalable than actor-based approaches for this use case. For batch or offline processing, Ray Data is preferred, but for real-time streaming, async actors or Serve deployments with async endpoints are best suited.

Lessons learned:

- For I/O-bound sensor streams, start with a single async actor and load test; scale to multiple actors if the event loop saturates.
- Use actor pools to distribute events across N actors for load balancing.
- Ray Serve is ideal if you want HTTP endpoints with autoscaling and built-in request routing.
- Avoid using Ray’s distributed Queue for high-throughput ingestion, as it introduces more overhead than actor-based solutions.
- For MQTT/WebSocket ingestion, use an async actor to subscribe and process messages, then fan out to worker actors if needed.

Would you like a code example or more detail on a specific ingestion pattern?

Sources:

- [Multiple async actors vs single actor vs asyncio](https://discuss.ray.io/t/multiple-async-actors-vs-single-actor-plain-asyncio/9819)
- [Long-running I/O tasks: async actors vs tasks](https://discuss.ray.io/t/what-is-the-best-approach-for-long-running-io-tasks-pollers/3162)
- [Actor pool load balancing example](https://discuss.ray.io/t/divide-work-between-actors/498)
- [Ray Serve for online/streaming ingestion](https://docs.anyscale.com/runtime/serve/develop)
- [Ray Queue performance trade-offs](https://github.com/ray-project/ray/issues/53010)

Hint: Mention @RunLLM in the post for followups.

---

_[View the full topic](https://discuss.ray.io/t/best-way-to-scale-ingestion-of-iot-sensor-streams-with-ray/23414)._
