Details
-
Sub-task
-
Status: Resolved
-
Trivial
-
Resolution: Fixed
-
4.0.0
Description
Summary:
The current implementation of URL redirection in Spark's history web UI does not consistently add trailing slashes to URLs when constructing redirection targets. This inconsistency leads to additional HTTP redirects by Jetty, which increases the load time and reduces the efficiency of the Spark UI.
Problem Description:
When constructing redirect URLs, particularly in scenarios where an attempt ID needs to be appended, the system does not ensure that the base URL ends with a slash. This omission results in the generated URL being redirected by Jetty to add a trailing slash, thus causing an unnecessary additional HTTP redirect.
For example, when the `shouldAppendAttemptId` flag is true, the URL is formed without a trailing slash before the attempt ID is appended, leading to two redirects: one by our logic to add the attempt ID, and another by Jetty to correct the missing slash.
Proposed Solution:
Ensure that all redirect URLs uniformly end with a trailing slash regardless of whether an attempt ID is appended. This can be achieved by modifying the URL construction logic as follows:
```scala
val redirect = if (shouldAppendAttemptId)
else
{ req.getRequestURI.stripSuffix("/") + "/" }```
Attachments
Attachments
Issue Links
- links to