You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by arzt <gi...@git.apache.org> on 2017/04/26 15:07:50 UTC

[GitHub] spark pull request #17774: [SPARK-18371][Streaming] Spark Streaming backpres...

GitHub user arzt opened a pull request:

    https://github.com/apache/spark/pull/17774

    [SPARK-18371][Streaming] Spark Streaming backpressure generates batch with large number of records

    ## What changes were proposed in this pull request?
    
    Omit rounding of backpressure rate. Effects:
    - no batch with large number of records is created when rate from PID estimator is small
    - the number of records per batch and partition is more fine-grained improving backpressure accuracy
    
    ## How was this patch tested?
    
    This was tested by running:
    - `mvn test -pl external/kafka-0-8`
    - `mvn test -pl external/kafka-0-10`
    - a streaming application which was suffering from the issue
    
    @JasonMWhite
    
    The contribution is my original work and I license the work to the project under the project\u2019s open source license
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/arzt/spark kafka-back-pressure

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/17774.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #17774
    
----
commit a7a5cbca2d453a1691da9ddc1c6f74eba78b6289
Author: Sebastian Arzt <se...@plista.com>
Date:   2017-04-26T13:39:46Z

    no rounding of backpressure rate

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    @koeninger I agree that assuming a long batch size is wrong, not sure whether it even matters. 
    But what if for one partition there is no lack in the current batch? Then fetching 1 message for this partition from kafka, is you suggest, would fail. So here zero makes sense in my eyes. This is also the old behaviour if `rate > 1` and `lag == 0` [here](https://github.com/apache/spark/blob/master/external/kafka-0-8/src/main/scala/org/apache/spark/streaming/kafka/DirectKafkaInputDStream.scala#L107). 
    Further, I think that truncating 0.99 to 0 messages per partition is also the right thing to do, as one cannot be sure that there is one message available if `(secsPerBatch * limit) < 1.0`. And as you say, in a future batch it is very like to become greater than 1.0.
    Do you agree?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76256/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Jenkins, ok to test


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/78618/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17774: [SPARK-18371][Streaming] Spark Streaming backpres...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17774#discussion_r113497951
  
    --- Diff: external/kafka-0-10/src/main/scala/org/apache/spark/streaming/kafka010/DirectKafkaInputDStream.scala ---
    @@ -140,11 +140,11 @@ private[spark] class DirectKafkaInputDStream[K, V](
     
             lagPerPartition.map { case (tp, lag) =>
               val maxRateLimitPerPartition = ppc.maxRatePerPartition(tp)
    -          val backpressureRate = Math.round(lag / totalLag.toFloat * rate)
    +          val backpressureRate = lag / totalLag.toFloat * rate
    --- End diff --
    
    (Given your change, I think double becomes more reasonable than float.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #78618 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/78618/testReport)** for PR 17774 at commit [`16b9aaf`](https://github.com/apache/spark/commit/16b9aafd8c668a6db2e4bafbeb4b4b0768677b2e).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by JasonMWhite <gi...@git.apache.org>.
Github user JasonMWhite commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    I think @koeninger's suggestion is valid. `effectiveRateLimitPerPartition` is the upper bound on the number of messages per partition per second, and `maxMessagesPerPartition` sets an upper bound on the number of messages to be retrieved per partition per batch window.
    
    Making `effectiveRateLimitPerPartition` a float will allow it to handle properly rates of < 1/partition/s, so this is definitely a good idea. `maxMessagesPerPartition` must still be an integer, as you can't retrieve partial messages. All agreed there.
    
    Setting `maxMessagesPerPartition` to have a minimum of 1 message per window is a good safe value to allow progress in all cases. If there isn't 1 message to retrieve, `clamp` will prevent it from attempting to retrieve an invalid message.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    LGTM pending jason's comments on tests


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    merged to master
    Thanks @arzt !


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    @felixcheung will this be merged?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    I changed the max messages per partition to be at least 1. Agreed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by pptaszynski <gi...@git.apache.org>.
Github user pptaszynski commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    I am looking forward this one to be merged. we are suffering from the issue it resolved quite badly. It effectively makes the back-pressure not working for us at all.


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Have you read the function def clamp?
    
    Rate limit of 1 should not imply an attempt to grab 1 message even if it
    doesn't exist.
    
    On Apr 27, 2017 11:01, "Sebastian Arzt" <no...@github.com> wrote:
    
    > @koeninger <https://github.com/koeninger> I agree that assuming a long
    > batch size is wrong, not sure whether it even matters.
    > But what if for one partition there is no lack in the current batch? Then
    > fetching 1 message for this partition from kafka, is you suggest, would
    > fail. So here zero makes sense in my eyes. This is also the old behaviour
    > if rate > 1 and lag == 0 here
    > <https://github.com/apache/spark/blob/master/external/kafka-0-8/src/main/scala/org/apache/spark/streaming/kafka/DirectKafkaInputDStream.scala#L107>
    > .
    > Further, I think that truncating 0.99 to 0 messages per partition is also
    > the right thing to do, as one cannot be sure that there is one message
    > available if (secsPerBatch * limit) < 1.0. And as you say, in a future
    > batch it is very like to become greater than 1.0.
    > Do you agree?
    >
    > \u2014
    > You are receiving this because you were mentioned.
    > Reply to this email directly, view it on GitHub
    > <https://github.com/apache/spark/pull/17774#issuecomment-297758733>, or mute
    > the thread
    > <https://github.com/notifications/unsubscribe-auth/AAGAB1X8NCNqECUlx9X54DSAmbnHmHdAks5r0LvggaJpZM4NJAVA>
    > .
    >



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #76263 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76263/testReport)** for PR 17774 at commit [`c98b9a4`](https://github.com/apache/spark/commit/c98b9a48516e600cca59bdd14463b5559ebcf5e5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    To run tests or debug using IntelliJ:
    `mvn test -DforkMode=never -pl external/kafka-0-8 "-Dsuites=org.apache.spark.streaming.kafka.DirectKafkaStreamSuite maxMessagesPerPartition"`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    It's been a while. What can I do to draw some attention to this request? Is this issue not relevant enough? Thanks for reconsideration @felixcheung @brkyvz @zsxwing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    @brkyvz @zsxwing 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Sorry for being inactive. All good with this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #88226 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88226/testReport)** for PR 17774 at commit [`1acbe4c`](https://github.com/apache/spark/commit/1acbe4c2a98e4d4c407fd557005d815dfd94851a).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by JasonMWhite <gi...@git.apache.org>.
Github user JasonMWhite commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Code looks sound. Could you add or modify a test to illustrate/verify?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    @arzt It's entirely possible to have batch times less than a second, and I'm not sure I agree that the absolute number of messages allowable for a partition should ever be zero.
    
    So to put this another way, right now effectiveRateLimitPerPartition is a Map[TopicPartition, Long], which matches the return value of the function maxMessagesPerPartition.
    
    You're wanting to change effectiveRateLimitPerPartition to a Map[TopicPartition, Double], which is probably a good idea, and should fix the bug around treating a very small rate limit as no limit.
    
    But it still needs to be converted to Map[TopicPartition, Long] before returning.  Calling .toLong is probably not the right thing to do there, because 0.99 will get truncated to 0.  
    
    I think one message per partition per batch is the minimum reasonable rate limit, otherwise particular partitions may not make progress.  The relative lag calculation might take care of that in future batches, but it still seems questionable, even if it's a corner case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17774: [SPARK-18371][Streaming] Spark Streaming backpres...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17774#discussion_r113871876
  
    --- Diff: external/kafka-0-10/src/test/scala/org/apache/spark/streaming/kafka010/DirectKafkaStreamSuite.scala ---
    @@ -617,6 +617,94 @@ class DirectKafkaStreamSuite
         ssc.stop()
       }
     
    +  test("maxMessagesPerPartition with rate equal to one") {
    +    val topic = "backpressure"
    +    val kafkaParams = getKafkaParams()
    +    val batchIntervalMilliseconds = 10000
    +    val sparkConf = new SparkConf()
    +      // Safe, even with streaming, because we're using the direct API.
    +      // Using 1 core is useful to make the test more predictable.
    +      .setMaster("local[1]")
    +      .setAppName(this.getClass.getSimpleName)
    +      .set("spark.streaming.kafka.maxRatePerPartition", "100")
    +
    +    // Setup the streaming context
    +    ssc = new StreamingContext(sparkConf, Milliseconds(batchIntervalMilliseconds))
    +    val estimatedRate = 1
    +    val fromOffsets = Map(
    +      new TopicPartition(topic, 0) -> 0L,
    +      new TopicPartition(topic, 1) -> 0L,
    +      new TopicPartition(topic, 2) -> 0L
    +    )
    +    val kafkaStream = withClue("Error creating direct stream") {
    +      new DirectKafkaInputDStream[String, String](
    +        ssc,
    +        preferredHosts,
    +        ConsumerStrategies.Subscribe[String, String](List(topic), kafkaParams.asScala),
    +        new DefaultPerPartitionConfig(sparkConf)
    +      ) {
    +        currentOffsets = fromOffsets
    +        override val rateController = Some(new ConstantRateController(id, null, estimatedRate))
    +      }
    +    }
    +
    +    val offsets = Map[TopicPartition, Long](
    +      new TopicPartition(topic, 0) -> 100L,
    +      new TopicPartition(topic, 1) -> 100L,
    +      new TopicPartition(topic, 2) -> 100L
    +    )
    +    val result = kafkaStream.maxMessagesPerPartition(offsets)
    +    assert(result.isDefined, s"Messages per partitions should exist for estimated rate of 1")
    --- End diff --
    
    After omitting the case of zero messages per topic, one of the tests is redundant. I removed it from each `DirectKafkaStreamSuite`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #76256 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76256/testReport)** for PR 17774 at commit [`d4a7867`](https://github.com/apache/spark/commit/d4a7867d96aa7c4bbed9cbd03b0753adcf79db9d).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Jenkins, ok to test


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by arzt <gi...@git.apache.org>.
Github user arzt commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Thanks for your valuable feedback. I added tests as suggested by @JasonMWhite . @koeninger the estimated rate is per second summed over all partitions, is it? The batch time usually is longer. So even values less than 1 but greater than 0 for `backpressureRate` can make sense for one partition. The casting to long is only needed when the absolute number of messages is computed, but even this number can be zero for some partitions, e.g. when there is no lag. I hope I am not confused here. There is also a test covering this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by JasonMWhite <gi...@git.apache.org>.
Github user JasonMWhite commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76263/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    I think @tdas @zsxwing should comment if this is the right direction...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Jenkins, test this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #78618 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/78618/testReport)** for PR 17774 at commit [`16b9aaf`](https://github.com/apache/spark/commit/16b9aafd8c668a6db2e4bafbeb4b4b0768677b2e).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Can one of the admins verify this patch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #76263 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76263/testReport)** for PR 17774 at commit [`c98b9a4`](https://github.com/apache/spark/commit/c98b9a48516e600cca59bdd14463b5559ebcf5e5).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #17774: [SPARK-18371][Streaming] Spark Streaming backpres...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/17774


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #88226 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88226/testReport)** for PR 17774 at commit [`1acbe4c`](https://github.com/apache/spark/commit/1acbe4c2a98e4d4c407fd557005d815dfd94851a).


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88226/
    Test PASSed.


---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    How do you read 0.1 of a kafka message for a given partition of a given batch?
    
    Ultimately the floor for a rate limit, assuming one is set, needs to be 1 message per partition per batch, not a fraction, which is why it's a long.
    
    If you want to delay that conversion by keeping it as a double as long as possible, that makes sense, but the lines like
    
    (secsPerBatch * limit).toLong
    
    probably need attention too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by koeninger <gi...@git.apache.org>.
Github user koeninger commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    LGTM
    @tdas @zsxwing absent any objections from you in the next couple of days, I'll merge this


---

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


[GitHub] spark pull request #17774: [SPARK-18371][Streaming] Spark Streaming backpres...

Posted by JasonMWhite <gi...@git.apache.org>.
Github user JasonMWhite commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17774#discussion_r113753764
  
    --- Diff: external/kafka-0-10/src/test/scala/org/apache/spark/streaming/kafka010/DirectKafkaStreamSuite.scala ---
    @@ -617,6 +617,94 @@ class DirectKafkaStreamSuite
         ssc.stop()
       }
     
    +  test("maxMessagesPerPartition with rate equal to one") {
    +    val topic = "backpressure"
    +    val kafkaParams = getKafkaParams()
    +    val batchIntervalMilliseconds = 10000
    +    val sparkConf = new SparkConf()
    +      // Safe, even with streaming, because we're using the direct API.
    +      // Using 1 core is useful to make the test more predictable.
    +      .setMaster("local[1]")
    +      .setAppName(this.getClass.getSimpleName)
    +      .set("spark.streaming.kafka.maxRatePerPartition", "100")
    +
    +    // Setup the streaming context
    +    ssc = new StreamingContext(sparkConf, Milliseconds(batchIntervalMilliseconds))
    +    val estimatedRate = 1
    +    val fromOffsets = Map(
    +      new TopicPartition(topic, 0) -> 0L,
    +      new TopicPartition(topic, 1) -> 0L,
    +      new TopicPartition(topic, 2) -> 0L
    +    )
    +    val kafkaStream = withClue("Error creating direct stream") {
    +      new DirectKafkaInputDStream[String, String](
    +        ssc,
    +        preferredHosts,
    +        ConsumerStrategies.Subscribe[String, String](List(topic), kafkaParams.asScala),
    +        new DefaultPerPartitionConfig(sparkConf)
    +      ) {
    +        currentOffsets = fromOffsets
    +        override val rateController = Some(new ConstantRateController(id, null, estimatedRate))
    +      }
    +    }
    +
    +    val offsets = Map[TopicPartition, Long](
    +      new TopicPartition(topic, 0) -> 100L,
    +      new TopicPartition(topic, 1) -> 100L,
    +      new TopicPartition(topic, 2) -> 100L
    +    )
    +    val result = kafkaStream.maxMessagesPerPartition(offsets)
    +    assert(result.isDefined, s"Messages per partitions should exist for estimated rate of 1")
    --- End diff --
    
    The actual result should be deterministic, why not check the correct value instead of just `not None` ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    **[Test build #76256 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76256/testReport)** for PR 17774 at commit [`d4a7867`](https://github.com/apache/spark/commit/d4a7867d96aa7c4bbed9cbd03b0753adcf79db9d).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #17774: [SPARK-18371][Streaming] Spark Streaming backpressure ge...

Posted by JasonMWhite <gi...@git.apache.org>.
Github user JasonMWhite commented on the issue:

    https://github.com/apache/spark/pull/17774
  
    Tests have some fairly repetitive code, but not sure if that's a problem or not. Looks good to me.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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