It's not sufficient to just assemble a large number of machines to do a particular task. You actually have to figure out how do I divide that task effectively across those multiple machines. So, a number of companies that built up data centers in the late 90s and early 2000s were facing this problem. They had data centers, they had lots of machines, they had big jobs that they needed to do, like building search indexes, crawling the web. But there was this question of how do I split those jobs up? And what emerged out of that challenge was a programming model that was quite popular. It's still in use today, although I think we're starting to develop some more sophisticated alternatives. But it's something known as map reduce. And so I want to talk a little bit about map reduce because it's a pretty important part of how search was done for a long time. So map reduce is a programming model. It's a way of structuring your computation that allows it to easily be run on lots of machines. So the way to think about it is you have a job to do if you organize your job in a particular way, if you organize your computation in a particular way, then it's very easy for that computation to take advantage of huge numbers of machines. So I write my job using the map-produced framework. And then if I have 100,000 machines available, I can run my job potentially on 100,000 machines. So that's pretty cool. That's a nice thing. Let's talk about how map reduce works. So map produces forces you to break what you're trying to do into three stages. The first is map. The second is a shuffle stage. And the third one, as hinted by the name, is reduce. Let's talk about how map, shuffle, and reduce work. And let's do that in context of the most famous map-produced example of all time, even if it's kind of dumb, which is this idea of how would I count the number of times that a word appeared at a document. So I've got four, let's say I've got two computers, but this example should scale for larger numbers. And I have four documents. OK, here's document one, document two, document three, document four. But you can imagine I had a billion documents and a hundred dollars of computers, and this still works. That's the beauty of the map-produced framework. The first thing I'm going to do is I'm going to divide the documents between the different computers. So I'm going to assign these two documents to this guy, and I'm going to assign these two documents to this guy. And now, so this is the map phase. And what each computer is going to do is this going to produce a count of the number of times that a particular word appeared in the documents. So what I get out here is I might get something, I get a key value, I get a set of keys and values, and the key might be the word cat appeared ten times, and the word dog appeared three times. And in these documents, the word cat appeared 24 times, and the word dog appeared five times. Obviously, this is a cat loving instead of documents. OK, so these are computed by these computers. And again, the nice thing about the map phase, or the way the map phase has to be set up, is there's no local, no communication between these machines that's allowed during the map phase. So the machine just processes the documents that's given. So if I have a hundred thousand documents and a hundred thousand computers, each computer processes one document. If I have a million documents and a hundred thousand computers, each computer processes ten documents. So I process my documents. And now what I do is in the shuffle and a sort stage, I take these keys and I, so now I have two more machines and I'm going to use in the reduced stage. And these could be the same machines, or they could be different machines. It doesn't matter. What the shuffle stage is going to do is it's going to sort these keys so that the reduced stage gets the same key. So in this case, this, this reducer is going to get all the cat keys, and this reducer is going to get all the dog keys. And all I do in the reduced stage is I take the results from the map stage, and I combine them together. So map is the process of splitting all the inputs among a bunch of machines and then reduce takes the results from the map stage and combines them together to get the one result that I'm looking for. So in this case, what I would do is I would combine cat and cat, so ten plus twenty four. This, this reducer would produce cat thirty four and I've got dog five and dog three. So this reducer would produce dog eight. And then I've done. And now I have what I wanted, which is a key value map of the time that every word in these documents appear. The nice thing about map produce is that, you know, the programming framework on some levels fairly limited. It's quite structured. It forces you to set up your computation in a way that it can be done on many machines, but it's also fairly restrictive. There are certain types of computation that don't fit very well into the map produced framework. This time has gone on, people have developed more powerful frameworks that just some degree are generalizations on top of map produce. They make map produce more powerful. They give you more than just map and reduce. They give you more features. They allow the notes to do more work. But this idea of creating a programming model that allowed you to easily use hundreds of thousands of machines is a very powerful one and it's one that we see over and over again today.