Live data from Hacker News

Twirp: A new RPC framework for Go

blog.twitch.tv

51–60 of 99 posts

Re: Twirp: A new RPC framework for Go

#51
post #49

Earlier quoted context omitted.

Can I ask why you want JSON with gRPC? The benefits to protobuf are tremendous, with little to no downsides

One reason is to be able to call gRPC service from a web browser. Native JSON support makes that much easier.

There has recently been a lot of work for native grpc client in the browser. It’s not fully there yet but is looking real promising!

https://github.com/improbable-eng/grpc-web

Re: Twirp: A new RPC framework for Go

#52

Earlier quoted context omitted.

Thanks for posting! How did you work around issues with GRPC on AWS/ELB?

We had to stick to layer 4/TCP via an ELB (as opposed to an ALB).

You are doing L4 load balancing with the ELB? So you can’t do sticky session management? Is that a problem you run into, if so, how did you handle it?

Re: Twirp: A new RPC framework for Go

#53

It is nice but would say with limited value outside of Twitch

anyone who is going a move from monolith to microservices on top of AWS is a potential user of twirp and it will save tons of time on design and implementation. that's a lot of value and for a lot more people than just Twitch.

Re: Twirp: A new RPC framework for Go

#54

This looks promising! We use the go-grpc SDK in conjunction with gogoprotobuf, and it's been a rocky road. While the article identifies some operational issues (e.g. the reliance on HTTP/2), there are several considerable deficiencies with gRPC today, at least when using it with Go: 1. The JSON mapping (jsonpb.go) is clumsy at best, and by this I mean that it produces JSON that often doesn't look anything like how yo…

Yeah, I agree with pretty much everything you've written here. > 1. The JSON mapping (jsonpb.go) is clumsy at best The best thing for optional fields in jsonpb is to use the protobuf wrapper types [1]. They have special support in jsonpb to serialize and deserialize as you would expect, without the indirection. But the Go structs you get on the other end are a little weird, so its a tradeoff. > 2. The Go code generat…

3. Also google.protobuf.Struct

Re: Twirp: A new RPC framework for Go

#55
post #18

Really excited about this. I didn't like how opaque and heavy gRPC is. Also I really wanted support for JSON. Mostly for these reasons, RCP hasn't been implemented in my architecture yet (Just using standard REST) Twirp is everything I wanted in an RPC framework and I'm looking forward to implementing it ASAP. Thanks Twitch team :)

Is Cloud Endpoints an option for you? It supports gRPC with JSON/REST transcoding.

[1] https://cloud.google.com/endpoints/docs/grpc/about-grpc

(Disclaimer: I work on Google Cloud.)

Re: Twirp: A new RPC framework for Go

#56
post #36

Why use HTTP for transport instead of Messagepack or ZMQ? Seems a bit overkill if you are whipping binary data back and forth between services. Protobuf + ZMQ seems a lot more efficient to me.

Messagepack is a serialization format, not a transport. It is an alternative to protobuf or json.

Mostly people use HTTP because there are so many services and components that already support it (load balancers, proxies, sidecars etc), it has well-supported options for authentication, conveys metadata seamlessly through multiple layers, and its overhead isn't an issue for the kind of payloads they are sending.

Plus, you know, curl.

Re: Twirp: A new RPC framework for Go

#58
post #40
post #36

Why use HTTP for transport instead of Messagepack or ZMQ? Seems a bit overkill if you are whipping binary data back and forth between services. Protobuf + ZMQ seems a lot more efficient to me.

A lot of this boils down to wanting to be able to use standard load balancers.

ZMQ uses ZMTP which is a TCP protocol, and for example, HAProxy supports TCP just as much as TCP/HTTP.

Re: Twirp: A new RPC framework for Go

#59
post #45

Earlier quoted context omitted.

We had to stick to layer 4/TCP via an ELB (as opposed to an ALB).

gRPC connections are persistent, so a single client will always talk to a single backend in that configuration. It's fine if you have lots of clients but can easily lead to load imbalances. That's why projects such as Envoy exist. I'd link it, but I'm on mobile. Keep an eye on it.

You can use round robin load balancing in gRPC without Envoy.

Re: Twirp: A new RPC framework for Go

#60

Hey everyone! I'm the OP and primary author of Twirp. I'm happy to answer any questions and hear feedback. You can also reach me directly, if you like, email is in my profile.

Thanks for posting! How did you work around issues with GRPC on AWS/ELB?

When I implemented GRPC on ELB, we used a multiplexer to re-route the GRPC requests. See: https://github.com/soheilhy/cmux/. The only other issue we had was that ELB's would not let connections live longer than 30 seconds.
Post reply on HN