text stringlengths 0 2.35k |
|---|
**Akshay Shah:** \[laughs\] |
**Jon Calhoun:** When people set up a Hello World server and they're like "Oh, it's 40% slower." |
**Akshay Shah:** It's just -- how could they...? I mean, it's the same protobuf runtime and net HTTP, right? So generally speaking, perf-wise, you're in the ballpark that you're familiar with, and that's proven itself to be good for this huge variety of use cases. |
We do the same thing for TypeScript, and we're working on a similar runtime for mobile phones. I think over there, the standard gRPC protobuf trade-offs are a little more out of the norm, and so there's more space to do something that feels really good to web developers or mobile developers. |
**Johnny Boursiquot:** So you mentioned all sort of statically-typed languages for this. I imagine that's deliberate; you're avoiding some of the more dynamic stuff. |
**Akshay Shah:** I think even in dynamically typed languages, right? Like, Python is a great example. The Python ecosystem, if you look at some of the most interesting stuff in Fast API, it's generating typeheads that represent your APIs nicely. And so even a lot of languages that are really dynamically-typed, it's con... |
**Johnny Boursiquot:** That's rough. That's a rough choice, but alright, keep going... \[laughs\] |
**Akshay Shah:** I'm actually less opposed to it than a lot of Gophers... There's a time and a place for everything, right? |
**Johnny Boursiquot:** Right, right. |
**Akshay Shah:** If I'm in a Jupyter Notebook, and I'm fetching some data from some service just to run a bunch of NumPy on it, whatever is in between this API call and my NumPy array is really - like, I don't care that much. I just want it to happen. I don't really want to be in Gonum, trying to dimension an array, an... |
**Jon Calhoun:** So when we're talking about all of this, I will say that part of the reason I don't have a lot of experience with gRPC is that historically, you see things like -- it's you hear about Stubby, or something at Google, or a custom HTTP implementation for the gRPC stuff for Go... And it always struck me as... |
**Akshay Shah:** I don't know. Johnny, what do you think? I have my opinions, but... |
**Johnny Boursiquot:** \[47:53\] I think people will go with what they know best to get a job done, and will only sort of step outside -- well, let's just say there are two classes of developers out there. There are those who go with what they know, and try to get the job done as quickly as possible, and there are thos... |
**Jon Calhoun:** Yeah, but when you're self-employed, I feel like that... |
**Johnny Boursiquot:** \[laughs\] |
**Jon Calhoun:** ...self-employed with kids, you're like "I don't have time to learn new stuff right now." |
**Johnny Boursiquot:** Right. Exactly, exactly. And then you have those who work at larger companies, and they don't even have to worry about getting paid to feed their family, and they can take more liberties, I would say. |
**Akshay Shah:** I think that's right. |
**Jon Calhoun:** So if you were building a publicly -- I guess what I'm wondering is if you were building an API that you wanted to expose to the public, for whatever reason, is gRPC something you would consider using that, if you knew gRPC really well, and were good with it? Or would you say that you'd prefer just to ... |
**Akshay Shah:** I would use Connect, and I would build an API using protobuf schemas for my own development; I would tell most of my clients, "Hey, if you're trying to call my API from JavaScript - like, forget about all this other stuff; it's HTTP and JSON under the hood. Just download this client library. Why do you... |
**Jon Calhoun:** It sounds like you would use gRPC, but you would just make sure you're using that JSON format so that if they need to do something else, they can pretty easily. |
**Johnny Boursiquot:** There's some subtlety there. Connect supports the whole gRPC protocol. It also supports its own protocol, that is very similar to gRPC. Your code stays the same, you flop a config flag; you can speak your own -- this other protocol, that looks much more like REST, where you can just post some JSO... |
**Jon Calhoun:** Okay. I think that helps, because - I know historically, the fact that you said that you couldn't communicate with an HTTP browser, the minute I hear that, I'm like "Oh, this isn't gonna work." That's kind of a showstopper... Especially if you're building a web application, and you're like "Well, that'... |
**Akshay Shah:** I mean, even if you're not building a web application, right? You're building an API... Browsers are really convenient. The Network tab is really nice, it's a convenient debugging environment, it's got this real programming language \[unintelligible 00:51:41.24\] for you to plan... It's the most widely... |
\[51:55\] I think gRPC uses this little-known corner of HTTP called trailers. They're just headers that come after the body. They're useful for a bunch of reasons, like having some way to send metadata after the body is really helpful. They chose to send them as HTTP trailers. At the time they were making these decisio... |
So that's kind of really made gRPC hard to adopt for external APIs. But that's not an intrinsic problem with protocol buffers, it just means you need a little translation layer, or you need a different library. Those libraries are pretty small; Connect does all of gRPC and this other thing in less than 10,000 lines of ... |
**Johnny Boursiquot:** Yeah, Jon. |
**Jon Calhoun:** It's definitely something I'm open to exploring... It's kind of the same as GraphQL - it's always struck me as interesting technology, but when I don't have a direct need for it, it's really hard to go out of my way and use it extensively to build some -- because people are like "Oh, well, your API is ... |
**Akshay Shah:** When you write your external APIs, when you're calling them from your web apps, are you typically handwriting code in the browser to call those APIs? So you're writing like React hooks, or whatever? |
**Jon Calhoun:** If I can generate a library or do something that, I always opt to do that, because it's just simpler. But it really depends. One of the restraints I get at times is that I also make courses that help people learn stuff... So when I'm looking at things, that can also influence what technologies I opt to... |
**Akshay Shah:** That makes sense. |
**Jon Calhoun:** But most of the time, if I can generate a library, that's what I want to do. I don't care about the underlying technology at all... Whether it's XML or something else, I don't really care. I just want -- like, give me a library that's easy to use. |
**Johnny Boursiquot:** XML, Jon? Really? |
**Jon Calhoun:** Johnny, I've used way more XML in my life than I really care to. \[laughter\] |
**Akshay Shah:** That's right. Oh, man. At one job... We're doing a bunch of work, enterprise integration work with ThinServe companies, and I was praying for XML. There were all these weirdo, handrolled binary formats... It was like "Back in the day, we thought these ints were going to be 32 bits... So if this flag is... |
**Johnny Boursiquot:** Wow. |
**Akshay Shah:** It was all bananas. So I can see why everyone was really excited about XML. |
**Jon Calhoun:** I was never excited about XML. It was just one of those things that - I started a company where we interacted with a lot of shipping APIs, and a lot of them were using XML, so I just got very familiar with it... And at the end of the day, I just came to the conclusion that I don't actually care what yo... |
**Johnny Boursiquot:** \[laughs\] No, that's when you dust off the old XSLT book. |
**Akshay Shah:** That's right. \[laughs\] |
**Johnny Boursiquot:** ...that you've got buried somewhere in your basement. |
**Akshay Shah:** I had that in an O'Reilly book, and there was like a snake woodcut on the cover, or something... Oh, my God. |
**Break:** \[56:25\] |
**Akshay Shah:** I think in 2022, the way the industry is today, protobuf is a good middleground for exactly that role... You write a little schema, your server-side implementation gets easier. It's a little easier to wrangle. And you can just hand your clients fully-generated, ready-to-go client code. And whatever is ... |
We've all got jobs to do... Your server is supposed to be doing something, and we just want to get to that part of it as quickly as possible. And on the frontend, you're like "Well, I'm trying to build a UI here. I don't really care about any of the plumbing. I just wanted some functions to call." And the faster we can... |
**Jon Calhoun:** So I think we're getting near the end of the episode... We're gonna move into the Unpopular Opinion. |
**Jingle:** \[58:56\] |
**Jon Calhoun:** Akshay, do you have an unpopular opinion for us? |
**Akshay Shah:** I don't know how unpopular it's going to be, but we mentioned at the top that I wrote this structured logging library called Zap. There's a bunch of libraries like it now; there's ZeroLog... And they're proposing to introduce something this to the standard lib. I think this whole thing is just so funda... |
**Johnny Boursiquot:** So you think structured logging itself is a bad idea. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.