Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the application of Nginx in the field of operation and maintenance

2025-04-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the application of Nginx in the field of operation and maintenance". In the daily operation, I believe that many people have doubts about the application of Nginx in the field of operation and maintenance. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "what is the application of Nginx in the field of operation and maintenance?" Next, please follow the editor to study!

About Nginx

Nginx has been born for more than ten years. As an open source Web server software, it has been widely used in the actual production architecture of Internet manufacturers at home and abroad because of its stable performance, high concurrency, low memory consumption, high performance processing capacity and so on. It mainly has the following scenario applications:

Web service application, which can realize the construction of static resources, PHP, Python and other websites.

Proxy load service, which supports forwarding processing of TCP/UDP, HTTP, HTTP/2, gRPC, FastCGI, SCGI, uWSGI and other protocols, and implements common application functions in Internet architecture, such as request parsing, long connection, proxy forwarding, load balancing, session persistence and so on.

Caching application, based on its proxy function, to achieve forward or reverse proxy caching

API gateway applications, which provide programmability including authentication, routing forwarding, and more based on support for Lua scripting module extensions, making it available for routing processing in a variety of complex environments

Nginx is based on an event-driven architecture and has the ability to support millions of concurrent requests, which is often used as an access portal in a technical architecture. In recent years, with the rapid development of cloud computing, micro-service, service center and DevOps standard, Nginx has been widely used because of the architecture requirements such as unified entry, intelligent routing, effective decoupling and infrastructure split.

Application of Nginx in DevOps

DevOps has become the most popular R & D management standard, and its advocacy of cloud computing and micro-services has been regarded as a scourge by countless operators and replaced the work of operation and maintenance. However, when we really understand the architecture of cloud computing and micro-services, we should also deeply realize that this is not a job grab but a proactive feeding. The DevOps standard is also driving our operation and maintenance workers to be more deeply involved in the development architecture and achieve a state of interweaving and coexistence with R & D. In my opinion, this link is Nginx.

1. Applications in business architecture

The development process of Internet products is to first make a version of the current requirements, and then add new functions according to the ever-changing requirements. This is very realistic logic, but with the iteration of technology and the increase of business requirements, it will also bring many challenges to our work. For example, when a certain function is less, it will be developed by a project team, and due to the continuous development of the business, it will gradually expand to a department or business department to collaborate and develop. At this point, the original single service will be split due to the adjustment of the business unit or the change of the business product.

I encountered this problem in 2015. Merchant services were developed by a team, but due to the split of business units, some classified merchants are required to develop independently. If the split is completed by development, it will be faced with problems such as technology architecture, technology stack migration, increased business development costs, and so on. Based on the convenience of implementation, our operation and maintenance staff provide a smooth split scheme for dynamic routing based on Nginx. The access architecture is as follows:

The URL of this service has only domain name and merchant identification code. According to this characteristic, we design a dynamic routing architecture composed of Nginx + Lua + Redis, and Nginx is used as the dynamic routing for the entrance. In order to avoid blocking, we follow the principle of least route judgment logic, all merchant identification codes are stored in Redis in the form of Key, and the corresponding value of each key is identified by the proxy server group. When the user's access enters the Nginx, the lua script quickly reads the corresponding identity from the redis, and routes the user's access to the corresponding proxy server group.

Developer colleagues have developed a merchant code management gadget, which can realize the dynamic management of merchant identification code. In this way, we use a very short time to split the code of a single merchant service into merchants, hotels, tourism, movies and other services according to the business dimension. Developers can copy multiple sets of codes first, and then replace them merchant by merchant or as a whole according to their respective development progress. This scheme realizes the implementation of service split in a very short time, and provides more possibilities for the development team for the future development of merchant services.

In short, whether it is Open API, micro-services or mid-Taiwan architecture, Nginx can always reduce the burden for development and achieve a smooth transition of architectural changes through its powerful features. Routing and data processing through Nginx can flexibly solve the problem of changeable development architecture, and meet the needs of different stages of development architecture with the ability of constant change.

2. Application in emergency support.

In the operation and maintenance support work, RTO (Recovery Time Objective, recovery time target) and RPO (recovery point target) are important indicators to measure the operation and maintenance support work. RTO refers to the maximum time required from the failure of the business to the recovery of the entire business system. RPO, on the other hand, refers to the maximum amount of time data may be lost. These two indicators pose severe challenges to the disaster preparedness and emergency switching capability of the operation and maintenance architecture.

At present, the popular method is the multi-live architecture, but in the actual implementation, the multi-live architecture has high input cost, long implementation cycle, difficult to change the existing technical architecture, and the maintenance work invested in the later stage is also very huge. At this time, we can use Nginx to design a dynamic degraded scheme, which can effectively supplement the emergency support work in the period of small scale and low technical capacity of the development architecture. The overall investment of the scheme is small, which can not only quickly implement the landing, but also quickly switch in case of failure, and record the requests of users to change data during the failure, so as to avoid the loss of data as much as possible. The design of the scheme is as follows:

All static resources are provided by CDN vendors to provide access services.

Downgraded cluster remote computer room deployment

During normal access, the Nginx load synchronizes the GET request and response results to the degraded cluster in real time, and the Nginx of the degraded cluster stores the synchronized data in the Redis cluster after processing.

When the business service fails, the user access is switched to the degraded cluster through DNS or Nginx load according to the failure situation.

After the business service is restored, the user access is gradually switched back to the Nginx load.

Restore the changed data in the recorded POST data to the database through a special tool

The scheme is only a discussion model, and there are still many problems to be considered in the actual implementation, such as:

The minimum URL value of the GET method to prevent duplicate data from taking up more storage space

The handling of login users and the personalization of GET method requests

Binding of POST method data to user identity

Design of recovery accuracy of POST recorded data

Monitoring of access handoff

Prompt information of the front-end user

3. Digital operation of operation and maintenance.

Nginx is usually placed at the entrance of server access, and its access log can globally record the source of user access, response time, behavior hotspots and other data. Through the analysis of the access log, we can clearly understand the source of users, behavior habits and their own server performance. With the high-performance processing capability of ELK, the results of data analysis can be displayed to the server maintenance personnel and application developers in real time, so as to continuously improve the availability of the business and the user experience of the product.

Nginx logs can be classified from four aspects: security, performance, availability and access statistics. In the aspect of security, the visitor IP can be recorded immediately, and the visitor can be shielded manually or automatically according to the actual situation at this stage. In terms of performance, we can combine basic resource monitoring to analyze the reasons and make predictions in advance. If the usability is in the aspect of business design, it can be fed back to the product in time to make more friendly prompts. Access statistics can be provided to the corresponding departments for further analysis and processing. The work of operation and maintenance is not only to respond to external needs, but also to actively participate in the data operation of the enterprise through the powerful functions provided by Nginx.

4. Nginx in microservices

Micro-service is an important symbol of DevOps level. The biggest idea of service grid (Service Mesh) and serverless architecture design in micro-service architecture is to separate reusable and basic non-business functions from business development, such as service discovery, end-to-end authentication, access tracking, component dependence and so on. Nginx plays an important role in the process of migrating to service grid.

Routing grid architecture, which is the primary architecture of the transition to service grid, does not need to change the original single application and new micro-service application. It can easily migrate in and accumulate experience for more complex transformation.

Sidecar agent / Fabric model, where applications and agents are placed in POD to provide more fine-grained control over application traffic. At this stage, you can develop your own control plane, or you can choose to switch directly to the istio platform.

At this point, the study on "what is the application of Nginx in the field of operation and maintenance" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report