Wednesday, March 6, 2019

Distributed Systems



Distributed system: a collection of independent computers that are connected with an interconnection network.
Distributed computing: a method of computer processing in which different parts of a computer program are run on two or more computers that are communicating with each other over a network.




Standalone System
Distributed System
All the components are executed within a single device.
The components are distributed and executed in multiple device.
Do not need a network.
Need a network.
Usually one or tightly coupled set of technologies are used to develop(JAVA, .NET)
Multiple and loosely coupled set of technologies are used to develop(HTML + CSS +JS + PHP)




Elements of distributed systems


Processing components

• Data networks for components to communicate
• Including the components who are dedicated for
  processing the communication, called connectors
• Data stores (databases) and Data

• The configuration of the above elements


Types of distributed systems (based-on
the service of networks)



• There are different types of services, which can be
  gained from distributed systems
• Mail service (SMTP, POP3, IMAP)
• File transferring and sharing (FTP)
• Remote logging (telnet)
• Games and multimedia (RTP, SIP, H.26x)
• Web (HTTP)
• The service of the web gained through the internet is called    the WWW




Types of Web-based Systems

•Web sites
•Web applications
•Web services and client apps
•Rich Internet Applications (RIAs)/Rich Web based
 Applications (RiWAs)


Types of RIAs/RiWAs (client-side perspective)




Characteristics of web applications :

  • Product related characteristics
  • Use related characteristics
  • Development related characteristics
  • Evolution related characteristics



Architectures of the distributed systems



Client-server architecture (two-tier) – Usually the client sends a request asking the server for some service and the server responses with the resources.
3-tier architecture – when there is a need for data persistence and also to separate the application logic from the data and this can be seen as an extension of 2-tier architecture
n-tier architecture – When there is a need for further separation and distribution of the components, more tiers can be added.

Service Oriented Architecture – When different types of distributed systems want to communicate and share their services forming enterprise level systems



Read more: https://www.tutorialspoint.com/software_architecture_design/distributed_architecture.htm

Micro-service architecture from monolithic architecture





The idea is to split your application into a set of smaller, interconnected services instead of building a single monolithic application. Each microservice is a small application that has its own hexagonal architecture consisting of business logic along with various adapters.

Some microservices would expose a REST, RPC or message-based API and most services consume APIs provided by other services. Other microservices might implement a web UI.
The Microservice architecture pattern significantly impacts the relationship between the application and the database. Instead of sharing a single database schema with other services, each service has its own database schema.



MVC Architecture



Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts :
  • Model − The lowest level of the pattern which is responsible for maintaining data.
  • View − This is responsible for displaying all or a portion of the data to the user.
  • Controller − Software Code that controls the interactions between the Model and View.
MVC is popular as it isolates the application logic from the user interface layer and supports separation of concerns. Here the Controller receives all requests for the application and then works with the Model to prepare any data needed by the View. The View then uses the data prepared by the Controller to generate a final presentable response. The MVC abstraction can be graphically represented as follows.



The Model

The model is responsible for managing the data of the application. It responds to the request from the view and it also responds to instructions from the controller to update itself.

The View

It means presentation of data in a particular format, triggered by a controller's decision to present the data. They are script-based templating systems like JSP, ASP, PHP and very easy to integrate with AJAX technology.

The Controller

The controller is responsible for responding to the user input and perform interactions on the data model objects. The controller receives the input, it validates the input and then performs the business operation that modifies the state of the data model.


Advantages of MVC
1) Faster development process: MVC supports rapid and parallel development. With MVC, one programmer can work on the view while other can work on the controller to create business logic of the web application. The application developed using MVC can be three times faster than application developed using other development patterns.
2) Ability to provide multiple views: In the MVC Model, you can create multiple views for a model. Code duplication is very limited in MVC because it separates data and business logic from the display.
3) Support for asynchronous technique: MVC also supports asynchronous technique, which helps developers to develop an application that loads very fast.
4) Modification does not affect the entire model: Modification does not affect the entire model because model part does not depend on the views part. Therefore, any changes in the Model will not affect the entire architecture.
5) MVC model returns the data without formatting: MVC pattern returns data without applying any formatting so the same components can be used and called for use with any interface.
6) SEO friendly Development platform: Using this platform, it is very easy to develop SEO-friendly URLs to generate more visits from a specific application.

Disadvantages of MVC
1) Increased complexity
2) Inefficiency of data access in view
3) Difficulty of using MVC with modern user interface.
4) Need multiple programmers
5) Knowledge on multiple technologies is required.
6) Developer have knowledge of client side code and html code.

Communication technologies for the distributed systems

  • Functional oriented communication
  • Message Oriented communication
  • Resource oriented communication
 RPC Vs RMI

RPC is C based, and as such it has structured programming semantics, on the other side, RMI is a Java based technology and it's object oriented.
With RPC you can just call remote functions exported into a server, in RMI you can have references to remote objects and invoke their methods, and also pass and return more remote object references that can be distributed among many JVM instances, so it's much more powerful.
RMI stands out when the need to develop something more complex than a pure client-server architecture arises. It's very easy to spread out objects over a network enabling all the clients to communicate without having to stablish individual connections explicitly.
RMI 


Common Object Request Broker Architecture (CORBA)


The Common Object Request Broker Architecture (CORBA) is a specification developed by the Object Management Group (OMG). CORBA describes a messaging mechanism by which objects distributed over a network can communicate with each other irrespective of the platform and language used to develop those objects.
There are two basic types of objects in CORBA. The object that includes some functionality and may be used by other objects is called a service provider. The object that requires the services of other objects is called the client. The service provider object and client object communicate with each other independent of the programming language used to design them and independent of the operating system in which they run. Each service provider defines an interface, which provides a description of the services provided by the client.



XML

Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable.



Read more: https://en.wikipedia.org/wiki/XML




XML example:






JSON example:



































Data formatting/structuring techniques available for the communication of

web-based systems

Communication protocols are formal descriptions of digital message formats and rules. They are required to exchange messages in or between computing systems and are required in telecommunications. 


Communications protocols cover authentication, error detection and correction, and signaling. They can also describe the syntax, semantics, and synchronization of analog and digital communications. Communications protocols are implemented in hardware and software. There are thousands of communications protocols that are used everywhere in analog and digital communications. Computer networks cannot exist without them.


Communications devices have to agree on many physical aspects of the data to be exchanged before successful transmission can take place. Rules defining transmissions are called protocols.

There are many properties of a transmission that a protocol can define. Common ones include: packet size, transmission speed, error correction types, handshaking and synchronization techniques, address mapping, acknowledgement processes, flow control, packet sequence controls, routing, address formatting


Popular protocols include:
  • File Transfer Protocol (FTP)
  • TCP/IP
  • User Datagram Protocol (UDP)
  • Hypertext Transfer Protocol (HTTP)
  • Post Office Protocol (POP3)
  • Internet Message Access Protocol (IMAP)
  • Simple Mail Transfer Protocol (SMTP)




References:


https://stackoverflow.com/questions/46469762/what-is-the-difference-between-a-distributed-system-and-distributed-computing


https://articles.microservices.com/monolithic-vs-microservices-architecture-5c4848858f59


https://www.tutorialspoint.com/struts_2/basic_mvc_architecture.htm


https://www.interserver.net/tips/kb/mvc-advantages-disadvantages-mvc/


https://www.techopedia.com/definition/1293/common-object-request-broker-architecture-corba


https://www.techopedia.com/definition/25705/communication-protocol