[gRPC-Java] Minimum version of Guava required to work with gRPC.

36 views
Skip to first unread message

dknku...@gmail.com

unread,
Mar 2, 2018, 12:48:59 AM3/2/18
to grpc.io
Hi Devs,

Currently I am working on implementing gRPC support for my product. Since grpc-core has a transitive dependency to guava library. I need to include guava library alone with grpc libraries in my distribution. Since guava library size is around 2.3MB, I am trying to create miniature version of guava library using ProGuard[1].

After going through the gRPC-java code, identified following classes/packages are used in gRPC-core library and dependent opencensus-api,

com.google.common.base.**
com.google.common.util.concurrent.**
com.google.common.collect.Maps
com.google.common.collect.ImmutableMultiset
com.google.common.collect.ImmutableList
com.google.common.collect.HashMultiset
com.google.common.collect.Lists
com.google.common.collect.Multiset
com.google.common.io.**

I am able to create miniature version which is only 850kB size and it worked fine for the basic gRPC operation. I would like to know whether it is ok to create miniature guava version to work with gRPC or is there other recommended way. It would be great, if you can give me list of guava classes/packages(minimum version of Guava we require) used in gRPC.

1. https://github.com/google/guava/wiki/UsingProGuardWithGuava

Appreciate your response.

Thanks
Danesh

Carl Mastrangelo

unread,
Mar 2, 2018, 3:46:34 PM3/2/18
to grpc.io
We (gRPC) avoid depending on anything in common.collect from guava, so in theory you should be able to trim your deps down.  I don't know about open census's API.

Eric Gribkoff

unread,
Mar 2, 2018, 4:04:19 PM3/2/18
to Carl Mastrangelo, dknku...@gmail.com, grpc.io
You mention proguard, so I assume you're building for Android? If you're running proguard, you shouldn't be seeing anything like a 2.3MB size from the guava dependency. You can see the proguard configuration for our Android interop test app here: https://github.com/grpc/grpc-java/blob/master/android-interop-testing/app/proguard-rules.pro.

With this configuration, our entire interop app APK after proguard is only 1.4MB, and the com.google.common.* dependencies from Guava are only 65.7KB.

Eric


--
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+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/34d19f2a-0a0a-4bec-8bd6-b8f177554e30%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages