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

grpc takes a long time to install #2256

Closed
chrisseaton opened this issue Feb 10, 2021 · 6 comments
Closed

grpc takes a long time to install #2256

chrisseaton opened this issue Feb 10, 2021 · 6 comments
Labels
performance third-party-issue An issue which should be fixed upstream

Comments

@chrisseaton
Copy link
Collaborator

I think @eregon already identified some issues with it? Most of the time seems to be spent in ld doing LTO.

@eregon
Copy link
Member

eregon commented Feb 10, 2021

Is that with grpc/grpc#24632 or without?
If it's without, nothing we can do except asking the grpc maintainers to merge it.
If it's with it, can you time it? It's slow but I wouldn't say a lifetime.

Related issue: #2247

@chrisseaton
Copy link
Collaborator Author

For me installing the current release of grpc and dependencies without the patch takes up to 830s.

% time -p tool/jt.rb --use jvm ruby -Sgem install grpc 
Using Interpreted TruffleRuby: mxbuild/truffleruby-jvm
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-jvm/languages/ruby/bin/truffleruby \
  --experimental-options \
  --core-load-path=/Users/chrisseaton/src/github.com/Shopify/truffleruby/src/main/ruby/truffleruby \
  -Sgem \
  install \
  grpc
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Fetching grpc-1.35.0.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.35.0
3 gems installed
real       572.56
user      2738.71
sys        321.68

% time -p tool/jt.rb --use jvm-ce ruby -Sgem install grpc
Using TruffleRuby with Graal: mxbuild/truffleruby-jvm-ce
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-jvm-ce/languages/ruby/bin/truffleruby \
  --experimental-options \
  --core-load-path=/Users/chrisseaton/src/github.com/Shopify/truffleruby/src/main/ruby/truffleruby \
  -Sgem \
  install \
  grpc
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Fetching grpc-1.35.0.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.35.0
3 gems installed
real       830.87
user      5757.26
sys        438.94

% time -p tool/jt.rb --use native ruby -Sgem install grpc
Using Native TruffleRuby with Graal: mxbuild/truffleruby-native
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-native/languages/ruby/bin/truffleruby -Sgem install grpc
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Fetching grpc-1.35.0.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.35.0
3 gems installed
real       485.20
user      2354.97
sys        254.74

I'll try grpc/grpc#24632 next.

@eregon
Copy link
Member

eregon commented Feb 11, 2021

Can you also compare to CRuby to have a baseline, when compiling from source with:

time gem install --platform ruby grpc

@chrisseaton
Copy link
Collaborator Author

% ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
chrisseaton@Chris-Seatons-MacBook-Pro truffleruby % time -p gem install --platform ruby grpc
Fetching grpc-1.35.0.gem
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.35.0
Parsing documentation for google-protobuf-3.14.0
Installing ri documentation for google-protobuf-3.14.0
Parsing documentation for googleapis-common-protos-types-1.0.6
Installing ri documentation for googleapis-common-protos-types-1.0.6
Parsing documentation for grpc-1.35.0
Installing ri documentation for grpc-1.35.0
Done installing documentation for google-protobuf, googleapis-common-protos-types, grpc after 6 seconds
3 gems installed
real       243.45
user      1748.60
sys        186.62

Ah so it's normally installed as a binary, and the source version is still slow for MRI. I see it hard-codes -flto. Still 2x slower on TruffleRuby but maybe that's not so crazy.

@chrisseaton
Copy link
Collaborator Author

With the patch. So the patch and --env native (which is really just there for the toolchain launchers I think) solves it.

% time -p gem install grpc/pkg/grpc-1.36.0.dev.gem 
Fetching google-protobuf-3.14.0-universal-darwin.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Successfully installed google-protobuf-3.14.0-universal-darwin
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.36.0.dev
Parsing documentation for google-protobuf-3.14.0-universal-darwin
Installing ri documentation for google-protobuf-3.14.0-universal-darwin
Parsing documentation for googleapis-common-protos-types-1.0.6
Installing ri documentation for googleapis-common-protos-types-1.0.6
Parsing documentation for grpc-1.36.0.dev
Installing ri documentation for grpc-1.36.0.dev
Done installing documentation for google-protobuf, googleapis-common-protos-types, grpc after 6 seconds
3 gems installed
real       231.67
user      1780.94
sys        199.83

% time -p tool/jt.rb --use jvm ruby -Sgem install grpc/pkg/grpc-1.36.0.dev.gem
Using Interpreted TruffleRuby: mxbuild/truffleruby-jvm
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-jvm/languages/ruby/bin/truffleruby \
  --experimental-options \
  --core-load-path=/Users/chrisseaton/src/github.com/Shopify/truffleruby/src/main/ruby/truffleruby \
  -Sgem \
  install \
  grpc/pkg/grpc-1.36.0.dev.gem
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.36.0.dev
3 gems installed
real       349.83
user      1438.11
sys        166.93

% time -p tool/jt.rb --use jvm-ce ruby -Sgem install grpc/pkg/grpc-1.36.0.dev.gem
Using TruffleRuby with Graal: mxbuild/truffleruby-jvm-ce
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-jvm-ce/languages/ruby/bin/truffleruby \
  --experimental-options \
  --core-load-path=/Users/chrisseaton/src/github.com/Shopify/truffleruby/src/main/ruby/truffleruby \
  -Sgem \
  install \
  grpc/pkg/grpc-1.36.0.dev.gem
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.36.0.dev
3 gems installed
real       495.36
user      3133.19
sys        239.54

% time -p tool/jt.rb --use native ruby -Sgem install grpc/pkg/grpc-1.36.0.dev.gem
Using Native TruffleRuby with Graal: mxbuild/truffleruby-native
$ /Users/chrisseaton/src/github.com/Shopify/truffleruby/mxbuild/truffleruby-native/languages/ruby/bin/truffleruby -Sgem install grpc/pkg/grpc-1.36.0.dev.gem
Fetching google-protobuf-3.14.0.gem
Fetching googleapis-common-protos-types-1.0.6.gem
Building native extensions. This could take a while...
Successfully installed google-protobuf-3.14.0
Successfully installed googleapis-common-protos-types-1.0.6
Building native extensions. This could take a while...
Successfully installed grpc-1.36.0.dev
3 gems installed
real       263.52
user      1074.21
sys        103.97

@eregon eregon added the third-party-issue An issue which should be fixed upstream label Feb 12, 2021
@eregon
Copy link
Member

eregon commented Feb 12, 2021

Right, so 263s vs 231s seems quite close.
Could you comment on grpc/grpc#24632? Maybe that helps to move it forward.
I think we can close this, we already have a solution, but it depends on upstream merging it.

@eregon eregon closed this as completed Feb 12, 2021
@eregon eregon changed the title grpc takes a lifetime to install grpc takes a long time to install Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance third-party-issue An issue which should be fixed upstream
Projects
None yet
Development

No branches or pull requests

2 participants