News for hackers. Stuff that matters.
Re:Ballista: Distributed compute platform implemented in Rus... by habitue on Monday January 18, 2021 @01:45PM (#25825025)
It saddens me a little bit that a nascent protocol like arrow flight is using grpc + protobufs behind the scenes with some hacks on top to skip the cost of deserializing protobufs. It seems like a really common belief that protobufs have so much engineering time behind them and are cross-language that it's a no brainer to implement your new protocol on top of them.

In reality, all the engineering and optimization time is behind the implementations for the google internal languages, and even the python protobuf implementation is pretty bad.

Protobuf makes some stunningly bad decisions like using varints, etc that you shouldn't make the immediate assumption "google has tons of great engineers, google uses protobuf for everything internally, therefore, protobuf is a good foundation to build my new thing on top of"

In reality, path dependence and the (amazing) internal tooling ecosystem at google both play a huge part of why they use protobuf so extensively.

(Grpc is a little overly complicated to be a universal recommendation, but I could believe it's a good choice for Arrow Flight. But it seems like they didn't do grpc + arrow or grpc + flatbuffer + arrow in the hopes that "dumb" grpc + protobuf implementations would be able to still benefit. In my opinion, grpc implementations are so coupled, there's no reason to make this unnecessary concession to protobufs)

Re:Ballista: Distributed compute platform implemented in Rus... by jfim on Monday January 18, 2021 @01:54PM (#25825136)
I'm not sure I'd call varints a stunningly bad decision. It seems more like the kind of tradeoff one would make if storage and network transfer costs are considered to be more important than the serialization/deserialization speed.

That being said, the fact that that particular tradeoff was considered to be good for Google doesn't mean it actually is, or that it's applicable to one's application.

Re:Ballista: Distributed compute platform implemented in Rus... by xiphias2 on Monday January 18, 2021 @01:59PM (#25825205)
I guess it was good before compression. Nowdays working with protobufs is painful inside Google as well, but at least it's supported by everything.

Most of what the CPUs at Google are doing is just copying fields from one protobuffer to another.

Re:Ballista: Distributed compute platform implemented in Rus... by cogman10 on Monday January 18, 2021 @02:24PM (#25825455)
I think that's a fair description of pretty much every webapp :D

Most of them are doing nothing more than copying data from the database into an http stream.

Re:Ballista: Distributed compute platform implemented in Rus... by ithkuil on Monday January 18, 2021 @02:34PM (#25825599)
Well, all what CPUs do is copying memory from one memory location to another, perform some arithmetic and do some conditional jumps :-)
Re:Ballista: Distributed compute platform implemented in Rus... by xiphias2 on Monday January 18, 2021 @03:15PM (#25826077)
Most of the arithmetic is checking optional fields if they are empty or not before copying :)
Re:Ballista: Distributed compute platform implemented in Rus... by cogman10 on Monday January 18, 2021 @02:49PM (#25825795)
pop pop jump jump oh what a crunch it is.

(sung to this tune https://www.youtube.com/watch?v=iENQXIQ8wH0 )

Side note: It really is incredible what happened in the early days of computing when memory and computation were limited. How much care was taken in the precise layout of memory or even the timing of a calculation was insane.

Re:Ballista: Distributed compute platform implemented in Rus... by munk-a on Monday January 18, 2021 @03:22PM (#25826153)
Don't forget the validation!

Webapps are dumb middleware that pipes data from the database into an http stream - but it needs to determine which database calls to invoke and sanitize all the incoming junk.

Re:Ballista: Distributed compute platform implemented in Rus... by lmeyerov on Tuesday January 19, 2021 @01:21AM (#25830592)
We use arrow to do the validation 'for free': it has a typed columnar schema, so by passing the schema, we get the recordset validation without inspecting values.

we still need to do semantic validation, but w/ arrow, now we do that in bulk and on gpus :)

Re:Ballista: Distributed compute platform implemented in Rus... by xiphias2 on Monday January 18, 2021 @03:12PM (#25826043)
Sure, but when you are using C++, protobufs are not the best way to store data...but I guess it could be worse.
Re:Ballista: Distributed compute platform implemented in Rus... by philsnow on Monday January 18, 2021 @03:52PM (#25826488)
At least when I was there, proto (de)serialization consumed the plurality of cpu cycles, but not the majority.

It isn't really the majority these days, is it?

Re:Ballista: Distributed compute platform implemented in Rus... by habitue on Monday January 18, 2021 @02:32PM (#25825580)
You're right, it's probably fair to say it's a stunningly bad tradeoff for most applications most of the time, given we have fast compression like snappy & brotli available now and cloud costs are heavily weighted towards CPU costing more than storage & network transfer
Re:Ballista: Distributed compute platform implemented in Rus... by lmeyerov on Monday January 18, 2021 @07:34PM (#25828532)
We directly stream arrow across devices, skipping grpc indirection / confusion, and have done that since near the beginning of arrow. Others do too, works great :)

Flight is interesting to us bc they're thinking through parallel i/o. I'm guessing grpc overhead there is more tolerable, though yeah, I'd be curious. I had similar initial reservations, esp as we were happy to remove slow google protobuf stack stuff as part of our switch to arrow :)

Re:Ballista: Distributed compute platform implemented in Rus... by sitkack on Monday January 18, 2021 @02:31PM (#25825554)
What you describe is truly an https://github.com/TimelyDataflow/abomonation
Re:Ballista: Distributed compute platform implemented in Rus... by ampdepolymerase on Monday January 18, 2021 @03:03PM (#25825939)
What are some production ready alternatives to gRPC that have both a pleasant developer experience and great performance? Apache Avro? Apache Thrift?
Re:Ballista: Distributed compute platform implemented in Rus... by e12e on Monday January 18, 2021 @04:09PM (#25826653)
Re:Ballista: Distributed compute platform implemented in Rus... by habitue on Monday January 18, 2021 @03:18PM (#25826107)
I think for this kind of high performance stuff, grpc is a reasonable choice. For ergonomics though, http + json is fine for many/most applications and there is a lot more widely available tooling for it than there is for grpc.

It's very possible that will change over time

(My implicit assumption here is that a project like Arrow Flight wants a cross-language, widely used foundation for their protocol, and there's not a ton of things that fit that bill. But depending on your application's needs, implementing a language-specific rpc system is perfectly acceptable, and may have even better ergonomics. Rust and Python both have a plethora of mono-lingual rpc frameworks)

Re:Ballista: Distributed compute platform implemented in Rus... by jeffnappi on Monday January 18, 2021 @03:36PM (#25826333)
GraphQL is one.

Here's an article making the argument for it https://blog.spaceuptech.com/posts/why-we-moved-from-grpc-to...

Re:Ballista: Distributed compute platform implemented in Rus... by e12e on Monday January 18, 2021 @04:07PM (#25826640)
I think that if you honestly consider GraphQL a better fit than gRPC, you probably should never have considered gRPC to begin with...

And much as we're considering GraphQL for some services as work... I'm not sure I buy it as an RPC framework. I suppose it has about the same appeal as SOAP for that purpose.

Re:Ballista: Distributed compute platform implemented in Rus... by jeffnappi on Monday January 18, 2021 @09:23PM (#25829271)
Agreed - they both have their place.
Re:Ballista: Distributed compute platform implemented in Rus... by hilbertseries on Monday January 18, 2021 @03:27PM (#25826213)
gRPC has a pleasant developer experience? This is news to me.
Re:Ballista: Distributed compute platform implemented in Rus... by riku_iki on Monday January 18, 2021 @03:40PM (#25826368)
Maybe it is relatively pleasant when compared to alternatives.
Re:Ballista: Distributed compute platform implemented in Rus... by ampdepolymerase on Monday January 18, 2021 @04:08PM (#25826649)
It doesn't.