Sunday, April 1, 2012

Client Server Architecture


The internet revolves around to concept of a client-server architecture. What this means is that someone (a client) is requesting information from another person (a server). There are however no rules in defining exactly if a particular machine is only a server or only a client. A testing workstation can have a running instance of a server for example while being also a client. Here we will talk mostly about the WWW client server architecture.

To view websites and web services, an internet user makes use of a browser. The browser is the client side of the architecture. There are a lot of browsers such as Internet Explorer, Google Chrome, Mozilla Firefox and more. These browsers use a set of predefined protocols to connect to web servers anywhere in the world. Web servers can be running on the same machine for testing purposes, in the same office, and also on the other side of the world. The location of the server does not really matter. The only must have there is is that there is internet connectivity between the two. Below we can see a normal 2 Tier Architecture where a browsers makes a request to a Web Server. This is normally the case when accessing a simple static website.

Figure 1: Simple Two Tier Architecture – a Browser and a Server

Below we can see a 3 Tier Architecture. This is the case when we access a large system like for example a large online shop such as www.amazon.com.
Figure 2: 3 Tier Architecture – a Browser, an Application Server and a Database Server

Protocols

Browsers use a set of predefined commands to communication with servers. These are known as protocols. These protocols ensure that the data that needs to be transferred is transferred accurately and also securely. Not all protocols include embedded security features, but most protocols have a substitute including security measures and encryption such as HTTPS for HTTP. Several protocols are used in the client server architecture. These include HTTP, HTTPS, FTP, SFTP, SMTP, POP3, IMAP, SSH, Telnet and many more. HTTP and HTTPS, are Hyper Text Transfer Protocols, the later based on SSL for security, and are used to transfer text and images from the web server to the client browser. FTP and SFTP are File Transfer Protocols and are used to transfer files from a client to a server or vice versa. SFTP uses SSH. SMTP, Simple Mail Transfer Protocol is used to send emails. POP3, Post Office Protocol, and IMAP, Internet Message Access Protocol, are used to receive emails. SSH, Secure Shell and Telnet are used to connect to devices without a user interface. 

Transport Layer

In networking, Transport Layer (OSI Layer 4), provides end-to-end communication service for application. The two mostly used common transport protocols are TCP and UDP. TCP stands for Transmission Control Protocol while UDP stands for User Datagram Protocol. Two other protocols are available DCCP (Data Congestion Control Protocol) and SCTP (Stream Control Transmission Protocol). However, the latter two are not commonly used. TCP provides a secure way of transferring data. It uses a connection oriented mechanism that splits a file into segments and gives each segment an ID. This is used for queuing segments after each other and also to check that all segments have been received, while resending segments which were lost during the transmission. However this creates a small overhead making TCP slower than UDP and not useful in certain situations. UDP on the other hand splits data into segments and sends it one after the other. It does not establish a connection and does not resend lost segments. This is useful making this protocol consume less bandwidth and also ideal for streaming video and voice.

Ports

Ports are specified in the packet header. These packets contain a source port and destination port. The number of ports range from 0 to 65535. The numbers from 0 to 1023 are known as the well known ports and are defined by the Internet Assigned Numbers Authority (IANA). These are a list of reserved ports which cannot be used for anything else except for already defined service. Among these we find port 80 (HTTP), 443 (HTTPS), 20 and 21 (FTP), 22 (SSH), 23 (Telnet), 25 (SMTP), 110 (POP3), 143 (IMAP) and more. The numbers above 1023 are used for other purposes, such as the source port from a client browser and also for testing such as the normal use of port 8080. When a browser needs to connect to a web server to show a website, the TCP protocol issues a source port with a number greater than 1023, such as port 25000, and a destination port of 80, the default port of a web server. Ports belong to the Layer 4 of the OSI Layer Model seen below.


Figure 3: The OSI Layer Model

Domain Name System

Domain Name System is a hierarchical distributed naming system for computers, devices and other resources using IP networks. DNS translates queries for Domain Names, words which human beings are used to understand and remember quickly into IP addresses, which are a series of numbers without any particular meaning and extremely hard to remember. This service can be used over the internet to reach websites and resources, such as www.google.com instead of using its IP address of 173.194.35.176, and Daniel-PC instead of 192.168.1.79.


Figure 3: DNS Hierarchy Example

This system uses a system of hierarchy. This means that it consists of zones underneath each other. At the top we find the root of the DNS, the . After this there are the top level domains, .com, .net, and more. Then there are the domain names, such as eurosport, google and more. After these there are the sub domains such as premierleague, mail and more. These will be formed like this: premierleague.eurosport.com and mail.google.com. The . at the end is omitted. When there is a request for mail.google.com, there will be a request to the root DNS server which replies with the address of the .com DNS server. There is a request to this server for the same address to the .com DNS which in turn will return the address of the google DNS server. Then this server will return the address of the mail.google.com because he will be the authoritative DNS for the google.com domain and he will know the exact address of the mail.google.com server. This example is illustrated below

Figure 4: DNS Request Example

1 comment: