[MediaWiki-commits] [Gerrit] Document the expected behaviour for the timeouts - change (mediawiki...parsoid)

2014-11-06 Thread Arlolra (Code Review)
Arlolra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/171638

Change subject: Document the expected behaviour for the timeouts
..

Document the expected behaviour for the timeouts

Change-Id: I98145179a3828f0606167f88e392d377635609cf
---
M api/routes.js
1 file changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/38/171638/1

diff --git a/api/routes.js b/api/routes.js
index 4c2f35f..f9edd4f 100644
--- a/api/routes.js
+++ b/api/routes.js
@@ -33,7 +33,24 @@
 var routes = {};
 
 
-// Helpers
+/**
+ * Timeouts
+ *
+ * The request timeout is a simple node timer that should fire first and catch
+ * most cases where we have long running requests to optimize.
+ *
+ * The CPU timeout handles the case where a child process is starved in a CPU
+ * bound task for too long and doesn't give node a chance to fire the above
+ * timer. At the beginning of each request, the child sends a message to the
+ * cluster master containing a request id. If the master doesn't get a second
+ * message from the child with the corresponding id by by CPU_TIMEOUT, it will
+ * send the SIGKILL signal to the child process.
+ *
+ * The above is susceptible false positives. Node spins one event loop, so
+ * multiple asynchronous requests will interfere with each others' timing.
+ *
+ * The CPU timeout is set to match the Varnish request timeout at 5 minutes.
+ */
 
 // Should be less than the CPU_TIMEOUT
 var REQ_TIMEOUT = 4 * 60 * 1000;  // 4 minutes
@@ -74,6 +91,8 @@
});
 };
 
+// Helpers
+
 var promiseTemplateReq = function( env, target, oldid ) {
return new Promise(function( resolve, reject ) {
var tpr = new TemplateRequest( env, target, oldid );

-- 
To view, visit https://gerrit.wikimedia.org/r/171638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98145179a3828f0606167f88e392d377635609cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra abrea...@wikimedia.org

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Document the expected behaviour for the timeouts - change (mediawiki...parsoid)

2014-11-06 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Document the expected behaviour for the timeouts
..


Document the expected behaviour for the timeouts

Change-Id: I98145179a3828f0606167f88e392d377635609cf
---
M api/routes.js
1 file changed, 20 insertions(+), 1 deletion(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/routes.js b/api/routes.js
index 911ddf6..f9e6911 100644
--- a/api/routes.js
+++ b/api/routes.js
@@ -33,7 +33,24 @@
 var routes = {};
 
 
-// Helpers
+/**
+ * Timeouts
+ *
+ * The request timeout is a simple node timer that should fire first and catch
+ * most cases where we have long running requests to optimize.
+ *
+ * The CPU timeout handles the case where a child process is starved in a CPU
+ * bound task for too long and doesn't give node a chance to fire the above
+ * timer. At the beginning of each request, the child sends a message to the
+ * cluster master containing a request id. If the master doesn't get a second
+ * message from the child with the corresponding id by CPU_TIMEOUT, it will
+ * send the SIGKILL signal to the child process.
+ *
+ * The above is susceptible false positives. Node spins one event loop, so
+ * multiple asynchronous requests will interfere with each others' timing.
+ *
+ * The CPU timeout is set to match the Varnish request timeout at 5 minutes.
+ */
 
 // Should be less than the CPU_TIMEOUT
 var REQ_TIMEOUT = 4 * 60 * 1000;  // 4 minutes
@@ -70,6 +87,8 @@
});
 };
 
+// Helpers
+
 var promiseTemplateReq = function( env, target, oldid ) {
return new Promise(function( resolve, reject ) {
var tpr = new TemplateRequest( env, target, oldid );

-- 
To view, visit https://gerrit.wikimedia.org/r/171638
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I98145179a3828f0606167f88e392d377635609cf
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra abrea...@wikimedia.org
Gerrit-Reviewer: Cscott canan...@wikimedia.org
Gerrit-Reviewer: Marcoil marc...@wikimedia.org
Gerrit-Reviewer: Subramanya Sastry ssas...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits