Skip to content

Commit a051c64

Browse files
author
Andrew Or
committed
Use GZIP to compress Jetty responses
1 parent 26d9b6b commit a051c64

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/main/scala/org/apache/spark/ui/JettyUtils.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,16 @@ private[spark] object JettyUtils extends Logging {
210210
conf: SparkConf,
211211
serverName: String = ""): ServerInfo = {
212212

213-
val collection = new ContextHandlerCollection
214-
collection.setHandlers(handlers.toArray)
215213
addFilters(handlers, conf)
216214

215+
val collection = new ContextHandlerCollection
216+
val gzipHandlers = handlers.map { h =>
217+
val gzipHandler = new GzipHandler
218+
gzipHandler.setHandler(h)
219+
gzipHandler
220+
}
221+
collection.setHandlers(gzipHandlers.toArray)
222+
217223
// Bind to the given port, or throw a java.net.BindException if the port is occupied
218224
def connect(currentPort: Int): (Server, Int) = {
219225
val server = new Server(new InetSocketAddress(hostName, currentPort))

0 commit comments

Comments
 (0)