Skip to content

[SPARK-4449][Core]Specify port range in spark #8054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

[SPARK-4449][Core]Specify port range in spark #8054

wants to merge 6 commits into from

Conversation

nssalian
Copy link

@nssalian nssalian commented Aug 9, 2015

Specify port range in spark
JIRA link: https://issues.apache.org/jira/browse/SPARK-4449

Goal: To add a port range to services
Design: (Based on the input and the suggestions in t #3314 and #5722):

  1. Added variables maxPort and failedPorts to help the implementation
  2. The maxPort was explicitly assigned to be startPort + maxRetries to avoid Retries being lesser or greater than the specified port range.
  3. Added the failedPorts ArrayBuffer to catch the failedPorts (during retry) which are in the range of the maxPort - startPort ( see Random logic)
  4. This failedPorts list will be checked and the tryPort will not attempt those ports again in the random..
  5. If the randomized port does not belong to the failedPorts list and a privileged port, it will be tried.
  6. There’s a if block to check if there are sufficient ports left to attempt within the range (not sure if this is needed)

Requesting review.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@@ -193,7 +187,7 @@ private[spark] object Utils extends Logging {
}

/**
* Primitive often used when writing [[java.nio.ByteBuffer]] to [[java.io.DataOutput]]
* Primitive often used when writing java.nio.ByteBuffer to java.io.DataOutput
Copy link
Member

Choose a reason for hiding this comment

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

Are these unrelated changes?

…rrectly. Made maxPort 65536 to allow the range to be port to 65536. Implemented logic
@andrewor14
Copy link
Contributor

@nssalian can you explain the difference between this and #5722? IIUC this introduces some kind of global port range right? I think our past discussions with @srowen @vanzin and @tgravescs already ruled that solution out.

}
else {
// If the new port wraps around, do not try a privilege port or a failedPort
while(!failedPorts.contains((startPort + Math.random() * (maxPort - startPort + 1))) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an array buffer, so contains is linear time, which is pretty expensive. Also this code is very difficult to understand.

@srowen
Copy link
Member

srowen commented Sep 2, 2015

Yes, do you mind closing this PR? this is not quite getting at what needs to happen for SPARK-4449

@nssalian
Copy link
Author

nssalian commented Sep 2, 2015

Closing the PR.

@nssalian nssalian closed this Sep 2, 2015
@nssalian nssalian deleted the SPARK-4449 branch September 6, 2015 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants