Skip to content

Reduce Grpc.Core nuget size by generating separate .so with/without debug symbols for grpc_csharp_ext#25729

Merged
jtattermusch merged 4 commits intogrpc:masterfrom
jtattermusch:csharp_separate_linux_debugsymbols
Mar 18, 2021
Merged

Reduce Grpc.Core nuget size by generating separate .so with/without debug symbols for grpc_csharp_ext#25729
jtattermusch merged 4 commits intogrpc:masterfrom
jtattermusch:csharp_separate_linux_debugsymbols

Conversation

@jtattermusch
Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch commented Mar 16, 2021

This should lead to significant reduction of Grpc.Core nuget's size.

The Grpc.Core package will from now on contain stripped version of grpc_csharp_ext.so. The non-stripped version with all the debug symbols will be made available through the Grpc.Core.NativeDebug package.

Related issue: #25598

@jtattermusch jtattermusch requested a review from apolcyn March 16, 2021 16:57
@jtattermusch jtattermusch added lang/C# release notes: yes Indicates if PR needs to be in release notes labels Mar 16, 2021
@jtattermusch jtattermusch force-pushed the csharp_separate_linux_debugsymbols branch from 055f540 to 572ab4b Compare March 17, 2021 08:34
@jtattermusch jtattermusch marked this pull request as ready for review March 17, 2021 08:37
@jtattermusch
Copy link
Copy Markdown
Contributor Author

Adhoc artifacts / packages / distribtests run: https://fusion2.corp.google.com/invocations/ae11738c-74a6-4604-aae4-cf957090e991/targets

I will add info about Grpc.Core size difference once the package build finishes.

@jtattermusch jtattermusch changed the title Generate separate .so with/without debug symbols for grpc_csharp_ext Reduce Grpc.Core nuget size by generating separate .so with/without debug symbols for grpc_csharp_ext Mar 17, 2021
@jtattermusch
Copy link
Copy Markdown
Contributor Author

CC @jskeet

@jtattermusch
Copy link
Copy Markdown
Contributor Author

Issue with stripping linux aarch64 library (since aarch64 library cannot be stripped on x64?)

+ strip --strip-unneeded libgrpc_csharp_ext.so
strip: Unable to recognise the format of the input file `libgrpc_csharp_ext.so'
+ FAILED=true
+ '[' artifacts '!=' '' ']'
+ mkdir -p /tmpfs/src/github/grpc/artifacts
+ docker cp build_and_run_docker_4872eb47-0a97-41df-8cac-55472d75dc16:/var/local/git/grpc/artifacts /tmpfs/src/github/grpc
Error: No such container:path: build_and_run_docker_4872eb47-0a97-41df-8cac-55472d75dc16:/var/local/git/grpc/artifacts
+ FAILED=true
+ docker rm -f build_and_run_docker_4872eb47-0a97-41df-8cac-55472d75dc16
build_and_run_docker_4872eb47-0a97-41df-8cac-55472d75dc16
+ '[' true '!=' '' ']'
+ exit 1

2021-03-17 01:51:49,228 FAILED: build_artifact.csharp_ext_linux_aarch64 [ret=1, pid=7822, time=847.3sec]

@jtattermusch
Copy link
Copy Markdown
Contributor Author

@jtattermusch
Copy link
Copy Markdown
Contributor Author

jtattermusch commented Mar 18, 2021

Grpc.Core size reduction is quite significant: 74MB -> 14MB
on the other hand, the size of Grpc.Core.NativeDebug has increased from 41MB to 106MB (as expected).

All the C# distribtests are still passing.

Adhoc build of the nuget packages is here:
https://console.cloud.google.com/storage/browser/grpc-testing-kokoro-prod/test_result_public/prod/grpc/core/master/linux/grpc_build_packages/15988/20210317-112510

@jtattermusch
Copy link
Copy Markdown
Contributor Author

CC @jskeet as this PR leads to significant decrease of Grpc.Core size (it's now 14MB).

@jskeet
Copy link
Copy Markdown
Contributor

jskeet commented Mar 18, 2021

Wahoo - that's great news :)

@jtattermusch jtattermusch merged commit a737ff8 into grpc:master Mar 18, 2021
@jtattermusch
Copy link
Copy Markdown
Contributor Author

@philipag
Copy link
Copy Markdown

philipag commented Dec 9, 2021

This is again broken in the latest Prpc.Core 2.42.0 and 2.43.0-pre1 nugets. libgrpc_csharp_ext.so is once again 107MB!

@jtattermusch
Copy link
Copy Markdown
Contributor Author

jtattermusch commented Jan 3, 2022

libgrpc_csharp_ext.x64.so in Grpc.Core NuGet package is huge (115 MB) #25862

I don't think that's true. See
#25862 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang/C# release notes: yes Indicates if PR needs to be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants