1
0
Fork 0

Removed Foxx queue exports warmup workaround.

This commit is contained in:
Alan Plum 2015-06-16 15:59:26 +02:00
parent 9b708b67e4
commit 1210ee8858
8 changed files with 123 additions and 190 deletions

View File

@ -537,16 +537,6 @@ v2.6.0 (XXXX-XX-XX)
up and checking the queues more frequently, which may increase CPU usage of the server.
When not using Foxx queues, this value can be raised to save some CPU time.
* added startup option `--server.foxx-queues-warmup-exports`
This startup option makes sure the exports of all installed Foxx apps are pre-loaded when
the server is restarted. This prevents a known issue with function-based Foxx queue job types.
It is recommended that you upgrade any existing function-based job types to script-based ones
to avoid the issue entirely.
The default value is `true`. Disabling this feature can reduce memory usage and startup time
but may cause issues with function-based job types.
* added startup option `--server.foxx-queues`
This startup option controls whether the Foxx queue manager will check queue and job entries.

View File

@ -322,11 +322,3 @@ http://jsteemann.github.io/blog/2015/04/14/updating-documents-with-arangoimp/
will lead to the queue manager having to check only the queues collection of a single database,
whereas making it check the queues of all databases might result in more work to be done and
more CPU time to be used by the queue manager.
* added startup option `--server.foxx-queues-warmup-exports`
This startup option makes sure the exports of all installed Foxx apps are pre-loaded when
the server is restarted. This prevents a known issue with function-based Foxx queue job types.
It is recommended that you upgrade any existing function-based job types to script-based ones
to avoid the issue entirely.

View File

@ -339,7 +339,6 @@ ArangoServer::ArangoServer (int argc, char** argv)
_disableReplicationApplier(false),
_disableQueryTracking(false),
_foxxQueues(true),
_foxxQueuesWarmupExports(true),
_foxxQueuesPollInterval(1.0),
_server(nullptr),
_queryRegistry(nullptr),
@ -618,7 +617,6 @@ void ArangoServer::buildApplicationServer () {
("server.allow-use-database", &ALLOW_USE_DATABASE_IN_REST_ACTIONS, "allow change of database in REST actions, only needed for unittests")
("server.threads", &_dispatcherThreads, "number of threads for basic operations")
("server.foxx-queues", &_foxxQueues, "enable Foxx queues")
("server.foxx-queues-warmup-exports", &_foxxQueuesWarmupExports, "enable pre-loading of Foxx exports for Foxx queues")
("server.foxx-queues-poll-interval", &_foxxQueuesPollInterval, "Foxx queue manager poll interval (in seconds)")
("server.session-timeout", &VocbaseContext::ServerSessionTtl, "timeout of web interface server sessions (in seconds)")
;

View File

@ -534,20 +534,6 @@ namespace triagens {
bool _foxxQueues;
////////////////////////////////////////////////////////////////////////////////
/// @brief enable or disable the Foxx exports warmup for queues
/// @startDocuBlock queuesWarmupExports
/// `--server.foxx-queues-warmup-exports flag`
///
/// If *true*, the exports of all Foxx apps will be loaded on server start.
///
/// The default is *true*. Disabling this will cause issues with function-based
/// job types of jobs persisted throughout a server restart.
/// @endDocuBlock
////////////////////////////////////////////////////////////////////////////////
bool _foxxQueuesWarmupExports;
////////////////////////////////////////////////////////////////////////////////
/// @brief poll interval for Foxx queues
/// @startDocuBlock foxxQueuesPollInterval

View File

@ -1341,16 +1341,6 @@ function reloadRouting () {
foxxManager._resetCache();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief warms up the Foxx exports
////////////////////////////////////////////////////////////////////////////////
function warmupExports () {
'use strict';
foxxManager._warmupExports();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief loads all actions
////////////////////////////////////////////////////////////////////////////////
@ -2274,7 +2264,6 @@ exports.getErrorMessage = getErrorMessage;
exports.getJsonBody = getJsonBody;
exports.errorFunction = errorFunction;
exports.reloadRouting = reloadRouting;
exports.warmupExports = warmupExports;
exports.firstRouting = firstRouting;
exports.nextRouting = nextRouting;
exports.addCookie = addCookie;

View File

@ -1462,21 +1462,6 @@ var requireApp = function(mount) {
return exportApp(app);
};
var warmupExports = function () {
var cursor = utils.getStorage().all();
while (cursor.hasNext()) {
var config = cursor.next();
try {
requireApp(config.mount);
} catch(e) {}
}
};
var warmupAllExports = function() {
executeGlobalContextFunction("warmupExports");
actions.warmupExports();
};
////////////////////////////////////////////////////////////////////////////////
/// @brief Syncs the apps in ArangoDB with the applications stored on disc
////////////////////////////////////////////////////////////////////////////////
@ -1529,8 +1514,6 @@ exports.configuration = configuration;
exports.dependencies = dependencies;
exports.requireApp = requireApp;
exports._resetCache = resetCache;
exports._warmupExports = warmupExports;
exports._warmupAllExports = warmupAllExports;
////////////////////////////////////////////////////////////////////////////////
/// @brief Serverside only API

View File

@ -140,12 +140,6 @@ exports.run = function () {
return;
}
// warmup exports
// TODO remove this feature along with function-based job types in 2.7
if (options['server.foxx-queues-warmup-exports'] !== false) {
require('org/arangodb/foxx/manager')._warmupAllExports();
}
// wakeup/poll interval for Foxx queues
var period = 1;
if (options.hasOwnProperty('server.foxx-queues-poll-interval')) {

View File

@ -1633,135 +1633,136 @@ testFuncs.foxx_manager = function (options) {
return results;
};
testFuncs.queue_legacy = function (options) {
if (options.skipFoxQueues) {
print("skipping test of legacy queue job types");
return {};
}
var startTime;
var queueAppMountPath = '/test-queue-legacy';
print("Testing legacy queue job types");
var instanceInfo = startInstance("tcp", options, [], "queue_legacy");
if (instanceInfo === false) {
return {status: false, message: "failed to start server!"};
}
var data = {
naive: {_key: 'potato', hello: 'world'},
forced: {_key: 'tomato', hello: 'world'},
plain: {_key: 'banana', hello: 'world'}
};
var results = {};
results.install = runArangoshCmd(options, instanceInfo, {
"configuration": "etc/relative/foxx-manager.conf"
}, [
"install",
"js/common/test-data/apps/queue-legacy-test",
queueAppMountPath
]);
// TODO write test for 2.6-style queues
// testFuncs.queue_legacy = function (options) {
// if (options.skipFoxQueues) {
// print("skipping test of legacy queue job types");
// return {};
// }
// var startTime;
// var queueAppMountPath = '/test-queue-legacy';
// print("Testing legacy queue job types");
// var instanceInfo = startInstance("tcp", options, [], "queue_legacy");
// if (instanceInfo === false) {
// return {status: false, message: "failed to start server!"};
// }
// var data = {
// naive: {_key: 'potato', hello: 'world'},
// forced: {_key: 'tomato', hello: 'world'},
// plain: {_key: 'banana', hello: 'world'}
// };
// var results = {};
// results.install = runArangoshCmd(options, instanceInfo, {
// "configuration": "etc/relative/foxx-manager.conf"
// }, [
// "install",
// "js/common/test-data/apps/queue-legacy-test",
// queueAppMountPath
// ]);
print("Restarting without foxx-queues-warmup-exports...");
shutdownInstance(instanceInfo, options);
instanceInfo = startInstance("tcp", options, {
"server.foxx-queues-warmup-exports": "false"
}, "queue_legacy", instanceInfo.flatTmpDataDir);
if (instanceInfo === false) {
return {status: false, message: "failed to restart server!"};
}
print("done.");
// print("Restarting without foxx-queues-warmup-exports...");
// shutdownInstance(instanceInfo, options);
// instanceInfo = startInstance("tcp", options, {
// "server.foxx-queues-warmup-exports": "false"
// }, "queue_legacy", instanceInfo.flatTmpDataDir);
// if (instanceInfo === false) {
// return {status: false, message: "failed to restart server!"};
// }
// print("done.");
var res, body;
startTime = time();
try {
res = download(
instanceInfo.url + queueAppMountPath + '/',
JSON.stringify(data.naive),
{method: 'POST'}
);
body = JSON.parse(res.body);
results.naive = {status: body.success === false, message: JSON.stringify({body: res.body, code: res.code})};
} catch (e) {
results.naive = {status: true, message: JSON.stringify({body: res.body, code: res.code})};
}
results.naive.duration = time() - startTime;
// var res, body;
// startTime = time();
// try {
// res = download(
// instanceInfo.url + queueAppMountPath + '/',
// JSON.stringify(data.naive),
// {method: 'POST'}
// );
// body = JSON.parse(res.body);
// results.naive = {status: body.success === false, message: JSON.stringify({body: res.body, code: res.code})};
// } catch (e) {
// results.naive = {status: true, message: JSON.stringify({body: res.body, code: res.code})};
// }
// results.naive.duration = time() - startTime;
startTime = time();
try {
res = download(
instanceInfo.url + queueAppMountPath + '/?allowUnknown=true',
JSON.stringify(data.forced),
{method: 'POST'}
);
body = JSON.parse(res.body);
results.forced = (
body.success
? {status: true}
: {status: false, message: body.error, stacktrace: body.stacktrace}
);
} catch (e) {
results.forced = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
}
results.forced.duration = time() - startTime;
// startTime = time();
// try {
// res = download(
// instanceInfo.url + queueAppMountPath + '/?allowUnknown=true',
// JSON.stringify(data.forced),
// {method: 'POST'}
// );
// body = JSON.parse(res.body);
// results.forced = (
// body.success
// ? {status: true}
// : {status: false, message: body.error, stacktrace: body.stacktrace}
// );
// } catch (e) {
// results.forced = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
// }
// results.forced.duration = time() - startTime;
print("Restarting with foxx-queues-warmup-exports...");
shutdownInstance(instanceInfo, options);
instanceInfo = startInstance("tcp", options, {
"server.foxx-queues-warmup-exports": "true"
}, "queue_legacy", instanceInfo.flatTmpDataDir);
if (instanceInfo === false) {
return {status: false, message: "failed to restart server!"};
}
print("done.");
// print("Restarting with foxx-queues-warmup-exports...");
// shutdownInstance(instanceInfo, options);
// instanceInfo = startInstance("tcp", options, {
// "server.foxx-queues-warmup-exports": "true"
// }, "queue_legacy", instanceInfo.flatTmpDataDir);
// if (instanceInfo === false) {
// return {status: false, message: "failed to restart server!"};
// }
// print("done.");
startTime = time();
try {
res = download(instanceInfo.url + queueAppMountPath + '/', JSON.stringify(data.plain), {method: 'POST'});
body = JSON.parse(res.body);
results.plain = (
body.success
? {status: true}
: {status: false, message: JSON.stringify({body: res.body, code: res.code})}
);
} catch (e) {
results.plain = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
}
results.plain.duration = time() - startTime;
// startTime = time();
// try {
// res = download(instanceInfo.url + queueAppMountPath + '/', JSON.stringify(data.plain), {method: 'POST'});
// body = JSON.parse(res.body);
// results.plain = (
// body.success
// ? {status: true}
// : {status: false, message: JSON.stringify({body: res.body, code: res.code})}
// );
// } catch (e) {
// results.plain = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
// }
// results.plain.duration = time() - startTime;
startTime = time();
try {
for (var i = 0; i < 60; i++) {
wait(1);
res = download(instanceInfo.url + queueAppMountPath + '/');
body = JSON.parse(res.body);
if (body.length === 2) {
break;
}
}
results.final = (
body.length === 2 && body[0]._key === data.forced._key && body[1]._key === data.plain._key
? {status: true}
: {status: false, message: JSON.stringify({body: res.body, code: res.code})}
);
} catch (e) {
results.final = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
}
results.final.duration = time() - startTime;
// startTime = time();
// try {
// for (var i = 0; i < 60; i++) {
// wait(1);
// res = download(instanceInfo.url + queueAppMountPath + '/');
// body = JSON.parse(res.body);
// if (body.length === 2) {
// break;
// }
// }
// results.final = (
// body.length === 2 && body[0]._key === data.forced._key && body[1]._key === data.plain._key
// ? {status: true}
// : {status: false, message: JSON.stringify({body: res.body, code: res.code})}
// );
// } catch (e) {
// results.final = {status: false, message: JSON.stringify({body: res.body, code: res.code})};
// }
// results.final.duration = time() - startTime;
results.uninstall = runArangoshCmd(options, instanceInfo, {
"configuration": "etc/relative/foxx-manager.conf"
}, [
"uninstall",
queueAppMountPath
]);
print("Shutting down...");
shutdownInstance(instanceInfo, options);
print("done.");
if ((!options.skipLogAnalysis) &&
instanceInfo.hasOwnProperty('importantLogLines') &&
Object.keys(instanceInfo.importantLogLines).length > 0) {
print("Found messages in the server logs: \n" + yaml.safeDump(instanceInfo.importantLogLines));
}
return results;
};
// results.uninstall = runArangoshCmd(options, instanceInfo, {
// "configuration": "etc/relative/foxx-manager.conf"
// }, [
// "uninstall",
// queueAppMountPath
// ]);
// print("Shutting down...");
// shutdownInstance(instanceInfo, options);
// print("done.");
// if ((!options.skipLogAnalysis) &&
// instanceInfo.hasOwnProperty('importantLogLines') &&
// Object.keys(instanceInfo.importantLogLines).length > 0) {
// print("Found messages in the server logs: \n" + yaml.safeDump(instanceInfo.importantLogLines));
// }
// return results;
// };
testFuncs.dump = function (options) {
var cluster;