Huge increase of precompiled native libraries for Android and iOS

175 views
Skip to first unread message

Ronny López

unread,
Feb 17, 2020, 3:12:25 AM2/17/20
to grpc.io
Hi,

We use the experimental Unity package which includes precompiled native libraries Android and iOS.

In the latest versions (concretely while upgrading from version 1.23.x to 1.27.x) , the size of  those precompiled native library has doubled in size.

In Android, from ~20MB to ~42MB
In iOS, from ~90MB to ~208 MB

This makes the package near to unusable in mobile.

Do you folks know what is provoking such huge increase in size?


Thanks 

 

Jihun Cho

unread,
Feb 19, 2020, 1:13:55 PM2/19/20
to Ronny López, grpc.io
we have completely different codebase for ios and android. so, it happened on both sides sounds interesting.
i can't speak for the ios part, but for android build we check the binary size, so i am a bit surprised that you experienced this. 

can you narrow down which version caused the binary size increase?
also, can you have some break down other than total binary size?

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/49fb6d80-0c96-439a-a25e-9c89ab06e78f%40googlegroups.com.

Eric Gribkoff

unread,
Feb 19, 2020, 8:15:00 PM2/19/20
to Jihun Cho, Jan Tattermusch, Ronny López, grpc.io
+Jan Tattermusch , who (I think) knows more about our Unity builds

Nicolas Noble

unread,
Feb 20, 2020, 12:34:37 AM2/20/20
to Eric Gribkoff, Jihun Cho, Jan Tattermusch, Ronny López, grpc.io
I mean... we've been adding a lot of features recently with regards to things like xds, changed nanopb to upb, moved from using C to C++, adding abseil as a dependency, and others. I'm not completely surprised that this would result in a size increase. Similar things have been noted with the python extension for instance, although I'm still not sure if it's a similar problem:  https://github.com/grpc/grpc/issues/21958

Now, sure, it's a fairly massive size increase, but we've gathered more and more dependencies as we're adding new features. That may be the sort of things to expect as you increase the feature set and dependency set.

Getting a linker map of what exactly is in there could be helpful to see if there's really something out of whack, in case there's really something that shouldn't be there, but I'm not necessarily very hopeful in "what we can do" to address this issue in case there isn't anything out of place in the binaries: the monolithic nature of grpc means we can't really "opt out" of these new features.

Ronny López

unread,
Feb 20, 2020, 4:58:48 AM2/20/20
to Nicolas Noble, Eric Gribkoff, Jihun Cho, Jan Tattermusch, grpc.io
Here you can visually see the increase in size from version 1.23.x to version 1.27.x.

From 93MB to 208MB in iOS. This make this version unusable on low end device and embedded systems. 

Is there anything we can do to help fixing this?

Thanks

1.27
image.png


1.23
image.png

Nicolas Noble

unread,
Feb 20, 2020, 8:38:12 AM2/20/20
to Ronny López, Eric Gribkoff, Jihun Cho, Jan Tattermusch, grpc.io
To be useful, this needs to be mapped. Literally the output of the -Map=grpc.map linker option while linking the .so file: https://interrupt.memfault.com/blog/get-the-most-out-of-the-linker-map-file

Nicolas Noble

unread,
Feb 21, 2020, 3:53:02 PM2/21/20
to Ronny López, Eric Gribkoff, Jihun Cho, Jan Tattermusch, grpc.io
Side-note: these binaries contain debug symbols, per popular request. If you're generating release assets going onto a production package, you'd need to strip the binaries that go there. The libgrpc.a that is 200MB in size probably has about 190MB worth of debugging symbols.

Nicolas Noble

unread,
Feb 21, 2020, 7:25:56 PM2/21/20
to Ronny López, Eric Gribkoff, Jihun Cho, Jan Tattermusch, grpc.io
I've been doing a cursory inspection of the actual binary, sans debug symbol. Its size grew about about 50% between 2.24 and 2.27, and most of the increase is due to XDS and grpclb being added to the codebase.

Nicolas Noble

unread,
Feb 21, 2020, 7:42:43 PM2/21/20
to Ronny López, Eric Gribkoff, Jihun Cho, Jan Tattermusch, grpc.io
Correction: I apparently can't do math on a Friday afternoon. It's rather a 20% increase.
Reply all
Reply to author
Forward
0 new messages