Using the binder as the transport for gRPC

1,209 views
Skip to first unread message

song...@gmail.com

unread,
Jul 9, 2017, 11:57:18 PM7/9/17
to grpc.io
Hi,

In the Andriod platform, it provides the binder support from kernel to be as an efficient transport layer compared as socket.

So is that possible to replace the socket as binder for gRPC in Android ?

Any suggestions for that ? many thanks in advanced.

Thanks,
Song

Carl Mastrangelo

unread,
Jul 11, 2017, 9:11:57 PM7/11/17
to grpc.io, song...@gmail.com
In gRPC Java this is possible (though poorly documented).  You would need to make your own transport layer.

What kind of performance level were you targeting?  gRPC is already pretty fast.

song...@gmail.com

unread,
Jul 11, 2017, 10:26:27 PM7/11/17
to grpc.io, song...@gmail.com
Hi,

Thanks for your information.

1. why is that possible for gRPC Java not for gRPC C++ ?

2. we are using the gRPC as the IPC mechanism to provide/invoke functions between processes, binder is designed to avoid un-necessary data copy, which have a relatively better performance then gRPC:

e.g. writing 1k data
gRPC: 1-1.92ms
binder: 0.5ms

If we want to make our own transport layer, where could I start from ? Many thanks.

Thanks,
Song

Carl Mastrangelo

unread,
Jul 12, 2017, 5:17:26 PM7/12/17
to grpc.io, song...@gmail.com
gRPC Java's transport is slightly more pluggable than C++.  

Is binder just inprocess?  If so, why not use InProcessChannelBuilder?

song...@gmail.com

unread,
Jul 13, 2017, 12:25:02 AM7/13/17
to grpc.io, song...@gmail.com
It seems that InProcessChannelBuilder is using the socket, right ?

Spencer Fang

unread,
Jul 13, 2017, 11:04:28 AM7/13/17
to song...@gmail.com, grpc.io
No, InProcessChannelBuilder bypasses the network completely, and is designed to talk to a server created with InProcessServerBuilder, which is in the same process as the client.

If you would like to look into how transport implementations fit into grpc-java, look at overrides of:
- AbstractManagedChannelImplBuilder.buildTransportFactory
- AbstractServerImplBuilder.buildTransportServer

--
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/4e09a899-65fa-49ff-960a-e3fdd8184857%40googlegroups.com.

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



--
Spencer Fang

phan...@gmail.com

unread,
May 27, 2020, 2:10:49 AM5/27/20
to grpc.io
Hi Song,

Did you have any luck in trying the binder transport for gRPC on android? we have also run into a similar scenario and looking to write binder transport for gRPC.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.

To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.



--
Spencer Fang

Eric Anderson

unread,
May 27, 2020, 3:34:07 PM5/27/20
to phan...@gmail.com, grpc.io
It's not good form to revive 3 year old threads. It is better to start a new thread and just reference back to the old thread saying you noticed it.

No binder transport came out of this discussion, to my knowledge. However, I'm aware of a gRFC in the works (not yet posted) for a Binder transport. So there is some more recent interest in this.

Such a transport would not be created for performance reasons. Instead, it would be for the Android integration it allows, like Android auto-starting services and some rare interactions with Parcelables.

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/5806fa4e-9f92-4bac-915b-5c12b7b7e464%40googlegroups.com.

Eric Anderson

unread,
Jul 16, 2020, 1:28:30 PM7/16/20
to phan...@gmail.com, grpc.io
The gRFC L73 for a BinderChannel in gRPC has been posted: https://github.com/grpc/proposal/pull/191 . Mailing list discussion: https://groups.google.com/d/msg/grpc-io/RFmjrxdtwzE/dW5HdkbDBgAJ . Any related discussion should happen on that gRFC thread, or a new thread.
Reply all
Reply to author
Forward
0 new messages