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

[WIP] Remove keepalive timers from Workers #1436

Closed
wants to merge 3 commits into from

Conversation

mudler
Copy link
Member

@mudler mudler commented Aug 18, 2017

No description provided.

@codecov
Copy link

codecov bot commented Aug 18, 2017

Codecov Report

Merging #1436 into master will decrease coverage by <.01%.
The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1436      +/-   ##
==========================================
- Coverage   87.52%   87.51%   -0.01%     
==========================================
  Files         105      105              
  Lines        7918     7931      +13     
==========================================
+ Hits         6930     6941      +11     
- Misses        988      990       +2
Impacted Files Coverage Δ
lib/OpenQA/Worker/Commands.pm 80.23% <100%> (+0.47%) ⬆️
lib/OpenQA/Worker/Common.pm 80.85% <100%> (+0.58%) ⬆️
lib/OpenQA/WebSockets/Server.pm 76.69% <88.88%> (-0.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9fa6353...b7c4c4d. Read the comment docs.

This should decrease the websocket load from the worker side - given the
instance number we use it to calculate the timer range to send status messages
to the websocket server.
Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

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

could you describe in your commit+PR what the intention is and not describe what you do with "Remove keepalive timers from Workers"?

@@ -148,19 +145,20 @@ sub websocket_commands {
if ($job && $job->{id}) {
$OpenQA::Worker::Common::job = $job;
log_debug("Job " . $job->{id} . " scheduled for next cycle");
my $send_status = sub {
log_debug("Sending IMMEDIATELY worker status to $host");
Copy link
Member

Choose a reason for hiding this comment

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

I saw that you just moved this debug line but I wanted to ask you anyway what it means. I don't understand the english sentence here. Could you clarify that line?

Copy link
Member Author

@mudler mudler Aug 20, 2017

Choose a reason for hiding this comment

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

Because that message is sent right away when the job starts/stop.

# Feature scaling - we do not know the instance maximum per worker, we take DEAD_DETECTION_THRESHOLD as max.
my $imax = $i > DEAD_DETECTION_THRESHOLD ? $i : DEAD_DETECTION_THRESHOLD;
my $worker_status_timer
= int(MIN_STATUS_TIMER + ((($i - 1) * (DEAD_DETECTION_THRESHOLD - MIN_STATUS_TIMER)) / ($imax - 1)));
Copy link
Member

Choose a reason for hiding this comment

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

IMHO line breaks like these should be avoided so … use a temporary variable assignment?

Copy link
Member Author

Choose a reason for hiding this comment

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

those are temporary variables already

Copy link
Member

Choose a reason for hiding this comment

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

I meant

                my $foo = ($i - 1) * (DEAD_DETECTION_THRESHOLD - MIN_STATUS_TIMER);
                my $worker_status_timer = int(MIN_STATUS_TIMER + ( $foo / ($imax - 1)));

Copy link
Member Author

@mudler mudler Aug 21, 2017

Choose a reason for hiding this comment

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

Right, and that would add to the code just another useless variable for 1 statement forcing even the logic to come up with a variable name, that would be meaningless anyway:

my $foo = ($i - 1) * (DEAD_DETECTION_THRESHOLD - MIN_STATUS_TIMER);
my $bar = ( $foo / ($imax - 1));
my $worker_status_timer = int(MIN_STATUS_TIMER + $bar);

How you are going to call $foo and $bar then? $a and $b ? ;-)

At this point, if the line break is the problem, it's better to just shrink the constants names, e.g:

my $status_timer = int(MIN_TIMER + ((($i - 1) * (MAX_TIMER - MIN_TIMER)) / ($imax - 1)));

my $worker_status_timer
= int(MIN_STATUS_TIMER + ((($i - 1) * (DEAD_DETECTION_THRESHOLD - MIN_STATUS_TIMER)) / ($imax - 1)));
log_debug("## worker_status timer will be sending status each $worker_status_timer seconds")
if $verbose;
Copy link
Member

Choose a reason for hiding this comment

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

I don't undersand what thas flag is for. Isn't log_debug implicit for "verbose"?

Copy link
Member Author

@mudler mudler Aug 20, 2017

Choose a reason for hiding this comment

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

it's to display the debug message when the client has the optional flag --verbose specified as argument in the command line.

@mudler
Copy link
Member Author

mudler commented Aug 20, 2017

@okurz it's a wip, and was discussed already with @coolo to remove (now) duplicated workload on the websocket server - something like that was expected. I'll put a complete description when i'm sure about all the required changes.

Edit: i forgot to mention, that the problem was already discussed in #1432 and on #1433 as well, this is a follow-up discussion to identify possible fixes. The issues are related.

@mudler
Copy link
Member Author

mudler commented Oct 27, 2017

Closing, superseded by #1486

@mudler mudler closed this Oct 27, 2017
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.

2 participants