Project

General

Profile

Bug #15201

using `foreman_tasks/api/tasks/show` takes 100-150msec per call

Added by Chris Duryee over 5 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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.

History

#1 Updated by Ivan Necas over 5 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.

#2 Updated by Chris Duryee about 5 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.

#3 Updated by Chris Duryee about 5 years ago

  • Bugzilla link set to 1372073

#4 Updated by Ivan Necas about 5 years ago

  • Target version set to 127

#5 Updated by Chris Duryee about 5 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).

#6 Updated by Ivan Necas about 5 years ago

  • Status changed from New to Assigned
  • Pull request https://github.com/Dynflow/dynflow/pull/200 added

#7 Updated by Ivan Necas about 5 years ago

  • Status changed from Assigned to Closed

Also available in: Atom PDF