There have been many people asking about the architecture method. In fact, the architecture is not made, but changed. But it's always the same-everything is done with rules and methods! Last year, I had the honor to have a Distributed File System (DFS) optimized architecture and share with you.
Distributed File System (DFS). I don't know what this is.
First, you must understand where your problem is? Our problem is that the amount of images is too large, leading to a very high website card. This is an external phenomenon. What is the problem? Why use DFS? What does it mainly do? How to use it?
Simply put, the role of DFS is simple. At present, our system is mainly used to solve the problem of users uploading images (not the problem of images, so solve it ). Is there a big fuss? How can I use a DFS system to upload images separately? Isn't it a complicated design? You just need to upload the file to the root directory of the site? Yes, this is a solution. But have you ever wondered how many images we have? Most of our images need to be maintained online, that is, Tb-level images. In addition, our web server uses F5 for load balancing, that is to say, it is not a separate web server, so your images must be centralized for management and maintenance.
Some people may say that they directly put the images in the database! In fact, we did this before (because the previous amount is not large ). The advantage is that it is easy to manage, and the disadvantage is that it is equivalent to installing a virus (a large amount of data) for the database ). When the number of images comes up, you can only upgrade the hardware, but upgrading the hardware is a dead end. You have to change the hardware policy to the software policy sooner or later. Taobao is a good example.
Is there a solution? WS/emoting ?! Yes, if the speed is fast enough, it is also a kind, but the reality is cruel! We tried to write a TCP Service using net, and finally chose to give up. The reason is that the speed is not flattering. Second, Windows disk management is not very useful for such pure file services.
At this time, we thought of Linux, a natural memory and file server. But to run on Linux, your options are C, C ++, Java, and other scripting languages. Language and platform are not important? No, it's important. Because you need to modify it, maintain it, and manage it. Choosing a language or platform you are not familiar with is undoubtedly the beginning of a nightmare. What is the most controllable for our net team? It is obviously C. C ++ is a dominant position, second milk rights and interests, and a language tempted by wild flowers. It is rarely able to achieve global control. Java, this ......, Or not ?! The only question you have left is that you write it yourself? Or are you looking for an open-source one? The answer is to see how much cost you have.
Cost, whether it's money or time or people. For us, money is not a big problem, but when we were doing DFS, we had only two people in our group, and the other was still doing Cache Optimization over there, so there was no time to do DFS, since I came out of school, C has basically been returned to the teacher. C cannot be claimed in a short time. Therefore, if you write your own data for a long time, the risk is high. After I discussed it with him, I chose open source.
Open source is a good thing. Every time at the key, you can be saved! Of course, open-source software is not commercial software. Don't ask too much. Don't expect it to be used just like Ms. You have to change it as needed. We have changed several areas that do not match our needs. Then open-source software must be tested. Perform complex and comprehensive tests. Performance, functions, disasters, and so on. All these tests must be done. Our practice is to write test cases by me, because in general, only architects and developers can know where the most likely problem is, so we should focus on testing. Your goal is actually very simple, that is, when you send your test case to the tester, the tester can understand this document and "cry ", if the test passes in this case, the open-source software is enough.
Here, why should we put the test first? Open-source software is often not very reliable, especially in some extreme cases of functional and performance problems, so you must first test and test, you can meet your own functional and performance requirements. Then you can really start to perform detailed business analysis and how to deal with this. Someone may ask, you don't know what the business needs are, how do you select a model, and how do you arrange a test? Are you sure you know what it means? You don't know? Kidding, you don't know what you want. Why are you optimizing this? You must know the problem and then solve it! Do you still have 80% of this question? The following 20% is a few details. As the architecture focuses on watermelon, sesame seeds must be lost.
The next step is how to optimize your system. Do some research first. Business groups are the first to bear the brunt, because they are front-line staff who have a very good understanding of what customers need and what they need. So don't let it go. Who is the second one? The person who used to make the architecture knows the advantages and disadvantages of how to do it and how to do it. So this person is also valuable. What about the third? Your leader! He must have his own ideas on this thing, such as the requirements for some performance problems. Collect all of these information and check whether the functional points you have tested can meet the requirements one by one? Yes, so everything is fine. No? After a hard time, change it by yourself!
In this way, after testing by the tester, your system has basically no problem.
You have investigated the detailed requirements above. Do you understand this very well? Is it possible to make the most suitable architecture? For example, whether read/write splitting and hot backup are required. After the architecture is illustrated in this way, I will discuss with the O & M brothers about whether the architecture will be far from the rest of the world?
So what are you going to do next? Follow up on this optimization solution for at least 1-2 years. In the past 1-2 years, you will encounter different BT requirements, regardless of whether these requirements are due to your negligence, or the convenience of O & M personnel management. In short, there will always be changes waiting for you. You may think these requirements are too speechless, but they are reasonable. Therefore, solving it is the embodiment of your own value. Have you heard of a sentence? 20% of the people completed 80% of the valuable work of the company, and 80% of the people completed 20% of the valuable work of the company. No matter what you do, always make the first 20%.