File tree Expand file tree Collapse file tree
core/src/main/scala/org/apache/spark/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ import scala.language.implicitConversions
2626import scala .xml .Node
2727
2828import org .eclipse .jetty .client .api .Response
29+ import org .eclipse .jetty .client .HttpClient
30+ import org .eclipse .jetty .client .http .HttpClientTransportOverHTTP
2931import org .eclipse .jetty .proxy .ProxyServlet
3032import org .eclipse .jetty .server ._
3133import org .eclipse .jetty .server .handler ._
@@ -208,6 +210,13 @@ private[spark] object JettyUtils extends Logging {
208210 rewrittenURI.toString()
209211 }
210212
213+ override def newHttpClient (): HttpClient = {
214+ // Use the Jetty logic to calculate the number of selector threads (#CPUs/2),
215+ // but limit it to 8 max.
216+ val numSelectors = math.max(1 ,math.min(8 ,Runtime .getRuntime().availableProcessors()/ 2 ))
217+ return new HttpClient (new HttpClientTransportOverHTTP (numSelectors), null )
218+ }
219+
211220 override def filterServerResponseHeader (
212221 clientRequest : HttpServletRequest ,
213222 serverResponse : Response ,
You can’t perform that action at this time.
0 commit comments