You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/04/22 18:02:28 UTC

[GitHub] [couchdb] nickva opened a new pull request #3524: Add batching to couch jobs

nickva opened a new pull request #3524:
URL: https://github.com/apache/couchdb/pull/3524


   Add AIMD-based batching to couch_jobs activity monitor and notifier
   
   couch_jobs activity monitor is responsible for checking jobs which have not
   been updated often enough by their workers and re-enqueuing them. Previously
   when the number of jobs grew high enough, couch_jobs could fail to either
   iterate through all the jobs and timeout with a 1007, try to re-enqueue too
   many jobs such that the sum of the commit data would end up being larger than
   the 10MB FDB limit.
   
   couch_jobs notifier is in charge notifying subscribers when job state changes.
   If the jobs are updated, it would notify if it noticed updates, otherwise it
   would notify if job switch to a new state, update -> pending, update ->
   finished, etc. Previously if there were too many jobs and/or the cluster was
   overloaded it was possible for the notifier to fail with timeouts.
   
   To fix both of the issue, introduce batching with the batch size dynamically
   adjusted based on load. As more consecutive errors occur the batch will shrink
   exponentially down to 1 row per transaction. Then with each success, the batch
   will grow linearly by a fixed amount. This auto-configurable behavior should
   provide optimal behavior during overload and during normal operating
   conditions.
   
   For tests, since there are already tests which test enqueuing and subscription,
   use the same tests but make sure they are run while errors are periodically
   generated. That's accomplished with the help of `meck:loop/1` return
   specification.
   
   There are two more commits in the PR to fix and update the next_vs function and
   another one to simplify handling retryable errors in couch_jobs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] nickva merged pull request #3524: Add batching to couch jobs

Posted by GitBox <gi...@apache.org>.
nickva merged pull request #3524:
URL: https://github.com/apache/couchdb/pull/3524


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] nickva commented on a change in pull request #3524: Add batching to couch jobs

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #3524:
URL: https://github.com/apache/couchdb/pull/3524#discussion_r618708508



##########
File path: src/couch_jobs/src/couch_jobs_util.erl
##########
@@ -0,0 +1,59 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_jobs_util).
+
+
+-export([
+    get_non_neg_int/2,
+    get_float_0_1/2,
+    get_timeout/2
+]).
+
+
+

Review comment:
       good find




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [couchdb] davisp commented on a change in pull request #3524: Add batching to couch jobs

Posted by GitBox <gi...@apache.org>.
davisp commented on a change in pull request #3524:
URL: https://github.com/apache/couchdb/pull/3524#discussion_r618706507



##########
File path: src/couch_jobs/src/couch_jobs_util.erl
##########
@@ -0,0 +1,59 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_jobs_util).
+
+
+-export([
+    get_non_neg_int/2,
+    get_float_0_1/2,
+    get_timeout/2
+]).
+
+
+

Review comment:
       Extra blank line.

##########
File path: src/fabric/src/fabric2_fdb.erl
##########
@@ -1186,18 +1186,27 @@ seq_to_vs(Seq) when is_binary(Seq) ->
 
 
 next_vs({versionstamp, VS, Batch, TxId}) ->
-    {V, B, T} = case TxId =< 65535 of
+    {V, B, T} = case TxId < 16#FFFF of

Review comment:
       Good use of the hex version there to make it more clear and show that I was off by one.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org