当前位置:网站首页>MySQL combat optimization expert 05 production experience: how to plan the database machine configuration in the real production environment?
MySQL combat optimization expert 05 production experience: how to plan the database machine configuration in the real production environment?
2022-07-06 10:06:00 【Office template library material frog】
1、 When you understand the principle of database architecture , You should know your database Planning
We used 4 This article gives you an overall analysis MySQL How databases work , I believe many friends have learned a lot about the overall architecture principle of the database I have a definite understanding of , After all, before that , Maybe most people are right about MySQL The understanding of database still stays in execution SQL Degree of statement .
When we have a preliminary understanding of the database architecture design principle , Then the first thing you should know , Is that we usually work , How to plan database . Because I think many people are mainly responsible for some things without much concurrency , A system with dozens or hundreds of users , Then I won't go at all Pay attention to the planning of the database .
Yes, a lot Java For Engineers , Or find one by yourself linux The machine is equipped with one MySQL, Then connect your system and start using it directly , want Otherwise, let DBA Or the operation and maintenance engineer helps him find a machine and install one MySQL perhaps Oracle, Then you can use it directly .
But in our column , We hope to teach you more professional database experience , Including the overall architecture principle of the database , There is also how to plan Database in production environment , Including when you have a production Library , The thing to do is to design the pressure measurement scheme , Including the pressure test of your database , Including your Database deployment visual monitoring system , wait .
When you do this series of things , Then you should develop your Java System , To operate your database , Realize various business functions and logic .
2、 What is the general configuration of the production database ?
Now let's look at the first question , Suppose you need to deploy a database in the production environment , At this point, you first need a machine to deploy the database . Then I What we should consider is , Deploy a database of production environment , What kind of machine configuration is generally required ?
Next, we will tell you some of our experience values , Directly tell you what kind of machine configuration is deployed MySQL database , Roughly suitable for how high concurrent visits Ask quantity
When you know this experience value , In the future, when you are in charge of system development , When applying for the database , You will know what kind of database is needed in the production environment The machine is equipped with , Roughly how many concurrent accesses can be resisted .
First of all, let's be clear , If the system you are responsible for is one with little concurrent access , A system with dozens or hundreds of users , So in fact, you choose What kind of machine to deploy the database , The impact is not great , Even if you use our personal laptop to deploy one MySQL database , Its It can also support the operation of low concurrency systems .
Because that kind of system may send a wave of requests to the database every few minutes , And there may be hundreds of tables in the database 、 Thousands or tens of thousands of data , Small amount of data , The concurrency is very small , The operating frequency is very low , The number of users is very small , The concurrency is very small , It's just that the business logic of the system may be very complex . For this kind of system Database machine selection , It's not in our consideration .
We mainly focus on Internet Systems with a certain amount of concurrency , It may generate hundreds of data per second , Thousands per second , Even tens of thousands of concurrent requests per second , For such scenarios , What kind of machine should we choose to deploy the database , In order to better resist the pressure of our system .
3、 ordinary Java How much concurrency can the application system resist when deployed on the machine ?
Generally speaking , According to our experience ,Java When deploying the application system, the commonly used machine configuration is 2 nucleus 4G and 4 nucleus 8G More , Database department The machine configuration often used in the deployment is at least 8 nucleus 16G above , Normal in 16 nucleus 32G
Based on our production experience of a large number of highly concurrent online systems , commonly Java The application system is deployed in 4 nucleus 8G On the machine , Every second 500 about The number of concurrent visits , It's almost appropriate , Of course, this is not necessarily . Because you have to think about it , Suppose you spend 1s It can be done , So you one This machine may only be able to process 100 A request , But if you only spend per request 100ms You can finish , Then your machine may be able to Processing hundreds of requests .
So how many requests per second can a machine resist , It is often related to how long it takes you to process each request , But generally speaking , Based on our extensive experience For observation ,4 nucleus 8G The machine deployment is ordinary Java Application system , It can resist hundreds of concurrent accesses per second , From onetwohundred requests per second to sevenoreight hundred requests per second seek , It's all possible , The key is to see how long it takes you to process each request .
4、 High concurrency scenarios , What kind of machine should the database use ?
For databases , We just said , Generally, the recommended database is at least selected 8 nucleus 16G With the machine , Even 16 nucleus 32G Our machine is more suitable some .
Because you have to consider a problem , For our Java Application system , The main time-consuming thing is Java Network communication between system and database . Yes Java The system itself for , If you just run some common business logic inside the system , Complete some business logic in your own memory , This performance is extremely high .
For you Java Every request received by the system , The most time-consuming thing is to send network requests to the database , Wait for the database to execute some SQL sentence , Return the result to you .
So we often say that you have one Java The system is under great pressure , The load is high , But in fact, you should understand one thing , You this Java In fact, the main pressure and complexity of the system are Focus on the one you rely on MySQL On Database !
Because you perform a lot of additions, deletions, modifications and checks SQL At the time of statement ,MySQL The database needs a lot of memory and disk files IO operation , So databases are often The one with the highest load ! We have this question before 4 In this article , adopt MySQL Analysis of the principle of database architecture , All have been explained .
And your Java Generally, the system does not require you to read and write a large number of local files directly, which is time-consuming IO Let's do it ? Is it right? , I think I did Java A friend of development will Will want to understand this truth .
So often for a database , They all choose 8 nucleus 16G As the starting machine , It's best to choose 16 nucleus 32G Our machine is more suitable , Because the database needs Execute a large number of disks IO operation , Each of his requests is more time-consuming , So the configuration of the machine naturally needs to be higher .
Then from our previous experience , commonly 8 nucleus 16G The machines are deployed MySQL database , It's OK to resist one or two thousand concurrent requests per second , But if you The concurrency of is higher , Suppose there are thousands of concurrent requests per second , Then maybe the database will be a little dangerous , Because the database CPU、 disk 、IO、 Memory load Will be very high , If the pressure on the database is too high, it will go down .
about 16 nucleus 32G The machines are deployed MySQL Database , Two or three thousand per second , Even three or four thousand concurrent requests are OK , But if you reach every Tens of thousands of requests per second , So the database CPU、 disk 、IO、 The load of memory will soar to a high level in an instant , The database may not be able to withstand downtime .
So this is for databases , We generally recommend the configuration of the selected machine , And how much concurrent requests he can resist .
In addition, for databases , If you can , It's better to use SSD Solid state drive instead of ordinary mechanical hard disk , Because the biggest complexity of the database lies in a large number of disk IO, He needs a lot of disk files to read and write , So if you can use SSD Solid state disk , Then your database can resist more concurrent requests per second .
5、 Today's question
Today I want to leave you with a small question to think about : Suppose you developed Java The system is deployed on a 4 nucleus 8G On the machine , So let's assume this Java The system processes a request Beg very, very fast , Each request only needs 0.01ms You can handle it , So you think this machine is deployed Java System , It can resist thousands of concurrency per second Please ? Can you resist tens of thousands of concurrent requests per second ?
边栏推荐
- Popularization of security knowledge - twelve moves to protect mobile phones from network attacks
- Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
- What should the redis cluster solution do? What are the plans?
- The 32 year old programmer left and was admitted by pinduoduo and foreign enterprises. After drying out his annual salary, he sighed: it's hard to choose
- MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.
- Simple solution to phpjm encryption problem free phpjm decryption tool
- How can I take a shortcut to learn C language in college
- MySQL实战优化高手06 生产经验:互联网公司的生产环境数据库是如何进行性能测试的?
- Which is the better prospect for mechanical engineer or Electrical Engineer?
- MySQL实战优化高手08 生产经验:在数据库的压测过程中,如何360度无死角观察机器性能?
猜你喜欢
51单片机进修的一些感悟
Automation sequences of canoe simulation functions
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
Cmooc Internet + education
Listen to my advice and learn according to this embedded curriculum content and curriculum system
C miscellaneous two-way circular linked list
Single chip microcomputer realizes modular programming: Thinking + example + system tutorial (the degree of practicality is appalling)
14 medical registration system_ [Alibaba cloud OSS, user authentication and patient]
CANoe的数据回放(Replay Block),还是要结合CAPL脚本才能说的明白
AI的路线和资源
随机推荐
How does the single chip microcomputer execute the main function from power on reset?
The governor of New Jersey signed seven bills to improve gun safety
MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
[untitled]
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
安装OpenCV时遇到的几种错误
15 medical registration system_ [appointment registration]
Hugo blog graphical writing tool -- QT practice
Cmooc Internet + education
Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
C杂讲 文件 续讲
单片机如何从上电复位执行到main函数?
Contrôle de l'exécution du module d'essai par panneau dans Canoe (primaire)
MySQL实战优化高手08 生产经验:在数据库的压测过程中,如何360度无死角观察机器性能?
Nc29 search in two-dimensional array
The programming ranking list came out in February. Is the result as you expected?
Retention policy of RMAN backup
Delayed note learning
软件测试工程师必备之软技能:结构化思维
Routes and resources of AI