Github user jaceklaskowski commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11615#discussion_r55869059
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -270,9 +270,25 @@ private[spark] object JettyUtils extends Logging {
     
           gzipHandlers.foreach(collection.addHandler)
           connectors.foreach(_.setHost(hostName))
    +      // As each acceptor and each selector will use one thread, the 
number of threads should at
    +      // least be the number of acceptors and selectors plus 1. (See 
SPARK-13776)
    +      var minThreads = 1
    +      connectors.foreach { c =>
    +        // Currently we only use "SelectChannelConnector"
    +        val connector = c.asInstanceOf[SelectChannelConnector]
    +        // Limit the max acceptor number to 8 so that we don't waste a lot 
of threads
    +        connector.setAcceptors(math.min(connector.getAcceptors, 8))
    +        // The number of selectors always equals to the number of acceptors
    +        minThreads += connector.getAcceptors * 2
    +      }
           server.setConnectors(connectors.toArray)
     
           val pool = new QueuedThreadPool
    +      if (serverName.nonEmpty) {
    +        pool.setName(serverName)
    +      }
    +      pool.setMaxThreads(math.max(pool.getMaxThreads, minThreads))
    +      pool.setMinThreads(math.min(pool.getMinThreads, pool.getMaxThreads))
    --- End diff --
    
    When could `getMinThreads` be greater than `getMaxThreads`? Why don't you 
use `minThreads` here, 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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to