Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import scala.language.implicitConversions
import scala.xml.Node

import org.eclipse.jetty.client.api.Response
import org.eclipse.jetty.client.HttpClient
import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP
import org.eclipse.jetty.proxy.ProxyServlet
import org.eclipse.jetty.server._
import org.eclipse.jetty.server.handler._
Expand Down Expand Up @@ -208,6 +210,13 @@ private[spark] object JettyUtils extends Logging {
rewrittenURI.toString()
}

override def newHttpClient(): HttpClient = {
// Use the Jetty logic to calculate the number of selector threads (#CPUs/2),
// but limit it to 8 max.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also explain why we are limiting the number of selectors in the comment above?

val numSelectors = math.max(1,math.min(8,Runtime.getRuntime().availableProcessors()/2))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail style tests @IngoSchuster -- we need spaces around operators, after commas, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aargh - what an unnecessary failure, sorry about that :(.
I've corrected the line in question, the Scala style tests do pass now.

return new HttpClient(new HttpClientTransportOverHTTP(numSelectors), null)
}

override def filterServerResponseHeader(
clientRequest: HttpServletRequest,
serverResponse: Response,
Expand Down