ClientServer Architecture

his chapter defines distributed processing and how the Oracle Server and database applications work in a distributed processing environment. This material applies to almost every type of Oracle database system environment. This chapter includes: The Oracle Client/Server ArchitectureSQL*Net

his chapter defines distributed processing and how the Oracle Server and database applications work in a distributed processing environment. This material applies to almost every type of Oracle database system environment. This chapter includes:

The Oracle Client/Server ArchitectureSQL*Net

Although the client application and Oracle can be executed on the same computer, it may be more efficient and effective when the client portion(s) and server portion are executed by different computers connected via a network. The following sections discuss possible variants in the Oracle client/server architecture.

Note:

Distributed ProcessingDistributed processingis the use of more than one processor to divide the processing for an individual task. The following are examples of distributed processing in Oracle database systems:

The client and server are located on different computers; these computers are connected via a network (seeFigure 20 – 1, Part A).A single computer has more than one processor, and different processors separate the execution of the client application from Oracle (seeFigure 20 – 1, Part B).

The Client/Server Architecture and Distributed Processing

Client applications are not responsible for performing any data processing. Client applications can concentrate on requesting input from users, requesting desired data from the server, and then analyzing and presenting this data using the display capabilities of the client workstation or the terminal (for example, using graphics or spreadsheets).Client applications can be designed with no dependence on the physical location of the data. If the data is moved or distributed to other database servers, the application continues to function with little or no modification.Oracle exploits the multitasking and shared-memory facilities of its underlying operating system. As a result, it delivers the highest possible degree of concurrency, data integrity, and performance to its client applications.Client workstations or terminals can be optimized for the presentation of data (for example, by providing graphics and mouse support) and the server can be optimized for the processing and storage of data (for example, by having large amounts of memory and disk space).scaled. As your system grows, you can add multiple servers to distribute the database processing load throughout the network (horizontally scaled). Alternatively, you can replace Oracle on a less powerful computer, such as a microcomputer, with Oracle running on a minicomputer or mainframe, to take advantage of a larger systems performance (vertically scaled). In either case, all data and applications are maintained with little or no modification, since Oracle is portable between systems.In networked environments, inexpensive, low-end client workstations can be used to access the remote data of the server effectively.In networked environments, client applications submit database requests to the server using SQL statements. Once received, the SQL statement is processed by the server, and the results are returned to the client application. Network traffic is kept to a minimum because only the requests and the results are shipped over the network.

SQL*Net uses the communication protocols or application programmatic interfaces (APIs) supported by a wide range of networks to provide a distributed database and distributed processing for Oracle. A communications protocol is a set of standards, implemented in software, that govern the transmission of data across a network. An API is a set of subroutines that provide, in the case of networks, a means to establish remote process-to-process communication via a communication protocol.

However, by using SQL*Net, the application developer does not have to be concerned with supporting network communications in a database application. If the underlying protocol changes, the database administrator makes some minor changes, while the application requires no modifications and will continue to function.

The SQL*Net drivers take SQL statements from the interface of the Oracle tools and package them for transmission to Oracle via one of the supported industry-standard higher level protocols or programmatic interfaces. The drivers also take replies from Oracle and package them for transmission to the tools via the same higher level communications mechanism. This is all done independently of the network operating system.

Additional Information:

For additional information on SQL*Net, refer toUnderstanding SQL*Netor the appropriate SQL*Net documentation.

Copyright © 1996 Oracle Corporation.

Client-server

From Wikipedia, the free encyclopedia

TheEnglishused in this article or section

may not be easy for everybody to understand

You can help Wikipedia by readingWikipedia:How to write Simple English pages, then simplifying the article.

InComputer science,client-serveris asoftware architecturemodel consisting of two parts,clientsystems andserversystems, both communicating over acomputer networkor on the samecomputer. A client-server application is adistributed systemmade up of both client and server software. Client server application provide a better way to share the workload.The clientprocessalways initiates a connection to the server, while the serverprocessalways waits for requests from any client. When both the clientprocessand serverprocessare running on the samecomputer, this is called asingle seatsetup.

Another type of related software architecture is known aspeer-to-peer, because each host orcan simultaneously act as both a client and a server (unlike centralized servers of theclient-servermodel) and because each has equivalent responsibilities and status. Peer-to-peer architectures are oftenabbreviatedusing theacronymP2P.

Theclient-server relationshipdescribes the relation between the client and how it makes a service request to the server, and how the server can accept these requests, process them, and return the requested information to the client. The interaction between client and server is often described usingsequence diagrams. Sequence diagrams are standardized in theUnified Modeling Language.

Bothclient-serverandP2Parchitectures are in wide usage today.

The basic type ofclient-serversoftware architecture employs only two types of hosts:clientsandservers. This type of architecture is sometimes referred to astwo-tier. Thetwo-tierarchitecture means that theclientacts as one tier andacts as the other tier.

Theclient-serversoftware architecture has become one of the basic models ofnetwork computing. Many types of applications have been written using theclient-servermodel. Standard networked functions such asE-mailexchange,webaccess anddatabaseaccess, are based on the client-server model. For example, aweb browseris a client program at the user computer that may access information at any web server in the world.

Always initiates requests toservers.

Usually connects to a small number ofserversat one time.

Usually interacts directly with end-users using anyuser interfacesuch asgraphical user interface.

Always wait for a request from one of the clients.

Serveclientsrequests then replies with requested data to the clients.

Aservermay communicate with other servers in order to serve a client request.

If additional information is required to process a request (or security is implemented), a server may request additional data (passwords) from a client before processing a request.

End users typically do not interact directly with a server, but use a client.

architecture enables the roles and responsibilities of acomputingsystem to be distributed among several independent computers that are known to each other only through anetwork, so one of advantages of this model is 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. This independence from change is also referred to as

All the data is stored on the servers, which generally have better security controls than most clients. Servers can better control access andresources, 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 much easier to administrators than what would be possible under a P2P architecture. 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.

technologiesare already available which weredesignedto ensuresecurity, user friendly interfaces, and ease of use.

It works with multiple differentclientsof different specifications.

Networks traffic blocking is one of the problems related to the

model. As the number of simultaneous client requests to a given server increases, the server can become overloaded. Contrast that to a

network, where itsbandwidthactually increases as more nodes are added, since the

networks overallbandwidthcan be roughly computed as the sum of the bandwidths of every node in that network.

model, if oneserverfail,clients requests cannot be served but in case of

networks, servers are usually distributed among many nodes. Even if one or more nodes fail, for example if a node failed todownloada file the remaining nodes should still have the data needed to complete the download.

web browsers, andonline chatclients.

web serversfile serversprint servers. Mostwebservices are also types of servers.

Pages needing to be simplified from August 2015

This page was last changed on 1 September 2017, at 06:08.

Text is available under theCreative Commons Attribution/Share-Alike Licenseand theGFDL; additional terms may apply. SeeTerms of Usefor details.

PyMOTW

If you find this information useful, consider picking up a copy of my book,The Python Standard Library By Example

Table of ContentsPrevious:Addressing, Protocol Families and Socket TypesNext:User Datagram Client and Server

The output from all the example programs from PyMOTW has been generated with Python 2.7.8, unless otherwise noted. Some of the features described here may not be available in earlier versions of Python.

If you are looking for examples that work under Python 3, please refer to thePyMOTW-3section of the site.

Sockets can be configured to act as aserverand listen for incoming messages, or connect to other applications as aclient. After both ends of a TCP/IP socket are connected, communication is bi-directional.

This sample program, based on the one in the standard library documentation, receives incoming messages and echos them back to the sender. It starts by creating a TCP/IP socket.

Thenbind()is used to associate the socket with the server address. In this case, the address islocalhost, referring to the current server, and the port number is 10000.

Callinglisten()puts the socket into server mode, andaccept()waits for an incoming connection.

accept()returns an open connection between the server and client, along with the address of the client. The connection is actually a different socket on another port (assigned by the kernel). Data is read from the connection withrecv()and transmitted withsendall().

When communication with a client is finished, the connection needs to be cleaned up usingclose(). This example uses atry:finallyblock to ensure thatclose()is always called, even in the event of an error.

The client program sets up itssocketdifferently from the way a server does. Instead of binding to a port and listening, it usesconnect()to attach the socket directly to the remote address.

After the connection is established, data can be sent through thesocketwithsendall()and received withrecv(), just as in the server.

When the entire message is sent and a copy received, the socket is closed to free up the port.

The client and server should be run in separate terminal windows, so they can communicate with each other. The server output is:

$ python ./socket_echo_server.py starting up on localhost port 10000 waiting for a connection connection from (127.0.0.1, 52186) received This is the mess sending data back to the client received age. It will be sending data back to the client received repeated. sending data back to the client received no more data from (127.0.0.1, 52186) waiting for a connection

$ python socket_echo_client.py connecting to localhost port 10000 sending This is the message. It will be repeated. received This is the mess received age. It will be received repeated. closing socket $

TCP/IP clients can save a few steps by using the convenience functioncreate_connection()to connect to a server. The function takes one argument, a two-value tuple containing the address of the server, and derives the best address to use for the connection.

Create a dictionary mapping socket module constants to their names.

This is the message. It will be repeated.

create_connection()usesgetaddrinfo()to find candidate connection parameters, and returns asocketopened with the first configuration that creates a successful connection. Thefamily,type, andprotoattributes can be examined to determine the type ofsocketbeing returned.

$ python socket_echo_client_easy.py Family : AF_INET Type : SOCK_STREAM Protocol: IPPROTO_TCP sending This is the message. It will be repeated. received This is the mess received age. It will be received repeated. closing socket

It is important to bind a server to the correct address, so that clients can communicate with it. The previous examples all usedlocalhostas the IP address, which limits connections to clients running on the same server. Use a public address of the server, such as the value returned bygethostname(), to allow other hosts to connect. This example modifies the echo server to listen on an address specified via a command line argument.

A similar modification to the client program is needed before the server can be tested.

After starting the server with the argument, thenetstatcommand shows it listening on the address for the named host.

$ host farnsworth.hellfly.net farnsworth.hellfly.net has address 192.168.1.17 $ netstat -an Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) … tcp4 0 0 192.168.1.17.10000 *.* LISTEN …

Running the the client on another host, passingfarnsworth.hellfly.netas the host where the server is running, produces:

$ hostname homer $ python socket_echo_client_explicit.py farnsworth.hellfly.net connecting to farnsworth.hellfly.net port 10000 sending This is the message. It will be repeated. received This is the mess received age. It will be received repeated.

$ python ./socket_echo_server_explicit.py farnsworth.hellfly.net starting up on farnsworth.hellfly.net port 10000 waiting for a connection client connected: (192.168.1.8, 57471) received This is the mess received age. It will be received repeated. received waiting for a connection

Many servers have more than one network interface, and therefore more than one IP address. Rather than running separate copies of a service bound to each IP address, use the special addressINADDR_ANYto listen on all addresses at the same time. Althoughsocketdefines a constant forINADDR_ANY, it is an integer value and must be converted to a dotted-notation string address before it can be passed tobind(). As a shortcut, use the empty stringinstead of doing the conversion.

To see the actual address being used by a socket, call itsgetsockname()method. After starting the service, runningnetstatagain shows it listening for incoming connections on any address.

$ netstat -an Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) … tcp4 0 0 *.10000 *.* LISTEN …

Internet Protocols and Support

socket Network Communication