Skip to content

Massive performance degragation 3.0 -> 3.0.2 #140

@mscrivo

Description

@mscrivo

After upgrading from 3.0 to 3.0.2, we notice crashes during startup in our test environment. The pods were using an order of magnitude more CPU on startup than before. Upon profiling, we saw this:

Time since start: 13s. Press Ctrl+C to stop.
Summary of profiling data so far:
% self  % total  name
 90.78    90.78  initialize [c function] - (unknown)
  1.55     1.55  initialize_pattern - /usr/local/lib/ruby/3.3.0/uri/rfc2396_parser.rb:493
  1.38    93.02  initialize_regexp - /usr/local/lib/ruby/3.3.0/uri/rfc2396_parser.rb:525
  1.03    99.31  new [c function] - (unknown)
  0.69     0.69  split [c function] - (unknown)
  0.60     0.86  each_value [c function] - (unknown)
  0.34    99.48  each [c function] - (unknown)
  0.34     0.34  freeze [c function] - (unknown)
  0.34     0.34  compile_file [c function] - (unknown)
  0.26    97.93  translate - /home/app/vendor/bundle/ruby/3.3.0/gems/mustermann-3.0.2/lib/mustermann/ast/translator.rb:117
  0.26    95.78  initialize - /usr/local/lib/ruby/3.3.0/uri/rfc2396_parser.rb:107
  0.17    97.93  t - /home/app/vendor/bundle/ruby/3.3.0/gems/mustermann-3.0.2/lib/mustermann/ast/translator.rb:43
  0.17    97.16  map [c function] - (unknown)
  0.17     0.17  sysread_nonblock [c function] - (unknown)
  0.17     0.17  select [c function] - (unknown)
  0.17     0.17  count_objects [c function] - (unknown)
  0.09    99.31  inject [c function] - (unknown)
  0.09    96.21  escape - /home/app/vendor/bundle/ruby/3.3.0/gems/mustermann-3.0.2/lib/mustermann/ast/translator.rb:124
  0.09     0.43  fetch [c function] - (unknown)
  0.09     0.17  each_byte [c function] - (unknown)

and this is what our CPU usage looked like before, after upgrade, and after reverting:
image

We don't use mustermann explicitly, just implicitly via usage of sinatra.

Some notes about our env:

Ruby 3.3.3 with YJIT enabled running in x64 docker image
latest Sinatra + Puma versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions