Skip to content
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

JENKINS-62212 Add filter to periodic EC2 connection polling #456

Merged
merged 1 commit into from
Nov 3, 2020

Conversation

jamur2
Copy link
Contributor

@jamur2 jamur2 commented May 7, 2020

It appears the response from this request is discarded, and the request
is made only to validate we still have a good connection to AWS.

This prevents the connection polling from returning all ec2 instances
in the AWS account, using up AWS API quotas (which take result size into
account for API quota tracking purposes).

We are running a semi-degenerate setup with ~50 instances in a single AWS account, all of which make this unfiltered request every minute, and have been getting API throttled. My rough understanding is that this is just a health check and we don't actually need the whole query result, and we've been running one master with this patch with no ill effects so far, but it's entirely possible I'm misinterpreting the purpose of this request.

@@ -1051,7 +1051,10 @@ protected void doRun() throws IOException {
LOGGER.finer(() -> "Checking EC2 Connection on: " + ec2_cloud.getDisplayName());
try {
if(ec2_cloud.connection != null) {
ec2_cloud.connection.describeInstances();
List<Filter> filters = new ArrayList<>();
filters.add(new Filter("tag-key").withValues("bogus-EC2ConnectionKeepalive"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if there's a more idiomatic way to craft a filter that returns few/no instances, while also not triggering an AmazonClientException. This was just the first thing that came to mind.

It appears the response from this request is discarded, and the request
is made only to validate we still have a good connection to AWS.

This prevents the connection polling from returning _all_ ec2 instances
in the AWS account, using up AWS API quotas (which take result size into
account for API quota tracking purposes).
Copy link
Contributor

@res0nance res0nance left a comment

Choose a reason for hiding this comment

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

This looks reasonable. I'd like to manually test this before merging

@jamur2
Copy link
Contributor Author

jamur2 commented Sep 10, 2020

Is there anything I can do to help verify this?

@drts01
Copy link

drts01 commented Nov 3, 2020

any traction on this PR?

@res0nance res0nance added the enhancement Feature additions or enhancements label Nov 3, 2020
@res0nance res0nance merged commit 7d45fc1 into jenkinsci:master Nov 3, 2020
@jamur2 jamur2 deleted the TIGER-1642 branch November 3, 2020 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature additions or enhancements
Projects
None yet
3 participants