Article
Distributed computing
Scientists want to study how proteins in the human body fold into their shapes. The calculations are so big that one computer would need thousands of years. So they ask thousands of ordinary people to lend their computers' spare time. Each computer solves one small piece, and a central computer puts the pieces together. This is distributed computing.
Many devices, one problem
In distributed computing, multiple devices (computers, phones, servers) are connected by a network, and together they run one program. The problem is split into parts. Each device works on a part, and sends its result back.
A distributed system
How does it differ from the other two models?
| Model | How the work is done | Example |
|---|---|---|
| Sequential | One processor, one step at a time | A simple program on an old calculator |
| Parallel | Several processors, usually inside one computer, some tasks at the same time | Filtering a photo on a 4-core laptop |
| Distributed | Many separate devices linked by a network, each doing a part | Thousands of volunteers' computers working on one science project |
Check your understanding
Which statement describes distributed computing?
Why use many devices?
Some problems are too big for one computer. There are two ways in which a problem can be too big:
- Too much work. One computer would need years. A thousand computers each doing a thousandth of the work could finish in days.
- Too much data. The data does not fit on one computer's storage. A search engine stores copies of billions of web pages. No single disk could hold them, so the pages are spread over very many machines. A search is sent to all of them, and each one searches its own pages.
Distributed solutions can scale. If the problem grows, you add more devices. They can also keep going if one device breaks, because the others carry on.
What it costs
Distributed computing is not free.
- Communication. Parts and results travel across the network. That is much slower than passing data around inside one computer, and it takes time that a single computer would not need.
- Coordination. Someone must split the job, send the parts, collect the results and combine them. A device that is slow, or that fails or goes offline, must be noticed, and its part given to someone else.
- Trust and privacy. If strangers' computers help, a result may be wrong by accident or on purpose. Data sent to other devices may need protecting.
- Some parts still run alone. Splitting the job and combining the results happen in one place, so the sequential part limit from the last article still applies.
One round of a distributed job
- 1
Coordinator → Device 1
part 1 of the data
- 2
Coordinator → Device 2
part 2 of the data
- Both devices work at the same time.
- 3
Device 1 → Coordinator
result 1
- 4
Device 2 → Coordinator
result 2
- The coordinator combines the results.
Check your understanding
Which is a cost of distributed computing that a single computer does not have?
Worked example: counting words
A company must count the words in 1,000,000 documents. One computer needs 1,000 seconds. With n devices, each does 1/n of the documents. Assume that sending out the parts and collecting the results costs 10 seconds in total, whatever the number of devices.
| Devices | Work per device | Communication | Total time | Speedup |
|---|---|---|---|---|
| 1 computer | 1,000 s | none | 1,000 s | 1 |
| 10 | 100 s | 10 s | 110 s | about 9.1 |
| 100 | 10 s | 10 s | 20 s | 50 |
| 1,000 | 1 s | 10 s | 11 s | about 90.9 |
Ten times more devices (from 100 to 1,000) made the job only 9 seconds faster. By then, almost all the time is communication. The more devices, the more the costs matter. More devices usually help, with diminishing returns, as with parallel computing.
Common mistakes
- "Distributed and parallel mean the same." Parallel computing uses several processors, usually in one machine. Distributed computing uses several separate devices connected by a network.
- "Distributed is always faster." Not for small jobs, or when communication takes longer than the work saved.
- "The devices do not need to talk." They do. They receive their parts and send back their results.
- "Every device runs the whole program." Each device handles a part of the problem.
- "It only works for volunteers." Big companies run distributed systems in their own data centres, such as the machines behind a search engine.
- "If one device fails, everything fails." A well-designed system carries on, and the failed device's part is given to another.
On the exam
You may be asked to compare sequential, parallel and distributed solutions, or to say why a problem needs a distributed solution: the processing time or the storage it needs is too much for one computer. You may also be asked about the costs, such as communication time. Remember the definition: multiple devices are used to run a program.
Key words
Distributed computing: using multiple devices, connected by a network, to run a program.
Coordinator: the device that splits the job, sends out the parts and combines the results.
Communication cost: the time taken to send data between devices over a network.
Scale: to cope with a bigger problem, here by adding more devices.