May 29, 2021 Article blog
Background development as the apple of the eye of Internet technology, has always been the peak that programmers chase, this article for you to introduce the back-end technology.
Original: http://t.cn/AiQWteI2
High cohesion means that a software module is made up of highly relevant code and is responsible for only one task, which is often referred to as the single principle of responsibility. The cohesion of the module reflects the degree of closeness within the module.
The closer the connection between modules, the stronger their coupling and the less independent the modules are. T he coupling between modules depends on the complexity of the interfaces between modules, how they are called, and the information passed. A complete system, between modules and modules, as far as possible to make it independent. In general, the higher the cohesion of the modules in the program structure, the lower the coupling between the modules.
Over-design is to carry out too much future-oriented design or to think of relatively simple things complex, excessive pursuit of modularity, scalability, design patterns, etc. , for the system to add unnecessary complexity.
Prematurely refers not to the early stages of the development process, but to the time when the future direction of changes in demand has not been clarified. Not only may your optimization not only prevent you from implementing new requirements well, but your guesses about your expectations for optimization may also be wrong, resulting in the fact that you get nothing but complicating the code.
The right approach is to implement your needs in quality, write enough testcase, and then do profile to find performance bottlenecks, this time to do optimization.
Refactoring is to improve the quality and performance of software by adjusting program code, making its program design pattern and architecture more reasonable, and improving the scalability and maintenance of software.
Also known as the broken window theory, broken window effect (Broken windows theory) is a theory of criminology. T his theory holds that if the undesirable phenomena in the environment are allowed to exist, they will induce people to follow suit, or even intensify. A building with a few broken windows, for example, if those windows are not repaired, there may be vandals who will destroy more windows. Eventually they will even break into the building and, if they are found uninhabited, perhaps settle there or set fire to it.
Application in software engineering is, must not let the system code or architectural design of the hidden dangers have the opportunity to take the lead, otherwise, over time, the hidden dangers will become more and more serious. On the contrary, a high-quality system of its own will make people involuntarily write high-quality code.
Refers to the program running up and down the entire link, each point is not guaranteed to be absolutely reliable, any point can fail at any time or unpredictable behavior, including machine network, service itself, dependent environment, input and request, and so on, so everywhere to guard.
Persistence is the mechanism by which program data is transformed between temporary and persistent states. In layman's terms, temporary data (such as data in memory that cannot be permanently saved) is persisted into persistent data (e.g., persisted to a database or on a local disk that can be persisted for a long time).
A critical area is used to represent a public resource, or shared data, that can be used by multiple threads, but each time, only one thread can use it, and once the critical area resource is occupied, other threads must wait to use the resource.
Blocking and non-blocking often describe the interaction between multiple threads. F or example, if a thread takes up a critical zone resource, then all other threads that need it must wait in that critical zone, and waiting causes the thread to hang. T his situation is blocking. A t this point, if the resource-consuming thread has been reluctant to release the resource, then all other threads blocking on this critical area will not work. Instead of blocking, multiple threads are allowed to enter the critical area at the same time.
Usually synchronization and asynchronous refers to function/method calls.
Synchronization is when a function call is made and does not return until results are ut found. Asynchronous calls return instantaneously, but the instant return of asynchronous calls does not mean that your task is complete, and he starts a thread in the background to continue the task, notifying the caller by calling back callback or otherwise when the task is complete.
Because of distributed systems, High Concurrency is often designed to ensure that the system can handle many requests simultaneously. I n layman's terms, high concurring refers to the simultaneous access of many users to the same API interface or URL address at the same point in time. It often occurs in business scenarios where there are large numbers of active users and high concentrations of users.
High Availability IS ONE OF THE FACTORS THAT MUST BE CONSIDERED IN THE DESIGN OF A DISTRIBUTED SYSTEM ARCHITECTURE, WHICH TYPICALLY MEANS THAT A SYSTEM IS SPECIFICALLY DESIGNED TO REDUCE DOWNTIME WHILE MAINTAINING A HIGH DEGREE OF AVAILABILITY OF ITS SERVICES.
In order to ensure the stability of database products, many databases have dual-machine hot-ready function. That is, the first database server, is to provide external addition and deletion business production server;
Off-site multi-life generally refers to the establishment of independent data centers in different cities, "live" is relative to cold backup, cold backup is to back up the full amount of data, usually do not support business needs, only when the host room failure will switch to the backup room, and live, refers to these rooms in the daily business also need to walk traffic, do business support.
Load balancing is a load balancing service that distributes traffic to multiple servers. Automatic allocation of application external service capabilities across multiple instances enhances application availability by eliminating single points of failure, enabling you to achieve a higher level of application fault tolerance, seamlessly providing the load-balancing capacity required to distribute application traffic, providing you with efficient, stable, and secure service.
Dynamic separation refers to the architectural design method of separating static pages from dynamic pages or static content interfaces and dynamic content interfaces in the web server architecture, thereby improving the performance and maintainability of the entire service access.
The concurrent carrying capacity of a single server is always limited, when the processing power of a single server reaches the performance bottleneck, the combination of multiple servers to provide services, this combination is called a cluster, each server in the cluster is called a "node" of the cluster, each node can provide the same service, thereby multiplying the concurrent processing power of the entire system.
A distributed system is a complete system broken down into many separate subsystems according to business functions, each subsystem is called a "service", and the distributed system sorts and distributes requests to different subsystems, allowing different services to handle different requests. In distributed systems, subsystems operate independently, and they are connected by network communication to achieve data interoperability and combined services.
CAP theory refers to a distributed system where Consistency (consistency), Availability, and Partition Tolerance (partition fault tolerance) cannot be established at the same time.
Simply put, in a distributed system, up to two of these properties can be supported. B ut obviously since distributed is doomed we are bound to partition, since partitioning, we can not 100 percent avoid partition errors. Therefore, we can only make choices about consistency and availability.
In distributed systems, we tend to pursue availability, which is more important than consistency, so how to achieve high availability, here is another theory, is BASE theory, it has made a further expansion of CAP theory.
BASE theory states:
Base theory is the result of a trade-off between consistency and availability in CAP, and the central idea of the theory is that we can't be strongly consistent, but each application can use the appropriate approach to achieve ultimate consistency in the system based on its own business characteristics.
There are two ways to scale vertically:
(1) enhance the performance of stand-alone hardware, for example: increase the number of CPU cores such as 32 cores, upgrade better network cards such as 10,000, upgrade better hard drives such as SSD, expand hard disk capacity such as 2T, expand system memory such as 128G;
(2) improve the performance of stand-alone software or architecture, for example: using Cache to reduce the number of IOs, using asynchronous to increase single-service throughput, using lockless data structure to reduce response time;
Similar to horizontal scaling. T he nodes in the cluster server are parallel peer nodes, and when capacity expansion is required, you can increase the service capability of the cluster by adding more nodes. In general, critical paths in the server (such as logins, payments, core business logic, etc.) in the server need to support dynamic parallel expansion of the runtime.
Refers to dynamic online capacity expansion of deployed clusters. Elastic expansion systems can automatically add more nodes (including storage nodes, compute nodes, network nodes) to increase system capacity, improve system performance, or enhance system reliability, or accomplish these three goals at the same time, depending on the actual business environment.
Features: High state synchronization security, convenient logic update, fast disconnection, but low development efficiency, network traffic with the complexity of the game increased, the server needs to bear more pressure.
Features: Frame synchronization requires ensuring that the system has the same output at the same input. F rame synchronization development is efficient, traffic consumption is low and stable, and the pressure on the server is very small. However, the network requirements are high, the disconnection time is long, the client computing pressure is high.
Pre-establish a connection buffer pool and provide a set of connection usage, allocation, and management policies, so that connections in the connection pool can be efficiently and securely reused, avoiding the cost of frequent connection establishment and closure.
Because network fluctuations cause the user to intermittently disconnect from the server, the server attempts to connect the user to the state and data of the last disconnect after the network is restored.
Session retention refers to a mechanism on a load balancer that identifies the correlation between the client and the server, and at the same time ensures that a series of related access requests are assigned to a machine. In human terms, multiple requests made during a session fall on the same machine.
Usually refers to long and short connections to TCP. L ong connection is to establish tCP connection, has been maintaining this connection, generally will send each other a heartbeat to confirm the existence of the corresponding, the middle will do multiple business data transmission, generally will not actively disconnect. A short connection generally means that after a connection is established, after a transaction is performed (e.g., an http request), the connection is then turned off.
The group effect is also known as the thunder group effect, but what is called, in short, the panic phenomenon is when a multiprocess (multithreaded) is blocking waiting for the same event at the same time (sleep state), if the waiting event occurs, then he will wake up all the processes (or threads) waiting, but ultimately only one process (thread) gets "control" of the time, the event is processed, while other processes (threads) fail to gain "control" and can only go back to sleep. This phenomenon and performance waste is called surprise.
NAT (Network Address Translation, Network Address Conversion) is the replacement of the address information at the header of an IP message. NAT is typically deployed at an organization's network exit location to provide public network accessibility and upper-level protocol connectivity by replacing the internal network IP address with the exit IP address.
Downtime, generally refers to the computer host unexpected failure and crash. Second, some servers, such as database deadlocks, can also be called downtime, and some server services hang up, so to speak.
When a program goes wrong and an exception breaks, OS stores the current state of the program's work as a coredunmp file. Typically, coredump files contain memory, register status, stack pointers, memory management information, etc. when the program is running.
In addition to 500 errors may be program language errors, the rest of the errors, can probably be understood as server or server configuration problems.
A handle leak is when a process does not release an open file handle after calling a system file. The general phenomenon after a handle leak is that the machine slows down, the CPU soars, and the CPU usage of cgi or server that leaks the handle increases.
Deadlock refers to two or more threads in the execution process, due to competitive resources or because of communication with each other caused by a blocking phenomenon, if there is no external force, they are inhibited in a blocking state and can not continue, at this time said that the system is deadlocked or the system produced a deadlock.
Linux to achieve this feature, when an outage occurs, a hard interrupt processes work that can be done in a short period of time, and puts the work that handles the event longer to be done after the interrupt, which is a soft interrupt (softirq).
At some point in time, server performance metrics (e.g. traffic, disk IO, CPU usage, etc.) are much larger than the time period before and after that time. The appearance of burrs represents uneven and inadequate use of this server resource, which can easily induce other, more serious problems.
An attacker sends a package that the destination host has received for the purpose of spoofing the system, primarily during the authentication process, and undermines the correctness of authentication. I t is a type of attack that repeats a valid data transfer maliciously or fraudulently, and replaying an attack can be carried out by the initiator or by an enemy that intercepts and resents the data. Attackers use network listening or other means to steal authentication credentials and then re-send them to the authentication server.
Network silos refer to a cluster environment in which some machines lose network connectivity to the entire cluster, split into small clusters, and data inconsistencies occur.
For cluster systems, the general cache is distributed, i.e. different nodes are responsible for a certain range of cached data. W e don't have enough cached data dispersion, resulting in a large amount of cached data concentrated on one or more service nodes, called data tilt. Generally speaking, the data tilt is caused by the poor performance of load balancing implementation.
Cerebral fissure refers to the system division caused by the inaccessibility of the network between some nodes in the cluster system, the different divided small clusters will provide services according to their respective state, the original cluster will have inconsistent reactions at the same time, resulting in the nodes competing for resources, system confusion, data corruption.
The primary purpose of service monitoring is to be able to detect service problems accurately and quickly when they are about to occur to reduce the scope of impact. Service monitoring generally has a variety of means, which can be divided into:
Microservices architecture is an architectural pattern that advocates the division of a single application into a small set of services that coordinate and work with each other to provide the ultimate value to users. Each service runs in its own process, and services communicate with each other using lightweight communication mechanisms (usually HTTP-based Restful APIs). Each service is built around a specific business and can be deployed independently to a production environment, class production environment, and so on.
Service discovery is the use of a registry to record information about all services in a distributed system so that other services can quickly locate these registered services. Service discovery is the core module that underpins large-scale SOA and microservices architectures and should be as highly available as possible.
If you look at the request monitoring curve of a raffle or second kill system, you will find that such a system will have a peak during the period during which the activity is open, and when the activity is not open, the system's request volume and machine load are generally relatively smooth. T o save machine resources, we can't always provide maximum resource capacity to support short-term peak requests. T herefore, some technical means need to be used to weaken the instantaneous request peak, so that the system throughput in the peak request to maintain control. P eaking can also be used to eliminate burrs and make server resource utilization more balanced and adequate. Common peaking strategies include queues, frequency limits, layered filtering, multi-level caching, and so on.
During the upgrade process, you need to consider whether the new data structure will be able to understand and parse the old data after the upgrade, whether the newly modified protocol will understand the old protocol, and make the appropriate processing within the expected. This requires version compatibility during the service design process.
Overload refers to the current load has exceeded the maximum processing power of the system, overload, will lead to some services are not available, if mishandled, it is very likely to cause the service is completely unavailable, or even an avalanche. Overload protection is exactly what you do for this anomaly to prevent the service from being completely unavailable.
A service fuse acts like a fuse in our home, temporarily stopping calls to a service in order to prevent an avalanche throughout the system when it becomes unavailable or responds to a timeout.
Service degradation is the release of server resources to ensure the proper functioning of core tasks in the event of a surge in server stress and a strategic downgrade of some services and pages based on current business conditions and traffic. Downgrades tend to specify different levels and face different levels of exception to perform different treatments.
In summary, service degradation requires different degradation strategies based on different business needs. The main purpose is that the service is damaged but better than nothing.
The current limit can be thought of as one of the service downgrades, the limit is to limit the system's input and output traffic has reached the purpose of protecting the system. G enerally speaking, the throughput of the system can be measured, in order to ensure the stable operation of the system, once the threshold of the need to limit, it is necessary to limit traffic and take some measures to complete the purpose of limiting traffic. For example, delay processing, denial of processing, or partial denial of processing, and so on.
Remove the faulty machine from the cluster to ensure that new requests are not distributed to the faulty machine.
Black box testing does not take into account the internal and logical structure of the program, mainly used to test whether the function of the system meets the requirements specifications. There is usually an input value, an input value, and an expected value to compare.
White box testing is mainly used in the unit testing stage, mainly for code-level testing, for the internal logical structure of the program, test means are: statement coverage, decision coverage, condition coverage, path coverage, condition combination coverage
Software testing is generally divided into four stages: unit testing, integration testing, system testing, acceptance testing.
Retest when defects are found and modified, or when new features are added to the software. Used to check if the discovered defect has been corrected, and the modifications made do not raise new questions.
The term comes from the hardware industry. A fter you make changes or fixes to a hardware or hardware component, power up the device directly. I f there is no smoke, the component passes the test. In software, the term "smoke testing" describes the process of validating code changes before embedding them in the product's source tree.
Smoke testing is a fast basic function verification strategy for software version packages in the software development process, which is a means of confirming and verifying the basic functions of software, not an in-depth test of software packages.
For example: for a login system smoke test, we only need to test the correct user name, password, verification login this core function point, as for the input box, special characters, etc., can be carried out after the smoke test.
Performance testing tests the system's performance metrics by simulating a variety of normal, peak, and abnormal load conditions through automated testing tools. Both load and stress tests are performance tests that can be combined.
Benchmarking is also a way to measure the maximum actual performance of a machine's hardware and software-optimized performance improvements, as well as to identify CPU or memory efficiency issues for a piece of code. Many developers use benchmarks to test different concurresion patterns, or benchmarks to help configure the number of work pools to ensure maximum system throughput.
The A/B test is a randomly assigned, similar number of samples from two or more groups, and if the experimental results of the experimental group and the comparison group are statistically significant on the target indicator, it can show that the function of the experimental group can lead to the results you want, thus helping you to validate assumptions or make product decisions.
Code coverage is a measure of software testing that describes the proportion and extent to which source code is tested in a program, and the resulting ratio is called code coverage. W hen doing unit tests, code coverage is often used as a measure of testing good or bad, and even code coverage is used to assess test task completion, for example, code coverage must reach 80% or 90%. As a result, the tester went to great pains to design the case coverage code.
Grayscale release refers to in the upgrade version process, through partition control, whitelist control and other ways to some users first upgrade product features, while the rest of the users remain unchanged, when after a period of time to upgrade product features of the users do not have feedback problems, gradually expand the scope, and eventually open the new version of features to all users, grayscale release can ensure the stability of the overall system, in the initial grayscale can be found, modify the problem to ensure its impact.
Refers to the act of restoring a program or data to the last correct state (or the last stable version) when a program or data processing error occurs.
That's all you need to do with the most complete back-end technology in history.