Find average time to complete certain tasks:
~~~~
function mean(arr) {
var i, sum = 0, len = arr.length;
for (i = 0; i < len; i++) {
sum += arr[i];
}
return sum / len;
}
mean(db.monq_task.find({state:'complete',
task_name:'allura.tasks.index_tasks.add_artifacts', _id: {$gt:
objectIdWithTimestamp(ISODate('2014-06-16')), $lt:
objectIdWithTimestamp(ISODate('2014-06-17'))} }, {time_start:1,
time_stop:1}).map(function(t) { return t.time_stop - t.time_start; }))
~~~~
Count tasks by state:
~~~~
q = { task_name:'allura.tasks.index_tasks.add_artifacts', _id: {$gt:
objectIdWithTimestamp(ISODate('2014-06-17T08:00'))} }
db.monq_task.distinct('state', q).forEach(function(t){ print(t,
db.monq_task.find({$and: [q, {state:t}]}).count()) })
~~~~
---
** [tickets:#3435] Analyze monq_task performance**
**Status:** invalid
**Milestone:** forge-sep-21
**Labels:** performance metrics
**Created:** Tue Dec 13, 2011 09:37 PM UTC by Dave Brondsema
**Last Updated:** Thu Nov 08, 2012 04:39 PM UTC
**Owner:** nobody
Determine and run some queries to check the monq_task collection to find causes
for slowness. Document the queries here in this ticket for future reference to
run again if needed.
Here are a few:
** in progress, and pending**
db.monq_task.find({state:'busy'}).count()
db.monq_task.find({state:'ready'}).count()
**raw quantity per day**
db.monq_task.find({time_queue: {$gt: ISODate("2011-12-13T00:00:00.000Z"),
$lt: ISODate("2011-12-14T00:00:00.000Z")}}).count()
** recent tasks that took over 5 minutes **
db.monq_task.find({'$where': "this.time_stop.getTime() -
this.time_start.getTime() > 5*60*1000", time_stop: {'$ne': null}, time_start:
{'$gt': ISODate("2011-12-10T00:00:00.000Z")}}).count()
** what is assigned to each process **
db.monq_task.find({'state':'busy', time_start: {$gt: new Date(Date.now() -
1000*60*60*48)}}, {process:1,task_name:1,time_start:1}).sort({'process':1})
** details of current process **
db.monq_task.find({'state':'busy', time_start: {$gt: new Date(Date.now() -
1000*60*60*3)}})
** check an individual process activity **
> sudo -u allura strace -p 6406
> kill -USR1 -p 6406 # need siteops to run; will print current task to
/var/log/allura/allura.log
** types of pending tasks **
db.monq_task.distinct('task_name', {'state':'ready'})
q = {'state':'ready'}
db.monq_task.distinct('task_name', q).forEach(function(t){ print(t,
db.monq_task.find({$and: [q, {task_name:t}]}).count()) })
---
Sent from sourceforge.net because [email protected] is subscribed to
https://sourceforge.net/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at
https://sourceforge.net/p/allura/admin/tickets/options. Or, if this is a
mailing list, you can unsubscribe from the mailing list.