Uploaded image for project: 'Puppet Agent'
  1. Puppet Agent
  2. PA-3744

Build ruby without site_ruby

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Enhancement
    • Release Notes Summary:
      Reduces the amount of file IO and time needed to load puppet, especially on Windows where puppet loads 33% faster.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Our compiled ruby's default LOAD_PATH contains:

      # /opt/puppetlabs/puppet/bin/ruby -e 'require "pp"; pp $:'
      ["/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.7.0",
       "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.7.0/x86_64-linux",
       "/opt/puppetlabs/puppet/lib/ruby/site_ruby",
       "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/2.7.0",
       "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/2.7.0/x86_64-linux",
       "/opt/puppetlabs/puppet/lib/ruby/vendor_ruby",
       "/opt/puppetlabs/puppet/lib/ruby/2.7.0",
       "/opt/puppetlabs/puppet/lib/ruby/2.7.0/x86_64-linux"]
      

      On Windows:

      C:\>ruby -e "require 'pp'; pp $LOAD_PATH"
      ["C:/Program Files/Puppet Labs/Puppet/puppet/lib",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/site_ruby/2.7.0",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/site_ruby/2.7.0/x64-msvcrt",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/site_ruby",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/2.7.0",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby/2.7.0/x64-msvcrt",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/vendor_ruby",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/2.7.0",
       "C:/Program Files/Puppet Labs/Puppet/puppet/lib/ruby/2.7.0/x64-mingw32"]
      

      As a result the site_ruby directories are scanned first, but are never used. This results in many thousands of failed stat/lstats since we never put anything in those directories:

      # strace -f -e trace=file puppet --version 2>&1 > /dev/null | grep site_ruby | wc -l
      2277
      

      On Windows, it results in 2766 calls out of 37257 total.

      Perhaps we should compile ruby with --with-sitedir=no.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              josh Josh Cooper
              Reporter:
              josh Josh Cooper
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support