Thursday, 22 July 2010

web server is stateless

Why web server is stateless?

  • all http server are stateless to make desin simple and no need to worry about allocating memory to deal with conversion in progress.
  • If a client dies in mid-transaction, no part of the system needs to be responsible for cleaning the present state of the server.
  • A disadvantage is that it may be necessary to include additional information in every request and this extra information will need to be interpreted by the server.
  • In contrast to HTTP server, ftp server is keep the session for active user and send/upload the files based on that session.

Protocols used in client server architectures:
at network level

TCP - Transmission control protocol used to deliver the data packet on netork

IP - Internet protocol used for redirecting packets to thier destinetion

UDP - User datagram protcol used for small amount of information

ICMP - Internet control message protocol used for ping and traceroute


Mail protocols

SMTP - simple mail transfer protocal used for sending mail over TCP

POP3 - Post office protocol v3 used for reading mail over tcp

IMAP - Interactive mail access protocol used for reading mail over TCP. Better synchrinization compare to pop3


Webpage protocol:

HTTP - Hypertext transfer protocol used to transfer web page over TCP/IP and to rendered at client side
HTTPS - Hypertext transfer protocol over secure socket used same as http with additional security for ecure data as data is encrypted


File transfer
FTP - File transfer Protocol used for sharing, uploading and downloading files over the network.
TELNET A terminal emulation program for TCP/IP networks such as the Internet
DNS

webservers:

Apache

IIS



Clients:

IE

email client

chat client

Advantages

  • In most cases, a client-server architecture enables the roles and responsibilities of a computing system to be distributed among several independent computers that are known to each other only through a network. This creates an additional advantage to this architecture: greater ease of maintenance. For example, it is possible to replace, repair, upgrade, or even relocate a server while its clients remain both unaware and unaffected by that change.
  • All the data is stored on the servers, which generally have far greater security controls than most clients. Servers can better control access and resources, to guarantee that only those clients with the appropriate permissions may access and change data.
  • Since data storage is centralized, updates to that data are far easier to administer than what would be possible under a P2P paradigm. Under a P2P architecture, data updates may need to be distributed and applied to each peer in the network, which is both time-consuming and error-prone, as there can be thousands or even millions of peers.

  • Many mature client-server technologies are already available which were designed to ensure security, friendliness of the user interface, and ease of use.
  • It functions with multiple different clients of different capabilities.

Disadvantages

Traffic congestion on the network has been an issue since the inception of the client-server paradigm. As the number of simultaneous client requests to a given server increases, the server can become overloaded. Contrast that to a P2P network, where its aggregated bandwidth actually increases as nodes are added, since the P2P network's overall bandwidth can be roughly computed as the sum of the bandwidths of every node in that network.

  • The client-server paradigm lacks the robustness of a good P2P network. Under client-server, should a critical server fail, clients’ requests cannot be fulfilled. In P2P networks, resources are usually distributed among many nodes. Even if one or more nodes depart and abandon a downloading file, for example, the remaining nodes should still have the data needed to complete the download

How to make a class singleton

I have been wondering about the ways a class can be made singleton. One way I know of is to make the constructor of the class private. Add another method in the class which would first check if an instance of the class exists or not. In case it exists, it returns the same instance else creates a new instance.


public class MyClass {

private static MyClass myClassInstance = new MyClass ();

public static MyClass getInstance() {
if(null== myClassInstance )

{
myClassInstance = new MyClass ();
}
return myClassInstance ;
}

private MyClass () {
}

}

PLease share your knowledge.

Wednesday, 21 July 2010

Exposure to LAMP platform


Around 4 years back when i started my career IT. I was assigned Drupal Stuff. As new to software world