Before diving into software coding, you should have a broad architectural plan for your application. Keep in mind that an application’s architecture is distinctly different from the network architecture. From the application developer’s perspective, the network architecture is fixed and provides a specific set of services to applications. The application architecture, on the other hand, is designed by the application developer and dictates how the application is structured over the various end systems. In choosing the application architecture, an application developer will likely draw on one of the two predominant architectural paradigms used in modern network applications: the client-server architecture or the peer-to-peer (P2P) architecture.
In a client-server architecture, there is an always-on host, called the server, which services requests from many other hosts, called clients. The client hosts can be either sometimes-on or always-on. A classic example is the Web application for which an always-on Web server services requests from browsers running on client hosts. When a Web server receives a request for an object from a client host, it responds by sending the requested object to the client host. Note that with the client- server architecture, clients do not directly communicate with each other; for example, in the Web application, two browsers do not directly communicate. Another characteristic of the client-server architecture is that the server has a fixed, well- known address, called an IP address (which we’ll discuss soon). Because the server has a fixed, well-known address, and because the server is always on, a client can always contact the server by sending a packet to the server’s address. Some of the better-known applications with a client-server architecture include the Web, F1’R Telnet, and e-mail.
Often in a client-server application, a single server host is incapable of keeping up with all the requests from its clients. For example, a popular social-networking site can quickly become overwhelmed if it has only one server handling all of its requests. For this reason, a cluster of hosts-sometimes referred to as a server farm-is often used to create a powerful virtual server in client-server architectures. Application services that are based on the client-server architecture are often infrastructure intensive, since they require the service providers to purchase, install, and maintain server farms. Additionally, the service providers must pay recurring interconnection and bandwidth costs for sending an4 receiving data to and from the Internet. Popular services such as search engines (e.g., Google), Internet commerce (e.g., Amazon and e-Bay), Web- based v-mail (e.g, Yahoo Mail), social networking (e.g., MySpace and Facebook), and video sharing (e.g., YouTube) are infrastructure intensive and costly to provide.
In a P2P architecture, there is minimal (or no) reliance on always-on infrastructure servers. Instead the application exploits direct communication between pairs of intermittently connected hosts, called peers. The peers are not owned by the service provider, but are instead desktops and laptops controlled by users, with most of the peers residing in homes, universities, and offices. Because the peers communicate without passing through a dedicated server, the architecture is called peer-to-peer. Many of today’s most popular and traffic-intensiye applications are based on P2P architectures. These applications include file distribution (e.g., BitTorrent), file searching/sharing (e.g., eMule and LimeWire), Intemet telephony (e.g., Skype), and IPTV (e.g., PPLive).
Kabla ya kupiga mbizi katika programu coding, unapaswa kuwa na mpango mkubwa wa usanifu kwa ajili ya maombi yako. Kumbuka kwamba usanifu wa maombi ni tofauti kabisa na usanifu wa mtandao. Kutoka mtazamo wa msanidi programu, usanifu wa mtandao ni fasta na hutoa seti maalum ya huduma kwa maombi. Application usanifu, kwa upande mwingine, ni iliyoundwa na developer maombi na inaamuru jinsi maombi ni muundo juu ya mifumo mbalimbali ya mwisho. Katika kuchagua usanifu wa maombi, msanidi programu ya uwezekano kuvutia moja ya mbili predominant usanifu paradigms kutumika katika maombi ya kisasa mtandao: mteja-server usanifu au peer-to-peer (P2P) usanifu. Katika usanifu wa mteja-server, kuna daima-on mwenyeji, aitwaye server, ambayo huduma maombi kutoka majeshi mengine mengi, aitwaye wateja. Wamiliki wateja inaweza kuwa ama wakati mwingine-juu au daima-juu. Mfano wa kawaida ni maombi ya mtandao ambayo daima-on huduma za seva ya mtandao maombi kutoka browsers mbio juu ya wateja majeshi. Wakati seva ya mtandao anapokea ombi kwa ajili ya kitu kutoka mwenyeji mteja, ni kujibu kwa kutuma kitu aliomba kwa mwenyeji mteja. Kumbuka kwamba na mteja-server usanifu, wateja si moja kwa moja kuwasiliana na kila mmoja; kwa mfano, katika maombi ya mtandao, browsers mbili si moja kwa moja kuwasiliana. Sifa nyingine ya usanifu mteja-server ni kwamba seva ina fasta, inayojulikana anwani, aitwaye anwani ya IP (ambayo tutazungumzia hivi karibuni). Kwa sababu server ina fasta, anajulikana anwani, na kwa sababu server ni daima juu, mteja daima inaweza kuwasiliana na server kwa kutuma pakiti kwa anwani server ya. Baadhi ya maombi bora inayojulikana na usanifu mteja-server ni pamoja na Web, F1<unk>R Telnet, na barua pepe. Mara nyingi katika maombi ya mteja-server, mwenyeji mmoja wa seva hawezi kushikilia maombi yote kutoka kwa wateja wake. Kwa mfano, tovuti maarufu ya mitandao ya kijamii yaweza kuzidiwa haraka ikiwa ina seva moja tu inayoshughulikia maombi yake yote. Kwa sababu hii, kundi la majeshi - wakati mwingine inajulikana kama shamba la seva - mara nyingi hutumiwa kuunda seva yenye nguvu ya virtual katika usanifu wa mteja-server. Huduma za maombi ambazo zinategemea usanifu wa mteja-server mara nyingi ni miundombinu ya nguvu, kwa kuwa zinahitaji watoa huduma kununua, kufunga, na kudumisha mashamba ya seva. Kwa kuongezea, watoa huduma lazima walipe gharama za mara kwa mara za kuunganisha na bandwidth kwa kutuma na kupokea data kutoka na kwenda Mtandao. Huduma maarufu kama vile injini za utafutaji (kwa mfano, Google), biashara ya mtandao (kwa mfano, Amazon na eBay), mtandao-msingi v-barua pepe (kwa mfano, Yahoo Mail), mitandao ya kijamii (kwa mfano, MySpace na Facebook), na video kushiriki (kwa mfano, YouTube) ni miundombinu makali na gharama kubwa kutoa. Katika usanifu wa P2P, kuna utegemezi mdogo (au hakuna) kwenye seva za miundombinu ya daima. Badala yake maombi exploits mawasiliano ya moja kwa moja kati ya jozi ya majeshi intermittently kushikamana, aitwaye wenzao. Peer sio mali ya mtoa huduma, lakini ni desktops na laptops kudhibitiwa na watumiaji, na wengi wa wenzao wanaoishi katika nyumba, vyuo vikuu, na ofisi. Kwa sababu wenzao kuwasiliana bila kupita kupitia seva ya kujitolea, usanifu inaitwa peer-to-peer. Wengi wa leo maarufu na trafiki-intensive maombi ni msingi juu ya P2P usanifu. Programu hizi ni pamoja na usambazaji wa faili (kwa mfano, BitTorrent), faili kutafuta / kushiriki (kwa mfano, eMule na LimeWire), Intemet simu (kwa mfano, Skype), na IPTV (kwa mfano, PPLive).