You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Paulo Costa (JIRA)" <ji...@apache.org> on 2016/03/07 14:09:40 UTC

[jira] [Commented] (SPARK-13700) Rdd.mapAsync(): Easily mix Spark and asynchroneous transformation

    [ https://issues.apache.org/jira/browse/SPARK-13700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15182978#comment-15182978 ] 

Paulo Costa commented on SPARK-13700:
-------------------------------------

Hello, Sean.

Thanks for looking at it.

I just want to clarify a few points:

This is unrelated to `AsyncRDDActions`:
- `AsyncRDDActions` is about executing RDD actions without blocking the driver program.
- This request is about executing a `map()` transform on multiple items concurrently, 

Also, my motivation isn't to execute multiple expensive synchronous calls (Spark's solves that problem really well with partition parallelism)
Instead, I need to execute multiple cheap, high-latency, asynchronous calls (i.e. anything that requires network communication -- HTTP requests, DB access, etc)

I agree that anyone can do it themselves using `mapPartitions` (I just did), but so can `map`, `filter`, and many of the existing RDD transforms.
It doesn't mean they should, as it took me a couple of hours to write it, and I'm not completely sure I got it right (Concurrency is hard!)


I'll send the idea on a mailing list


> Rdd.mapAsync(): Easily mix Spark and asynchroneous transformation
> -----------------------------------------------------------------
>
>                 Key: SPARK-13700
>                 URL: https://issues.apache.org/jira/browse/SPARK-13700
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>            Reporter: Paulo Costa
>            Priority: Minor
>              Labels: async, features, rdd, transform
>
> Spark is great for synchronous operations.
> But sometimes I need to call a database/web server/etc from my transform, and the Spark pipeline stalls waiting for it.
> Avoiding that would be great!
> I suggest we add a new method RDD.mapAsync(), which can execute these operations concurrently, avoiding the bottleneck.
> I've written a quick'n'dirty implementation of what I have in mind: 
> https://gist.github.com/paulo-raca/d121cf27905cfb1fafc3
> What do you think?
> If you agree with this feature, I can work on a pull request.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org