text
stringlengths
0
2.35k
**Nishant Roy:** A little bit, yes. When we first rolled it out, especially in the first couple of years, we did see that. I mean, I personally saw a lot of PRs coming in where folks were just like "Hey, pre-submit tests passed. I'm not gonna write unit tests for this." And to be honest, that was not the worst thing in...
We did however -- I'm trying to think of a few examples; I'll come back to you if they come to me... But there were a few instances where things sort of did pass through our pre-submit test framework likely because they weren't impacting something top-line, but something perhaps offline. For instance, if we didn't have...
**Jon Calhoun:** So seeing what you're doing now and seeing how it works, at least from my perspective, this sounds like something where at scale, this approach works very well, but if you were just starting up from like a smaller business or something, this is one of those cases where if you tried to mimic what a big ...
**Nishant Roy:** \[20:06\] Completely. Like you said, if you don't have a large enough sample size, this sort of testing is not really going to give you meaningful results; it's just going to be a coin flip at that point whether your test passes or fails. So having those more deterministic unit tests that actually test...
**Johnny Boursiquot:** You haven't mentioned what you're using for your observability stack. So a lot of things are being captured, metrics, your team are adding things based on features or products... Like, is this something home-grown, or are you using off the shelf software to provide that observability?
**Nishant Roy:** Yeah, so for general observability at Pinterest, metrics are essentially stored in an OpenTSDB backend, and we have an internal tool that is called Statsboard I believe there's a blog post about it. If not, I'm sure there will be at some point... It's a super-great team. It's one of my favorite teams t...
For pre-submit tests specifically we have a slightly more custom solution, because we didn't want to go through the whole hassle of essentially -- since I mentioned that we were doing it is every binary, or every PR, that we package it into a deployable binary for testing would get deployed to a single host, or just on...
So for those hosts, we used essentially the expvar library from the Go standard library to expose all metrics through an HTTP endpoint, and essentially, we could then scrape that endpoint and get all the metrics that were generated on that host as one large JSON blob, essentially, parse those in our pre-submit test fra...
**Johnny Boursiquot:** Very cool. So how much of your stack is Go-based services?
**Nishant Roy:** Only the ads team uses Go heavily and for online serving; so the ad delivery and ad logging systems are in Go. Pinterest broadly is more a Python, Java and C++ based infrastructure. So our front, user-facing API is in Python, a lot of our backends are in Java, unless they need to be-- Unless there's li...
The ads team - I don't know, the historical reason for this; this happened like seven, eight years ago, so like three years before I joined... But my understanding is it was a couple of things. I think we realized that the ads stack needed to be pretty low latency, but also required pretty high developer velocity... So...
So that's kind of how it happened, and we arrived at using Go... And it's been pretty great. I think for the longest time we've hit the happy middleground between developer velocity and performance. And Jonny, when we met at the Baltimore Go meetup, we talked a little bit about the challenges we faced with with Go effi...
Now, the Go team has put out a few flags recently to allow you to better tune the garbage collector. In Go 19, for instance, I think most recently they added the ability to tune your soft memory limit, as opposed to tuning just the Go GC value, which I think is a great way of allowing developers to essentially better c...
**Johnny Boursiquot:** \[24:21\] Right. Adding some official tooling for tweaking the garbage collection process.
**Nishant Roy:** Exactly.
**Johnny Boursiquot:** The Java world is sort of notorious for all the flags and optimizations, and all the bells and whistles, all the buttons you have access to for GC tuning... So then hopefully, Go doesn't necessitate that level of customizability. But again, as you say, the fact that the Go team is listening, espe...
**Nishant Roy:** Right.
**Johnny Boursiquot:** It's not often where we need to basically tweak what Go does out of the box. So this may not be a concern for a lot of people, the vast majority of people, but for those that do need it, it's good to have non-hacky ways of going about tweaking those things. So that's pretty cool.
**Nishant Roy:** Exactly, yup. I spent about six months of my life, I think two years in, strictly just analyzing how GC was impacting our service, and how to improve it. I've written a couple of blog posts about that as well. It was really interesting, it was fascinating, but I know now with this new flag I could have...
**Jon Calhoun:** It's kind of nice that they took their time with it, at least a little bit, because when Go was first released... You have to imagine - at least in my mind - it's young enough that they didn't have enough customers using Go in high enough production environments that they really had enough data to deci...
**Nishant Roy:** No, I agree with that.
**Jon Calhoun:** So it's nice they've taken their time and they're trying to figure that out as people are using it at scale... But that's something that in my mind would be very hard to have from the get-go, because it's like trying to optimize a page when you have 10 users, for a million users. It's like, I have no i...
**Nishant Roy:** Yup. And the good news is they did have sufficient tooling for you to understand your system usage, if needed. That's something that came packaged in from -- I guess I don't know how early on, but things like pprof, and memstats, etc. that allow you to actually understand how your system is performing,...
One thing I'd love to see, if the Go team is listening - if we can have an official guide on how to use these tools a little more; maybe some tutorials for people starting out who have never used flame graphs before, who don't understand how profiling works, or how to best read it. I think that'd be a really great way ...
**Johnny Boursiquot:** To that point, there's an interesting dichotomy, I think, within the Go committee right now... Because we've had talks and blog posts and things written on performance tuning and optimization for Go in general, be it in terms of analyzing allocation, memory usage, how many threads you have runnin...
**Nishant Roy:** Right.
**Johnny Boursiquot:** Which means like "Don't really look under the hood that much, don't run pprof, and don't analyze what your application is doing, because that might be premature optimization", right? "Only go looking for these tools if you suspect you have a problem with performance." But at the same time, a lot ...
\[27:50\] So you end up with this sort of a legacy built-in performance, suboptimal processes and tooling and services that are doing things that is way more than they were designed to do. Now you kind of have to have an engineering effort to refactor things.
I'm curious if you've experienced this need to go back and change things and refactor things and make things faster, and obviously, how Go made that easier or harder?
**Nishant Roy:** Yeah, I think you're right. I mean, it's an impossible decision to make, right? Because on one hand, if you're spending too much time on optimizing early on, you're not going to make it as a startup, especially given this environment we're heading into now... Speed of everything is of most importance. ...
I think one big thing that we've seen over the last probably five years to a decade or so is widespread adoption of video. So folks or companies who didn't really optimize early on for, let's say, content delivery for instance, suddenly you're delivering video, which is obviously a lot more expensive, and people are ha...
For us, for my team in particular, the biggest scale challenge we were going through was the team growing. So like I said, my team specifically was ten people, now the entire ads infrastructure org is probably getting close to about 100. The ads team is probably three to four times that number. So the question we were ...
For instance, for rolling out new experimental models, do I need to actually go and read exactly how those models are going to be chosen? Do I need to understand what features have been fed into my model? Do I need to understand how those scores have been used? Or can I just go in and make a simple JSON change or somet...
So those are the things that have been really on our minds constantly, and something we're looking to continuously improving. In fact, the pre-submit test framework was one way that we did that, is anyone can go and make a config change to add a new metric and add a new slice, without affecting how any of the rest of t...
Our actual ads delivery system isn't fully there yet. We're continuing to improve this for developers, making it easier for them to make changes, a) without bringing down the system, b) without blocking other folks or needing to understand how your change interacts with someone else's. But like I said, it's the eternal...
Something as simple as if we need to serve - these are some of the problems that we've solved perhaps, but if we need to serve both video and image ads for the same request, do we have a good way of doing that? Not a particularly hard thing if you're building a system from scratch, obviously, but once you've built it w...
\[31:48\] And again, what ends up typically happening - I think this is probably true for most big companies - is you obviously need to get that MVP out, so you do something a little hacky to start out with, and then you retroactively go in and ensure that a) it's not gonna break anything, and b) how do we make this a ...
**Jon Calhoun:** Jonny had asked you about existing services where you didn't take all that stuff into consideration... Do you find yourself now when you're building something new that you actually look at things like flame graphs, and garbage collection, and try to optimize those things upfront, now that you know you'...
**Nishant Roy:** Yes, and the reason it's become a lot easier is because our amazing infra team Pinterest-wide has actually provided better tooling for us to do those things more automagically out of the box. So rather than us needing to write a manual script to go run a profile on our Go system, we essentially have a ...
And honestly, a large part of it was driven in a voluntary manner; folks who were interested in thinking about performance, and saving in infra costs, saving in latency, would sort of just on their own time go and run these profiles and identify hotspots. Alternatively, if we hit certain system limitations. So let's sa...
**Johnny Boursiquot:** Did you suffer from -- like, during this growth phase, did you suffer from team silos? Basically, a team out of necessity having to create their own tooling, adopt their own ways of doing things, and then now trying to do this company-wide having to disentangle teams from the way they know how to...
**Nishant Roy:** Yeah, to some extent. So definitely for us being on the ads team, like I said, we were the only major online service in Go at that point, so we were definitely building our own tools, we owned our own deploy systems, our own testing systems etc. There has been a divergence there, in how different teams...
Within ads itself, I think one thing we saw is that because of a lack of that centralized framework from our side, from the ad-serving infra side, different teams sort of built their own products, even within the ads stack; they wrote their own code. And that caused some divergence in a few different ways. So the code ...
So going back to batching as an example, my former manager just essentially took one day and wrote a library that made it really easy to run things in batches in Go. So taking away the requirements, but not the ability... Taking away the requirement for engineers to understand how goroutines work, and do so in a way th...
**Johnny Boursiquot:** \[36:13\] How do you record and communicate infrastructure decisions within your teams, or even to broader teams, other teams that might learn from them?
**Nishant Roy:** That's a great question. Overall, Pinterest now has a much better standardized documentation template for these large, new services or new changes that are being rolled out... And all of that information essentially is saved permanently on our internal drives etc. For sort of smaller things... So if my...
The gap there is obviously in an environment where all those folks suddenly leave at a similar period of time. Hopefully, that doesn't happen. It would require somebody to go in and read those Production Readiness documents again, to understand the reasoning behind everything.
For larger product launches, we have an email alias within the company where essentially every time you want to launch an ads experiment that is moving some significant top-line metrics, you need to send out an email to this alias before you get launch approval. And at least that serves as providing everyone in the mon...
I think what's worthwhile is probably this behavior of just publicizing it to everyone once the decision is going out, so that even if the top 10% of the leadership team leaves, there's probably at least enough people who know where to find the rationale behind that decision. So I assume that's what's worked pretty wel...
**Break:** \[38:42\]