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

[POC] [MiqDefaults] Remove ActiveSupport dep #21077

Closed

Conversation

NickLaMuro
Copy link
Member

@NickLaMuro NickLaMuro commented Feb 23, 2021

Note: Made this a "POC", since a) that is what it is, but b) I haven't validated it at all aside from the local tests on my work machine (shown below), so I think testing this in a container to see if we have an appreciable difference is worth considering.

This is a slow class to load, so just removing this class allow shaves off 4x of the slowness, for something that is just about as clean without it:

$ time ruby lib/workers/bin/heartbeat_check.rb

real    0m0.097s
user    0m0.070s
sys     0m0.021s
$ time ruby lib/workers/bin/heartbeat_check.rb

real    0m0.399s
user    0m0.270s
sys     0m0.124s

It is even faster if you run ruby with --disable-gems:

$ time ruby --disable-gems lib/workers/bin/heartbeat_check.rb

real    0m0.028s
user    0m0.016s
sys     0m0.008s

Links

This is a slow class to load, so just removing this class allow shaves
off 4x of the slowness, for something that is just about as clean
without it:

  $ time ruby lib/workers/bin/heartbeat_check.rb

  real    0m0.097s
  user    0m0.070s
  sys     0m0.021s
  $ time ruby lib/workers/bin/heartbeat_check.rb

  real    0m0.399s
  user    0m0.270s
  sys     0m0.124s

It is even faster if you run `ruby` with `--disable-gems`:

  $ time ruby --disable-gems lib/workers/bin/heartbeat_check.rb

  real    0m0.028s
  user    0m0.016s
  sys     0m0.008s
@chessbyte chessbyte requested a review from jrafanie February 23, 2021 21:35
@NickLaMuro NickLaMuro changed the title [MiqDefaults] Remove ActiveSupport dep [POC] [MiqDefaults] Remove ActiveSupport dep Feb 23, 2021
@miq-bot
Copy link
Member

miq-bot commented Feb 23, 2021

Checked commit NickLaMuro@bd2da27 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. ⭐

@jrafanie
Copy link
Member

@NickLaMuro wow, yeah, @Fryguy suggested similar things... it definitely helps... I'm trying a poc doing it in shell since it seems like we're really not using much of the options here and if it's much faster and can avoid the time parsing, it might be worth it.

@jrafanie
Copy link
Member

Basically, dropping container_env saves around 200-300ms in (from about 1.2/1.3 baseline)
Dropping activesupport saves another 100ms.
using disable gems saves ~50 ms... it's really hard to measure small improvements in pods since performance is very inconsistent.

Dropping English is negligble.

@NickLaMuro
Copy link
Member Author

NickLaMuro commented Feb 23, 2021

@jrafanie do you have a baseline in said container you can give for the following?

(these times are from my local machine)

$ time python3 -c ""

real    0m0.031s
user    0m0.014s
sys     0m0.011s
$ time ruby -e ""

real    0m0.091s
user    0m0.064s
sys     0m0.020s
$ time ruby --disable-gems -e ""

real    0m0.019s
user    0m0.009s
sys     0m0.007s
$ time /bin/bash -c ""

real    0m0.006s
user    0m0.001s
sys     0m0.003s

I am curious if there is just a generic "container penalty" we are getting that is contributing to the times here. If /bin/bash for example executes at 500ms on your container, I would say we have a .5 second penalty we can never get around.

@NickLaMuro NickLaMuro closed this Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants