Bug #15201
closedusing `foreman_tasks/api/tasks/show` takes 100-150msec per call
Description
The foreman_tasks show.json.rabl template will display :progress, :input:, :output, :cli_example, and :humanized. However, rendering these will take 100-150msec. This can add up when many tasks are being shown.
There may be a couple of ways around this, one might be to create a base.json.rabl that excludes these, and other templates can use either base or show, depending on how much info they need.
Note that only the first use of one of these five will incur the time penalty. Subsequent calls to the other attributes will be much cheaper.
More info, including how to repro via rabl debug statements is in https://github.com/Katello/katello/pull/6072.
Updated by Ivan Necas almost 8 years ago
The first thing we need to know is what's the minimum data we need: I'm not sure we can make it significantly faster and yet preserver all the data we provide right now.
Updated by Chris Duryee over 7 years ago
I think this might be related to the following:
def self.steps_from_hash(step_ids, execution_plan_id, world)
step_ids.inject({}) do |hash, step_id|
step = world.persistence.load_step(execution_plan_id, step_id, world)
hash.update(step_id.to_i => step)
end
end
each iteration makes a SQL query, and while the individual queries are small, the total # of steps can add up.
Updated by Chris Duryee over 7 years ago
a different set of repro steps:
1. in terminal #1, foreman-rake console 2. in terminal #2, strace -tt -s999 -e trace=network -f -p <console pid> 2>&1 | grep 'SELECT \* FROM' 3. in terminal #1, run: ForemanTasks::Task.find('<id>').progress
in terminal 2, you should see a large number of sql statements. I am guessing this is the cause of the slow load time (typically 100-150 msec, but can be multiple seconds in some cases).
Updated by Ivan Necas over 7 years ago
- Status changed from New to Assigned
- Pull request https://github.com/Dynflow/dynflow/pull/200 added