News for hackers. Stuff that matters.
Re:gRPC-Go Engineering Practices by kajecounterhack on Thursday January 25, 2018 @03:16PM (#16234206)
Versioning your API is one huge benefit and better done using proto/rpc. If you change your Json schema, have fun propagating that change to all clients without fear. Or hope you've built special infra to do that.

Also "just more efficient" is a funny way to characterize the performance difference between just data bytes vs data + structure bytes (read: the gap is large). You gain in transmission and you gain during deserialization / parsing.

Here is an example.

{"My key":"my value"} has n=21 characters. When you parse you must scan the whole 21 characters O(n), every time, just to read the thing.

If you instead store this in fixed size bytes, where you have some fixed # of bytes that tell you "my value starts at address 0x43", then you can skip to just the values you care about. You don't need brackets or quotes. And you can use other nifty tricks to compress the binary representation further for savings on the wire.

Re:gRPC-Go Engineering Practices by mpweiher on Friday January 26, 2018 @04:19AM (#16237899)
> performance difference [..] (read: the gap is large)

Hmm...can you quantify that? I found that while these performance difference you mention exist, they are not actually that large and completely dwarfed by actions later in the chain, particularly if you have generic intermediate representations.

Re:gRPC-Go Engineering Practices by weberc2 on Thursday January 25, 2018 @06:29PM (#16235751)
I fully agree, but want to point out that JSON can be compressed.
Re:gRPC-Go Engineering Practices by virmundi on Thursday January 25, 2018 @09:14PM (#16236541)
You're absolutely right. Auth0 shows that when compressed, protobufs don't provide a great benefit vs JSON.

Something I've read from others is that gRPC is not the easiest thing to use directly in SPA. If you have services exposed to a web front end and mobile, double exposing a REST-ish API + gRPC might not be worth it. This is a problem with which I'm currently struggling.

https://auth0.com/blog/beating-json-performance-with-protobu...

Re:gRPC-Go Engineering Practices by chickenbane on Friday January 26, 2018 @12:41AM (#16237259)
Did you not finish the rest of the post? Yes, it's true that compressed json is not materially different in size vs protobufs. But when it comes to the speed of serializing and deserializing protobufs there is a huge gain across languages. So if you're using gRPC in backend environments you'll gain huge speed benefits.
Re:gRPC-Go Engineering Practices by weberc2 on Friday January 26, 2018 @09:16AM (#16239261)
That was already acknowledged earlier in the thread.
Re:gRPC-Go Engineering Practices by chrissnell on Friday January 26, 2018 @12:06AM (#16237156)
I spoke to some of the gRPC folks at KubeCon/CNCon and the word is that browser support is in the works. There are some existing, slightly hackish ways to do it already but I'm confident that they will get it done properly.

It will be huge when that's a reality and we start building all of our APIs around protobuf.

Re:gRPC-Go Engineering Practices by kajecounterhack on Friday January 26, 2018 @07:03PM (#16243943)
When compressed sizes can still matter as the payload size increases.

REST is the language the rest of the web speaks so if providing a consumer service that isn't latency sensitive you should feel at liberty to give a RESTful API.

If you're building internal services, consumed internally, gRPC is a decent way to go.

If say you're providing a logging service to a number of large customers you might want to provide a gRPC service for the performance characteristics.

gRPC also provides you the option to write all your services internally using gRPC and then you can expose a JSON service without having to write it yourself.