Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [DEBUG] CONTAINER_INFLATE_FACTOR env var to duplicate most entities #14608

Closed
wants to merge 2 commits into from

Conversation

cben
Copy link
Contributor

@cben cben commented Apr 2, 2017

@miq-bot add-label providers/containers, performance, wip

This is silly and incomplete but already useful to stress container refresh performance.
Plus more logging (TODO: separate PR with logging)

Usage:

env CONTAINER_INFLATE_FACTOR=100 bundle exec rspec ./spec/models/manageiq/providers/openshift/container_manager/refresher_spec.rb:40

Currently fails on wrong @container_build_pod.container_build but never mind.

  • [untested] Should also work refreshing a live environment.
    Be ready to reset your DB, especially if you vary CONTAINER_INFLATE_FACTOR...

  • TODO: does not inflate nodes & images.

Trying to understand what the customer may be hitting in https://bugzilla.redhat.com/show_bug.cgi?id=1436176. However, they have huge number of images, which this does not inflate :-(

First findings

https://gist.github.com/cben/4b8404346f42c917fd1aead993db895e

  • speed becomes especially abysmal when it goes into swap.
    E.g. CONTAINER_INFLATE_FACTOR=1000 sends my 12G laptop deep into swap...

using https://github.com/jvns/ruby-stacktrace to spy on the ruby stack:

-parsing:

  • during parser, I see 60~90% time in OpenStruct new_ostruct_member. It seems that if Kubeclient left things as hashes and our parser accessed foo[:bar] or foo["bar"] instead of foo.bar, we could gain a lot.

  • parser is not main bottleneck.

  • container_groups is ~30% of total parsing time - OK, container_templates is ~50% - surprising!

  • I'd expect RAM usage to reach approximate peak during parsing, but I do see significant increase later while saving. TODO: study. (especially plausible with one huge table — like images in customer's case)

  • saving:

@miq-bot
Copy link
Member

miq-bot commented Apr 2, 2017

Some comments on commits cben/manageiq@29786af~...2bcff0b

app/models/ems_refresh/save_inventory_container.rb

  • ⚠️ - 13 - Detected puts. Remove all debugging statements.

app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb

  • ⚠️ - 10 - Detected puts. Remove all debugging statements.

app/models/manageiq/providers/openshift/container_manager/refresher.rb

  • 💣 💥 🔥 🚒 - 62 - Detected byebug. Remove all debugging statements.
  • 💣 💥 🔥 🚒 - 65 - Detected byebug. Remove all debugging statements.
  • ⚠️ - 40 - Detected puts. Remove all debugging statements.
  • ⚠️ - 72 - Detected puts. Remove all debugging statements.

@miq-bot
Copy link
Member

miq-bot commented Apr 2, 2017

Checked commits cben/manageiq@29786af~...2bcff0b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 8 offenses detected

app/models/ems_refresh/save_inventory_container.rb

  • ❗ - Line 13, Col 7 - Rails/Output - Do not write to stdout. Use Rails's logger if you want to log.

app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb

app/models/manageiq/providers/openshift/container_manager/refresher.rb

@miq-bot
Copy link
Member

miq-bot commented Apr 5, 2017

This pull request is not mergeable. Please rebase and repush.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants