<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/rubygems/request, branch v4.0.2</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/rubygems] Increase connection pool to allow for up to 70% speed increase:</title>
<updated>2025-12-04T06:47:46+00:00</updated>
<author>
<name>Edouard CHIN</name>
<email>chin.edouard@gmail.com</email>
</author>
<published>2025-11-16T23:18:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=932762f29457ad1def6fbab7eca7bcbeeb58ea5c'/>
<id>932762f29457ad1def6fbab7eca7bcbeeb58ea5c</id>
<content type='text'>
- ### TL;DR

  Bundler is heavily limited by the connection pool which manages a
  single connection. By increasing the number of connection, we can
  drastiscally speed up the installation process when many gems need
  to be downloaded and installed.

  ### Benchmark

  There are various factors that are hard to control such as
  compilation time and network speed but after dozens of tests I
  can consistently get aroud 70% speed increase when downloading and
  installing 472 gems, most having no native extensions (on purpose).

  ```
  # Before
  bundle install  28.60s user 12.70s system 179% cpu 23.014 total

  # After
  bundle install  30.09s user 15.90s system 281% cpu 16.317 total
  ```

  You can find on this gist how this was benchmarked and the Gemfile
  used https://gist.github.com/Edouard-chin/c8e39148c0cdf324dae827716fbe24a0

  ### Context

  A while ago in #869, Aaron introduced a connection pool which
  greatly improved Bundler speed. It was noted in the PR description
  that managing one connection was already good enough and it wasn't
  clear whether we needed more connections. Aaron also had the
  intuition that we may need to increase the pool for downloading
  gems and he was right.

  &gt; We need to study how RubyGems uses connections and make a decision
  &gt; based on request usage (e.g. only use one connection for many small
  &gt; requests like bundler API, and maybe many connections for
  &gt; downloading gems)

  When bundler downloads and installs gem in parallel https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/installer/parallel_installer.rb#L128
  most threads have to wait for the only connection in the pool to be
  available which is not efficient.

  ### Solution

  This commit modifies the pool size for the fetcher that Bundler
  uses. RubyGems fetcher will continue to use a single connection.

  The bundler fetcher is used in 2 places.

  1. When downloading gems https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/source/rubygems.rb#L481-L484
  2. When grabing the index (not the compact index) using the
    `bundle install --full-index` flag.
    https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/fetcher/index.rb#L9

  Having more connections in 2) is not any useful but tweaking the
  size based on where the fetcher is used is a bit tricky so I opted
  to modify it at the class level.
  I fiddle with the pool size and found that 5 seems to be the sweet
  spot at least for my environment.

https://github.com/ruby/rubygems/commit/6063fd9963
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- ### TL;DR

  Bundler is heavily limited by the connection pool which manages a
  single connection. By increasing the number of connection, we can
  drastiscally speed up the installation process when many gems need
  to be downloaded and installed.

  ### Benchmark

  There are various factors that are hard to control such as
  compilation time and network speed but after dozens of tests I
  can consistently get aroud 70% speed increase when downloading and
  installing 472 gems, most having no native extensions (on purpose).

  ```
  # Before
  bundle install  28.60s user 12.70s system 179% cpu 23.014 total

  # After
  bundle install  30.09s user 15.90s system 281% cpu 16.317 total
  ```

  You can find on this gist how this was benchmarked and the Gemfile
  used https://gist.github.com/Edouard-chin/c8e39148c0cdf324dae827716fbe24a0

  ### Context

  A while ago in #869, Aaron introduced a connection pool which
  greatly improved Bundler speed. It was noted in the PR description
  that managing one connection was already good enough and it wasn't
  clear whether we needed more connections. Aaron also had the
  intuition that we may need to increase the pool for downloading
  gems and he was right.

  &gt; We need to study how RubyGems uses connections and make a decision
  &gt; based on request usage (e.g. only use one connection for many small
  &gt; requests like bundler API, and maybe many connections for
  &gt; downloading gems)

  When bundler downloads and installs gem in parallel https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/installer/parallel_installer.rb#L128
  most threads have to wait for the only connection in the pool to be
  available which is not efficient.

  ### Solution

  This commit modifies the pool size for the fetcher that Bundler
  uses. RubyGems fetcher will continue to use a single connection.

  The bundler fetcher is used in 2 places.

  1. When downloading gems https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/source/rubygems.rb#L481-L484
  2. When grabing the index (not the compact index) using the
    `bundle install --full-index` flag.
    https://github.com/ruby/rubygems/blob/4f85e02fdd89ee28852722dfed42a13c9f5c9193/bundler/lib/bundler/fetcher/index.rb#L9

  Having more connections in 2) is not any useful but tweaking the
  size based on where the fetcher is used is a bit tricky so I opted
  to modify it at the class level.
  I fiddle with the pool size and found that 5 seems to be the sweet
  spot at least for my environment.

https://github.com/ruby/rubygems/commit/6063fd9963
</pre>
</div>
</content>
</entry>
<entry>
<title>[rubygems/rubygems] Vendor net-http and net-protocol in RubyGems</title>
<updated>2023-12-13T03:16:55+00:00</updated>
<author>
<name>David Rodríguez</name>
<email>deivid.rodriguez@riseup.net</email>
</author>
<published>2023-01-29T20:24:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ce924ce1fb029f19fd34a43f2012a485f4f62b53'/>
<id>ce924ce1fb029f19fd34a43f2012a485f4f62b53</id>
<content type='text'>
https://github.com/rubygems/rubygems/commit/99d91c9ed2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/rubygems/rubygems/commit/99d91c9ed2
</pre>
</div>
</content>
</entry>
<entry>
<title>util/rubocop -A --only Layout/EmptyLineAfterMagicComment</title>
<updated>2023-03-23T08:18:49+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2023-03-17T09:36:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f24a86d83f07f214e97aa98da190cda55092805f'/>
<id>f24a86d83f07f214e97aa98da190cda55092805f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/rubocop -A --only Style/SymbolProc</title>
<updated>2023-03-17T09:50:55+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2023-03-16T03:57:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5211900d37573a82c1bdf7cb2354937cc4022ae1'/>
<id>5211900d37573a82c1bdf7cb2354937cc4022ae1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>util/rubocop -A --only Performance/Casecmp</title>
<updated>2023-03-17T09:50:55+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2023-03-16T01:27:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b6d3c06936e5aaf94d72f22f0ecca5468146f07f'/>
<id>b6d3c06936e5aaf94d72f22f0ecca5468146f07f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge rubygems/bundler HEAD.</title>
<updated>2022-08-09T03:05:19+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2022-08-09T02:16:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=44264b4fee1e208e759710c39271186ff9856b40'/>
<id>44264b4fee1e208e759710c39271186ff9856b40</id>
<content type='text'>
  Pick from https://github.com/rubygems/rubygems/commit/dfbb5a38114640e0d8d616861607f3de73ee0199
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  Pick from https://github.com/rubygems/rubygems/commit/dfbb5a38114640e0d8d616861607f3de73ee0199
</pre>
</div>
</content>
</entry>
<entry>
<title>RubyGems: Enable Style/StringLiterals cop</title>
<updated>2022-07-22T03:07:23+00:00</updated>
<author>
<name>Takuya Noguchi</name>
<email>takninnovationresearch@gmail.com</email>
</author>
<published>2022-07-17T08:08:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d7ffd3fea402239b16833cc434404a7af82d44f3'/>
<id>d7ffd3fea402239b16833cc434404a7af82d44f3</id>
<content type='text'>
Signed-off-by: Takuya Noguchi &lt;takninnovationresearch@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Takuya Noguchi &lt;takninnovationresearch@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Sync RubyGems and Bundler with upstream</title>
<updated>2021-07-07T06:31:52+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2021-07-07T05:07:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c082c6eb7c786a432bea23cf78839f64585cb630'/>
<id>c082c6eb7c786a432bea23cf78839f64585cb630</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"</title>
<updated>2020-09-23T13:01:44+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2020-09-23T12:59:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b717f73402dc6f2d6ba6a1d72d9c8543a4f2cd27'/>
<id>b717f73402dc6f2d6ba6a1d72d9c8543a4f2cd27</id>
<content type='text'>
  31a6eaabc165d8a222e176f2c809d90622d88ec2 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  31a6eaabc165d8a222e176f2c809d90622d88ec2 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
</pre>
</div>
</content>
</entry>
<entry>
<title>Manually merged from https://github.com/rubygems/rubygems/pull/2636</title>
<updated>2020-09-23T12:02:56+00:00</updated>
<author>
<name>Hiroshi SHIBATA</name>
<email>hsbt@ruby-lang.org</email>
</author>
<published>2020-09-23T12:02:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=31a6eaabc165d8a222e176f2c809d90622d88ec2'/>
<id>31a6eaabc165d8a222e176f2c809d90622d88ec2</id>
<content type='text'>
  Enable Style/EmptyLinesAroundClassBody rubocop cop.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  Enable Style/EmptyLinesAroundClassBody rubocop cop.
</pre>
</div>
</content>
</entry>
</feed>
