gRPC as JNI replacement

532 views
Skip to first unread message

Anton Smirnov

unread,
Dec 28, 2020, 12:55:08 AM12/28/20
to grpc.io
Hi, folks.

I'm working on a POC: gRPC as a replacement for JNI.

Currently JNI is considered as bug-prone:
  • requires writing the code manually
  • specific JNI-knowledge required
  • possible threading and memory management issues
The main concern about gRPC for me is performance: we need gRPC to work not too much slower compared to JNI (ideally even better). Another concern is disk footprint: for some reason share library having gRPC and libprotobuf (we tried to consume -lite) is about 2Mb per ABI which is too large.

Please find the full code in my github repo.

I've benchmarked it and here are my conclusions:
  • InProcess transport can't be used across languages
  • all other transports are significantly slower compared to pure JNI call (~25 microseconds for JNI call vs. ~3-5 milliseconds for gRPC call)
  • disk footprint cost is pretty high
Please find v1 of the research and i'd love to know what you think about it.

Are the conclusions expected? Did i do anything wrong/suboptimal? Can anything about gRPC or how i used it be improved (even with 3rd-party channels or smth)?

Best,
Anton.

PS. I've find smth related to transport across the languages in this discussion.
PS2. My SO question.
PS3. I've already got some feedback from Eric but i'd love to have some discussion on it.

Reply all
Reply to author
Forward
0 new messages