I am having a problem where MineOS is very slow to load server details. When I select a server on the dashboard it sometimes takes several minutes to load.
I think the problem is partially because I setup my server with symlinks to save backups and archives on a separate hard drive as my boot SSD doesn’t have enough space for them. Because the HDD is much slower I think gathering the list of increments takes more time than expected.
I looked at the code, specifically the function get_page_data at line 1265 of server.js. My theory is that because this function waits for all async functions to evaluate before responding, it is limited by the speed of the slowest function.
Changing this function to
function get_page_data(page) {
switch (page) {
case 'glance':
logging.debug('[{0}] {1} requesting server at a glance info'.format(server_name, username));
async.parallel({
'increments': function(cb) {
cb(null,[])
},
'archives': function(cb) {
cb(null,[])
},
'du_awd': async.apply(instance.property, 'du_awd'),
'du_bwd': async.apply(instance.property, 'du_bwd'),
'du_cwd': async.apply(instance.property, 'du_cwd'),
'owner': async.apply(instance.property, 'owner'),
'server_files': async.apply(instance.property, 'server_files'),
'ftb_installer': async.apply(instance.property, 'FTBInstall.sh'),
'eula': async.apply(instance.property, 'eula'),
'base_dir': function(cb) {
cb(null, user_config.base_directory)
}
}, function(err, results) {
if (err instanceof Object)
logging.error('[{0}] Error with get_page_data'.format(server_name), err, results);
nsp.emit('page_data', {page: page, payload: results});
})
break;
default:
nsp.emit('page_data', {page: page});
break;
}
}
disables the increments and backups listing but reduces the response time from 3 minutes to 3 seconds. This seems to prove my theory.
To me the solution seems to be to split the list increments and list archives functions into their own socket requests. I am eager to hear your thoughts on this. If you want I can prototype this and submit a pull request but I am not that familiar with this codebase.