1.1. Web technology evolution¶
1.1.1. Simple website¶
1.1.1.1. Static pages¶
In the initial stage of Web technology, the main content of the website is static, and most of the sites are hosted on ISPs, consisting of text and pictures, and the production and presentation forms are mainly tables. User behavior at that time was also very simple, basically just browsing the web.
1.1.1.2. Multimedia Phase¶
With the continuous development of technology, multimedia technologies such as audio, video, and Flash were born. The addition of multimedia makes the web page more vivid, and the interaction on the web page also brings a better experience to the user.
1.1.1.3. CGI stage¶
Gradually, multimedia can no longer meet people’s requests, so CGI (Common Gateway Interface) came into being. CGI defines the communication interface standard between the Web server and external application programs, so the Web server can execute external programs through CGI, and let the external programs generate dynamic content according to the Web request content.
At this time, various programming languages such as PHP/ASP/JSP have gradually entered the market, and more modular and more powerful applications can be realized based on these languages.
1.1.1.4. MVC¶
As Web application development becomes more and more standardized, ideas such as MVC appear. MVC is the abbreviation of Model/View/Control. Model is used to encapsulate data and data processing methods. View is the HTML presentation of data. Controller is responsible for responding to requests and coordinating Model and View.
The separation of Model, View and Controller is a typical idea of separation of concerns, which makes code reuse and organization better, and the configuration and flexibility of Web applications are getting better and better. And data access has gradually replaced direct SQL access by object-oriented methods, and the concept of ORM (Object Relation Mapping) has emerged.
In addition to MVC, similar design ideas include MVP, MVVM, etc.
1.1.2. Data Interaction¶
1.1.2.1. Simple data interaction¶
At the beginning of the development of Web technology, most of the front-end and back-end interactions used simpler methods such as Web forms, XML, and SOAP.
1.1.2.2. Ajax¶
At the beginning, the user can only get the result after submitting the entire form, and the user experience is extremely poor. So Ajax (Asynchronous Javascript And XML) technology has gradually become popular, which enables applications to obtain or update data without updating the entire page. This makes Web applications more responsive to user actions and avoids sending unchanged messages over the network.
1.1.2.3. RESTful¶
In the CGI period, the front-end and back-end were usually not strictly distinguished. With the increasing demand for decoupling and decoupling, the concept of front-end and back-end began to become clear. The front-end mainly refers to the front-end part of the website, which runs on the browsers such as PC and mobile terminals and is displayed to users. It consists of HTML5, CSS3, and JavaScript. The back-end mainly refers to the logical part of the website, involving the addition, deletion, modification and checking of data.
At this time, REST (Representation State Transformation) has gradually become a popular Web architecture style.
REST encourages the organization of system functionality based on URLs, taking full advantage of the semantics of HTTP itself, rather than just using HTTP as a remote data transfer protocol. Generally RESTful has the following characteristics:
- Domain name and main domain name are separated
api.example.com
example.com/api/
- with version control
api.example.com/v1
api.example.com/v2
- Locate resources using URLs
GET /users to get all users
GET /team/:team/users Get all users of a team
POST /users create user
PATCH/PUT /users Modify a user data
DELETE /users delete a user data
- Describe operations with HTTP verbs
GET to get resources, single or multiple
POST create resource
PUT/PATCH updates the resource, and the client provides complete resource data
DELETE deletes resource
- Correct use of status codes
Use status codes to improve readability of returned data
Use JSON as the data response format by default
have clear documentation
1.1.2.4. GraphQL¶
The data in some network service scenarios has complex dependencies. To cope with these scenarios, Facebook launched GraphQL to query and store data in a graph data structure. Some websites also use GraphQL as a way of interacting with APIs.
1.1.2.5. Binary¶
As business performance requirements increase, front and back ends begin to use HTTP/2, custom Protocol Buffer and other methods to speed up data interaction.
1.1.3. Architecture Evolution¶
With the continuous development of the business, the business architecture becomes more and more complex. The traditional functions are divided into different modules, and the concepts of middleware and middle platform appear. Proxy services, load balancing, database table partitioning, remote disaster recovery, caching, CDN, message queues, security protection and other technologies are becoming more and more widely used, increasing the complexity of Web development and operation and maintenance.
There are more and more forms of clients. In addition to the Web, other scenarios such as iOS and Android also appear in the client scenarios of Web services.
The earlier relational databases such as MySQL and PostgreSQL can no longer meet the requirements, and a class of databases such as Redis/Memcached cache databases that meet specific requirements has emerged.
In order to meet specific business requirements, different infrastructures such as Lucene/Solr/Elasticsearch search application server, Kafka/RabbitMQ/ZeroMQ message system, Spark computing engine, and Hive data warehouse platform have emerged.
1.1.3.1. Middleware¶
Middleware is an independent software program that manages computing resources and network communications. Commonly used functions include filtering IP, merging interfaces, merging ports, routing, permission verification, load balancing, reverse proxy, etc.
1.1.3.2. Distributed¶
With the continuous increase of the amount of data, it is difficult for a single device to carry such traffic, and different functions are also divided into different applications, so a distributed service framework (RPC) that improves business reuse and integration has emerged.
1.1.4. Cloud Services¶
Before the birth of cloud computing, most computing resources were physical machines in a “bare metal” state. The operation and maintenance personnel selected hardware of corresponding specifications, built the IDC network of the computer room, completed the provision of services, and invested a high cost in hardware infrastructure construction and maintenance. . After the emergence of cloud services, users can directly purchase cloud hosts, and the infrastructure is managed by the supplier. This method is also called IaaS (Infrastructure-as-a-Service).
With the continuous development of the architecture, the operation of the application becomes more fine-grained, the deployment environment is containerized, and each function is split into a microservice or serverless architecture.
1.1.4.1. Serverless¶
Serverless architecture consists of two parts, namely Faas (Function-as-a-Service) and BaaS (Backend-as-a-Service).
FaaS is a running platform. Users upload logical functions that need to be executed, such as some scheduled tasks, data processing tasks, etc., to the cloud function platform, configure execution condition triggers, routing, etc., and then the function execution can be completed through the cloud platform.
BaaS includes back-end service components, which complete third-party services based on APIs, mainly databases, object storage, message queues, log services, and so on.
1.1.4.2. Microservices¶
Microservice originated from the Micro-Web-Service proposed by Dr. Peter Rodgers at the Cloud Computing Expo in 2005. The fundamental idea is similar to the Unix pipeline design concept. In 2014, Martin Fowler and James Lewis jointly proposed the concept of microservices, which defined the microservice architectural style as a method of developing a single application through a set of small services, each service running in its own process, and through the Lightweight mechanism for communication (HTTP API).
Microservices is a software architectural style applied to component design and deployment architecture. It uses a modular approach to compose complex large-scale applications:
The functions of each service are cohesive, and the implementation is separated from the interface.
Each service is highly autonomous and decoupled from each other, and can be deployed, versioned, and scaled independently.
Each service communicates through API.
Each service has independent state and can only be accessed through the service itself.
1.1.4.3. API Gateway¶
The API gateway is a server. The client only needs to use a simple access method to uniformly access the API gateway, and the API gateway will proxy the access to the back-end services. At the same time, because the service governance features are uniformly placed on the API gateway, the service governance features are changed. It can be transparent to the client, realize the decoupling of basic features such as service governance and business services to a certain extent, and the upgrade of service governance features is also relatively easy to achieve.
1.1.5. Software Development¶
1.1.5.1. CI/CD¶
Continuous Integration (CI) is the process of letting developers integrate their work into a shared branch. Frequent integrations help resolve isolation and reduce the size of each commit to reduce the likelihood of merge conflicts.
Continuous Delivery (CD) is an extension of continuous integration that deploys a build from an integration test suite to a pre-production environment. This makes it possible to evaluate each build directly in a production-like environment, so developers can verify bug fixes or test new features without adding any effort.