当前位置:网站首页>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 ?
边栏推荐
- I2C summary (single host and multi host)
- CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
- CDC: the outbreak of Listeria monocytogenes in the United States is related to ice cream products
- Control the operation of the test module through the panel in canoe (Advanced)
- C杂讲 动态链表操作 再讲
- MySQL实战优化高手07 生产经验:如何对生产环境中的数据库进行360度无死角压测?
- The replay block of canoe still needs to be combined with CAPL script to make it clear
- 嵌入式开发比单片机要难很多?谈谈单片机和嵌入式开发设计经历
- Flash operation and maintenance script (running for a long time)
- Redis集群方案应该怎么做?都有哪些方案?
猜你喜欢
Docker MySQL solves time zone problems
Hugo blog graphical writing tool -- QT practice
The programming ranking list came out in February. Is the result as you expected?
Teach you how to write the first MCU program hand in hand
Elk project monitoring platform deployment + deployment of detailed use (II)
嵌入式開發中的防禦性C語言編程
Routes and resources of AI
The replay block of canoe still needs to be combined with CAPL script to make it clear
Jar runs with error no main manifest attribute
C杂讲 文件 续讲
随机推荐
Installation of pagoda and deployment of flask project
Retention policy of RMAN backup
软件测试工程师必备之软技能:结构化思维
通过bat脚本配置系统环境变量
Upload vulnerability
Random notes
Learning SCM is of great help to society
vscode 常用的指令
软件测试工程师必备之软技能:结构化思维
How can I take a shortcut to learn C language in college
Notes of Dr. Carolyn ROS é's social networking speech
零基础学习单片机切记这四点要求,少走弯路
The appearance is popular. Two JSON visualization tools are recommended for use with swagger. It's really fragrant
CDC: the outbreak of Listeria monocytogenes in the United States is related to ice cream products
Control the operation of the test module through the panel in canoe (Advanced)
Preliminary introduction to C miscellaneous lecture document
I2C summary (single host and multi host)
再有人问你数据库缓存一致性的问题,直接把这篇文章发给他
cmooc互联网+教育
A new understanding of RMAN retention policy recovery window