Computer Programming for Absolute Beginners
上QQ阅读APP看书,第一时间看更新

Distributed applications

A distributed application is an application that does not run on one single machine, but instead lets different parts of the program run on multiple computers that communicate with each other over a network. This might sound like the client-server solutions we talked about earlier, but here we don't have the distinct roles of a client and a server.

There could be several reasons to use this solution. One may be that what we are doing requires so much computing power that a single computer will not be enough. The idea is to use the computing power of many computers and distribute the calculations to all of them, letting each computer work on a small section of the problem and communicate the results to the other machines in the network. This will give us something of a supercomputer that will act as a very powerful single machine running a single application, when it is actually thousands of computers running small inpidual parts of the application.

Let's explore distributed applications in more detail.

SETI@home

An example of a project that uses this technique is SETI (short for Search for Extraterrestrial Intelligence), a scientific project trying to find extraterrestrial intelligence in outer space. To do this, they use radio telescopes to collect lots of data. The problem is that all this data needs to be analyzed in the search for a signal that can be of intelligent origin. The solution they use is to let people help them out either by installing a screensaver on their computer or a special program that will use the computing power of that computer when it is not used for any other task. By doing this, they will have the power of all these computers to do the analysis, and they will report back the result of the part of the data that was assigned to them.

You can try this out yourself by visiting https://setiathome.berkeley.edu/ and installing the program:

Figure 3.10 – SETI@home analyzing data. Copyright 2019 UC Regents. Used with permission

Peer-to-peer networks

A peer-to-peer network, also known as P2P, is a network of computers that are equal participants in the network. Each computer in the network is called a node, or a peer, and they make portions of their resources, such as processing power or disk storage, directly available to other participants in the network. This technique was popularized by file-sharing systems such as Napster in the late '90s. A peer in the network is both a supplier and a consumer of resources. This is what makes this solution different from a traditional client-server model in which the supply and consumption of resources are pided between the server and the client:

Figure 3.11 – A P2P network where computers, or peers, are connected without a server

Today, P2P networks are used by most cryptocurrencies making up a large portion of the blockchain industry (simply put, a blockchain is a database stored in separate copies on many nodes in a P2P network.). P2P is also used by web search engines, streaming platforms, and online marketplaces.

Next, we look at cloud-based applications.