Explain the most popular architectures from a simple website

        I am a JAVA engineer, and recently helped a company in Shenzhen to write a website of Shenzhen waste recycling www.xfhuishou.cn. If you are interested, you can go to the website, http://www.xfhuishou.cn/, of course there is a mobile version of www.xfhuishou.cn.
       Closer to business, let’s talk about the structure of this website first. The website uses the most popular springMVC, MONGODB, REDIS, nginx, a simple enterprise website needs to use the lightest free framework. SPRING MVC needless to say, easy to use, MONGODB I use the morphia framework, the API is as simple and easy to use. Some people say why use nginx, the traffic of corporate websites is not necessary. In fact, the traffic of this enterprise's website is not a challenge. To use it, as long as it is placed on my own server, and this server is placed on several other enterprise's websites, in this way, I can use its reverse proxy function to configure different configurations. URL maps to different corporate websites

         Also, REDIS is actually not necessary. After all, the traffic is so small that there is no need to use CACHE. I use CACHE, as long as I use REDIS to implement my own SESSION, of course, a TOMCAT is suspected of using B. In fact, the programmer is to Can I make progress by pretending to be B?

Of course, many people will develop small websites, but if the traffic comes up, how to solve it is the key. In fact, this structure is easy to expand. Add a DUBBO to the service layer for service. Because of the response to a request, most of the pressure is on the database layer. After service, applications of multiple service layers can be deployed. Then there is the important data CACHE, REDIS is very easy to use, especially its atomic operation, it is also good for distributed locks, I have implemented a cacheable CACHE layer on DAO, and the bottom layer is REDIS. Coupled with the reverse proxy function of NIGINX, requests are distributed to different application servers to solve the problem of large traffic. In fact, CACHE is a good solution to the problem of N+1 search. Try not to associate tables, first search the results of a table, and then go to CACHE to find the associated data, and the performance will be much better.

       Of course, after the traffic is large, the next problem is the large amount of data. Some document tables in MONGODB should be indexed or indexed, but you must know that indexes should not be added indiscriminately, and garbled characters will be useless. After all, MONGODB queries every time Only one index can be used, and MONGODB's automatic table splitting function is also very easy to use. As long as the memory is large enough, it is still very cool to use. 

      Shenzhen waste recycling www.xfhuishou.cn

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491827&siteId=291194637