What factors are related to the stability of the system? Stability refers to "the ability of measuring instruments to keep their measuring characteristics unchanged over time." Generally speaking, stability refers to the ability of measuring instruments to keep the measuring characteristics unchanged with time. Let's share what factors are related to system stability.
System stability and what factors 1 night arrival
Methods Abnormal online alarm, location log and null pointer are abnormal, and the database query result is empty. Locate the business line and query the slave database. The database is normal and the query result is normal. The initial judgment is the master-slave delay. The problem recovered in a few seconds, affecting single digits, and appeared several times in the following months, until the first day of preparing double 1 1 became more serious.
It's a long night. Take your time.
Locate the delay problem of master-slave synchronization, and check the machine situation and slow log of slave library. Performing a lot of operations to delete a table record from the library is very poor. Look at its execution statement and find that there is no index. Look at the table in the main library. There is this index. Why is the master-slave delay high in this case? Here is a brief introduction to the master-slave synchronization principle of mysql.
Master-slave replication of mysql requires three threads: masterbinlog dump thread, slaveI/O thread, sql thread, and.
grasp
1, binlog dump thread: when there is data update in the main library, the main library will write the updated event type into the binlog file of the main library according to the set binlog format. At this point, the master library will create a log dump thread to inform the slave library that there is data update. When an I/O thread requests the log content, it will pass the name of the binary log and the current update location to the I/O thread of the slave thread.
slave
2.I/O thread: this thread will connect to the main server, request a copy of the specified binlog file location from the log dump thread, and save the requested binlog in the local relay log. Like the binlog log, the relay log also records data update events by adding suffixes. Generate multiple relay log hostname-relay-bin.000001files, and slave will use an index file hostname-relay-bin.index to track the currently used relay log files.
3.SQL thread: after detecting that the relay log is updated, the thread will read and redo it locally, and re-execute the events in the main library locally to ensure the synchronization of master and slave data. In addition, if all events in the relay log file have been executed, the SQL thread will automatically delete the relay log file.
The following is a schematic diagram of the whole replication process:
Combined with the above mysql master-slave synchronization principle, the reason for our online problem came out. In fact, the slowness of SQL is only the appearance of our reason, and the deeper reason is that the events of Relay log are executed in sequence from the database SQL thread. If the performance of executing any event is not good, it will bring high delay between our master and slave.
Dawn dawn
Indexing from the database reduces the delay between the master server and the slave server and does not affect the online business.
Our system architecture is as follows:
In order to reduce the pressure on the database master database, each business line has its own slave database. At present, the situation of our database is 1 master 8 slave. If the master-slave delay is high, the most obvious impact is the read delay of each service line, and the service that depends on reading will have problems.
The master-slave delay is one of the factors that affect the stability of the system. How to reduce the master-slave delay and its influence on our system? There are many schemes to reduce the master-slave delay in the industry. Here is a brief introduction:
The infrastructure of the service adds a cache layer of memcache or Redis between the business and mysql. Reduce the reading pressure of mysql;
Use better hardware equipment than the master library as the slave library; ;
The Sync_binlog of the slave terminal is set to 0;
-logs-slave-updates updates received from the master server will not be recorded in its binary log;
Disable the slave's binlog.
System stability and what factors II. Several definitions of system stability and stability.
1. Before systematically studying the stability of the system,
We must first have a preliminary understanding of the concept of the system. In the theory of digital signal processing, people call the entity that can process and convert digital signals a system. Because the digital signal processing system processes signals at a specified time or time sequence, this system is regarded as' discrete time' and can also be described by four methods: time-based language, table, formula and waveform. In an abstract sense, both systems and signals can be considered as
Sequence. However, the system is a mechanism for processing signals, which is different from signals. People study systems, design systems, and use systems to process signals.
In order to serve human beings, the system needs other methods to be further described. Symbols, unit impulse responses, difference equations and graphs are also used to describe the system. China scholar Qian Xuesen thinks:
A system is an organic whole with specific functions, which consists of several interacting and interdependent components, and this organic whole is a part of the larger system to which it belongs.
Second, system stability.
If a system's zero-state response to any bounded input is also bounded, it is called input-bounded output stable system (Bibo), which is called stable system for short. That is, if the system is | f) |≤ MF and its zero-state response is | yzs () |≤ My (m is a finite constant), the system is said to be stable.
Three. Continuity (time)
Systems and discrete (time) systems Continuous systems: Systems in which time and variables of each component are continuously changing. The excitation and response of the system are continuous signals. Discrete system. When the laws of the system's physical quantities changing with time cannot be described by continuous functions, but only numerical values can be given at discrete moments, this system is called discrete system. The excitation and response of the system are discrete signals.
Fourth, the causal system
Causality system refers to a system that produces an output (response) only when an input signal excites the system. In other words, the (response) of the causal system will not appear at the moment before the input signal excites the system. That is to say, the input response cannot appear before the arrival time of this input; In other words, the output of the system is only related to the current and past inputs, and has nothing to do with the future inputs.
System stability and what factors 3 What is stability?
Stability refers to "the ability of measuring instruments to keep their measuring characteristics unchanged over time." Generally speaking, stability refers to the ability of measuring instruments to keep the measuring characteristics unchanged with time. If stability is not for time but for other quantities, it should be made clear. Stability can be characterized quantitatively, mainly to determine the relationship between measurement characteristics and time. There are many kinds of automatic control systems, and their functions are quite different. Some of them are used to control temperature changes, while others must track the flight path of the aircraft. However, all systems have one common feature to work normally, that is, to meet the requirements of stability.
Instrumental measurement
Generally, it can be expressed quantitatively in the following two ways: the time required for measuring characteristics to change by a specified amount, or the change amount of measuring characteristics after a specified time. For example, for standard batteries, there are clear requirements for their long-term stability (annual variation range of electromotive force) and short-term stability (variation range of electromotive force within 3 ~ 5 days); For example, the stability of gauge block size is evaluated by the maximum allowable annual change (micron year) of its specified length, and the above stability index is an important basis for dividing the accuracy grade.
For measuring instruments, especially benchmarks, measuring standards or some physical measuring tools, stability is one of the important measuring characteristics, and the stability of indicated values is the basis to ensure the accuracy of numerical values. There are many unstable factors in measuring instruments, mainly components aging, parts wear, careless use, storage and maintenance. Periodic verification or calibration of measuring instruments is an evaluation of their stability. Stability is also one of the important bases for determining the verification period scientifically and reasonably. [ 1]
example
What is stability? We can understand the concept of stability through a simple example. A steel ball is placed on two different building blocks, with Figure A on the top and Figure B on the bottom. If a force is applied to the steel ball, it will leave its original position. The steel ball in Figure A will slide down and will not return to its original position. The steel ball in Figure B will roll back and forth at the bottom of the box due to the gravity of the earth. When the time is long enough, the ball will eventually return to its original position. We say that the situation in Figure A is unstable, while the situation in Figure B is stable.
What is given above is a simple physical system, through which we have a basic understanding of stability. Stability can be defined as follows: when the actual system is in equilibrium, it is equivalent to a state in which a small ball is placed on a block of wood; If it is acted by external force, it is equivalent to the force on the ball in the above example; However, the system can still return to the original equilibrium state after a transition process, so we call this system stable, otherwise it is called unstable. A control system must be stable in order to realize the required control function. In the practical application system, because there are energy storage elements in the system, and each element has inertia. In this way, when the input of the system is given, the output will generally swing between the expected outputs. At this time, the system will absorb energy from the outside. For a stable system, the oscillation is decreasing, while for an unstable system, the oscillation is increasing. The former will be balanced in a state, and the latter will continue to increase until the system is destroyed.
differentiate
Since stability is very important, how can we know whether the system is stable or not? Control scientists have given us many theorems to judge whether the system is stable or not. These theorems are all based on the mathematical model of the system. According to the form of mathematical model, the conclusion of stability can be drawn after some calculations. Among these theorems, there are three famous theorems: routh criterion, leonid hurwicz criterion and Lyapunov. These methods are suitable for different mathematical models. The first two methods mainly judge whether the system is stable by judging whether the eigenvalue of the system is less than zero, while the latter mainly judges the stability of the system by examining whether the energy of the system is attenuated.
Of course, the stability of the system is only a basic requirement for the system. A satisfactory control system must also meet many other indicators, such as transition time, overshoot, steady-state error, adjustment time and so on. A good system is often the result of comprehensive consideration of these aspects.