Video
Đăng bởi Quản trị viên OpenER ·
Tác giả giữ toàn bộ bản quyền (All Rights Reserved) — không phải giấy phép mở. Bạn vẫn xem và học miễn phí trên OpenER; muốn tái sử dụng cần xin phép tác giả.
DAN GARCIA
And welcome back. Our next video is going to talk about request-level and data-level parallelism. You've seen this picture before.
We keep revisiting it as we continue to share the wonders of parallelism in all its different manifestations. Today, we're going to talk about two elements.
One is the topmost parallelism, which is parallel requests, top-level idea that I'm going to search for cats on a computer and how that works at the top level.
We're also going to talk about a model of computation called MapReduce in which, if I kind of think functionally about my data, I can think of it by saying, I've got an array of a million numbers.
I wouldn't mind being able to just say, square them all and then add them all up.
And I can think of that — the abstraction allows us to be able to deal with it from a programmatic standpoint to just say, square them all. Done.
No loop. Square them all. So I'm thinking about doing more than one data at a time. And up till now, you've thought about, well, that just means SIMD.
That means you're operating on four vectors — a vector that's wider, maybe four floats wide, and you say, add that with another vector at the same time.
That's what we used to think about that box. But now we're going to think about that box in an abstraction point of view.
That computation of squaring a million numbers could happen by me farming that out to a million computers or a million cores — and there's some models where you have a million cores on one computer.
I farm it out somehow. Each one of these guys grabs a number. Is it a core? Is it a computer?
Who cares? Each element, each worker element, will grab the number, square it, and return it instantly. And that all somehow magically comes back to it.
So you can still think — this kind of new abstraction allows you to think in that model, where I was adding four — I said, add four vectors.
So even though I have four floats, and I'm adding to another float, I'm just adding a vector to another vector, and it's really four floats being added all at once.
That's really wonderful, the same idea in the abstraction idea of working with parallel data. Pretty neat. So we're going to talk about some very powerful abstractions in this series of lectures.
So let's request-level parallelism? If you've ever thought about what web servers have to handle, this is request-level parallelism, just hundreds of thousands of requests a second.
And when that number exceeds what the machine can handle, it becomes a distributed — a DDoS attack, it becomes an attack that the system is now pinned, just trying to breathe and trying to move around.
And with just enough denial-of-service requests, you can make a denial-of-service attack and distribute this with a lot of computers all focusing on one server by making it try to deal with that.
So when it's in this comfort zone, that's what we're talking about, but you can exceed that to get to this, and you'll learn about this in 161, a denial-of-service attack.
So imagine you're a server, and your job is to just react to requests. And you can make it — by the way, it's really fun to make your own web server.
I encourage you to think about that. Make a web server that serves some interesting data. Maybe you have some sensor that's doing something fun or taking a picture or doing something.
I don't know — measuring something in your house, how much a plant grows. And make a server that will be able to respond to requests and give the data.
Here's how big the plant has grown today, or here's what my camera is seeing. Play with that.
It's fun to explore that now that you're all kind of becoming more and more fluent computer scientists and hackers, in some sense. Play with that. It'd be fun to do.
So each of these requests is largely independent.
If you were to release your plant-growing data service to the world, you might have people all around the world, and even from the Space Station, hitting your server, asking for it.
I want to know how tall that plant is right now. Kind of exciting, but one of the elements of this is all these requests are mostly independent.
And maybe it's one person hitting it a lot because they want to chart a graph, and so they're hitting it.
Maybe your service also lets you query past growth values, and so you've made a little table, and so you're able to get the current growth value, maybe past ones.
So maybe someone's sweeping through all the valid dates and hitting yours a lot, but most of the time, they're largely independent.
Most of the time, these are reading from large databases or large data centers. Some way, you're collecting and serving data.
Again, you'll learn this in CS 186 if you ever wanted to learn about how to build one of these officially, but you can probably roll your own pretty easily as well.
They're rarely involved with — it says it's strictly read-write data sharing or synchronization across requests. So mostly, these are just lots of these requests happening at once, and mostly, they're reads.
Mostly, they're reads. Sometimes they're writes, but mostly, they're reads. If you're handling a Piazza, who handles Piazza? Think about all the services you use that are read-write — Facebook, Piazza.
I'm editing something, and I want it to be stored and be seen around the world.
That cloud software, which we'll learn a little bit about how cloud warehouse-scale computing works in another lecture — certainly, if you have new web services, you're not just read-only.
You'd be able to interact in a social media way. So that's important too, and obviously they're writes there as well. The computation is easily partitioned within a request and across different requests.
So these things — each one can be an atomic request — a person says, type this thing in and hit edit.
And by the way, you might have seen this before, where two people are editing the same Piazza post, and they'll say, oh, there's a conflict, because both of you are trying to hit the same thing.
There's got to be a way to handle these in a race condition. Who gets to write it first? And Piazza does a nice job.
That's being edited already, if ever there's a question on an exam, and many of the TAs try to answer the question — I'll get that. I've gotten that several times this semester.
So the software still has to be able to be resilient to that kind of thing as well. Here's an example of Google's query-serving architecture.
You hit the Google web server, and the first thing it does is do a spell checker and grab some ads.
I mean, the ads are the most important thing from Google's point of view, because that's where the monetization is. You've searched for, I want to find the best shoes in Berkeley.
Well, you bet your bottom dollar that somebody who sells shoes around Berkeley would be incentivized to pay Google so that their possible search return — there's a link to their company, shows up very early.
And there's a whole way that if I really need to — my funders have told me, I need to ramp up my sales because of something, and so I'm going to pay Google a little bit more money so it's more prominent, or it comes up in even farther away searches, even — How about sneakers?
Well, I'd maybe have to pay to get into the sneakers there. So ad serving is really important there. It first has to go and look up its index.
It's already built in. By the way, many people naively think that when you type something, it then starts to search the web. It doesn't at all.
It's been crawling the web continuously, building a huge index, a huge index database. And so it knows where the documents might live. These index servers — by the way, notice that they're in parallel.
This is drawn that way to indicate that there are a lot of these guys. There's no way that this is hitting one really fast machine.
This is hitting a lot of machines, and they're coming back, and it's being aggregated. So the interesting part is, what's happening here? How is it being aggregated through those all requests coming back in?
So here's your page, and I get, okay, great. And I'm going to grab a document and click on this, and then the document might get fed from there as well and returned as well.
So, exciting that Google certainly has an architecture that has a front page. It's doing spell checking. It's serving its ads.
That's a really big deal, bringing up its index to find out what the list is of your possible links to there, as well as documents that's being stored and farmed to feed the index servers as well.
Data-level parallelism, you've seen a little bit before. There's data in memory.
You've got a little bit — you've got an array, and I want to be able to attack this with all the cores I have to attack, and so that's very, very common.
What you haven't seen so much of that we're going to introduce in these series of lectures is data across many disks. I've got this massive — we call this big data.
I've got data so big, I can't fit it in memory. I have to fit in a disk.
I can read a portion into memory and work with it, but that's the biggest I can do it.
So how would you be able to — even if not just in one disk, one big, let's say, RAID disk.
You don't know what RAID is yet, but one big set of disks on my computer that looks as maybe one virtual disk but actually is many disks as an abstraction.
But no, it's so big that it can't even fit in one disk. It has to fit on many disks. And maybe those disks live in the cloud. So that's called cloud storage.
How would you — well, it would be nice. It'd be sure nice if we had an abstraction to be able to type some commands and have it be able to work over those disks.
That's what what we're going to teach in this next series of lectures.
MapReduce is this wonderfully powerful idea, an abstraction, a software infrastructure, an open-source software infrastructure now, thankfully, that we can all play with and all experiment with that lets you work across many, many disks.
It's a file-to-file model. It's very, very exciting. So that's today's lecture, and series of lectures is about MapReduce and an implementation of that, which is really quite clever, called Spark as well.
So we'll see you in the next couple of lectures, and we'll see there.
Đăng nhập để đánh giá học liệu này.
Đăng nhập để bình luận — chưa ai bình luận về học liệu này.
Không có khóa học liên quan.