How to measure a Rubygems mirror?

Skip to first unread message

Erick Guan

Mar 17, 2016, 12:53:08 PM3/17/16
to ruby-bundler
TL;DR It's complicated to understand how bundler and rubygems operates to fetch a gem. How to measure a Rubygems mirror?

Recently, Ruby China starts to operate a new RubyGems mirror to replace Taobao Rubygems mirror under community's control.
As a production deployment rubygems mirror for Chinese, availability is critical.

Because it's quite new and new CDN structure cause a lot of troubles. I observed many different failures when deploy Discourse.
I come up with a idea to build several pollers in different location to monitor mirror availability. But I know Bundler and Rubygems
do a lot of heavy lifting under the hood. Basically, it's hard to find the hook point to do the measurement.

I think collecting exception is not a bad way to understand the faulty situation. While using a public Rubygems mirror requires
changing gem sources and bundler mirror config, `gem update bundler` can fail as well as bundle install.

Several possible errors during deployment:

- CA certificates can be missing in the machine which may cause certificate validation error (mostly in Windows)
- Various of fetcher errors or dependency API errors related to certificate error, but may be the problems in reversed proxy
on mirror server
- Slow http server (not a error but speed is also a concern)

Therefore, I decided several metrics:

- `curl -I` to measure the chance of gem update error
- Collecting different exceptions and ratios based on the number of trying (bundle install) to measure availability
- Time to measure performance.

I may be terribility wrong since I don't know how `specs.4.8.gz` file works and what's the different steps in bundle install that I didn't 
see dependency API debug messages when using official Rubygems site. But let me hope I am doing the right thing.
Therefore, I want to know if anything is missing or what's possible to improve the measurements.
Reply all
Reply to author
0 new messages