In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Recalling that it has been years since the first line of code that the company was founded, the technical architecture and technical system of the platform has also undergone four major upgrades and transformations (currently the fourth-generation architecture system is under way). Near the end of the year, I would also like to take the time to review the technological changes behind the zero trading of a small company to the current trading volume of more than 10 billion yuan.
General introduction
In fact, more than 10 billion yuan in the Internet financial industry is not a big platform, that is, the secondary camp. In fact, each architecture upgrade is accompanied by the major promotion of the business, and the problems encountered in the previous generation system architecture. Some excellent development cases have been accumulated in the process of business development, and architecture upgrades will be vigorously promoted in the next generation of system development. On the one hand, it can smooth the transition, on the other hand, the company's resources can strongly support it, and at the same time, technology friends can use cutting-edge technologies and have a greater sense of achievement in development, so we upgrade the system architecture once every nine months or so. into our current architecture.
Many netizens often ask, what is the TPS of your platform, what is the maximum concurrency, and what is the performance? to be honest, we are a small company, and tens of thousands of people grab bids at the same time, but as a medium-sized Internet financial platform, there are really a lot of things to do, far from being clear about these parameters. We are not a high-end platform, and the technology we use is currently more mainstream open source products, but we have also encountered a lot of problems in the process of continuous development of the company. also try to use some mainstream, open source, suitable for our solutions to build the entire system, here to share the changes of technology behind the development of the platform, and hope to do more exchanges with you and make more suggestions.
We have made four major architectural changes, and each generation of architecture is summarized in one sentence:
The first generation architecture features: relatively centralized business, functions to meet the needs of investment and financial management, quick launch
The characteristics of the second generation architecture; the transformation of distributed systems, the platform has begun to take shape, various vertical business systems have been built online, the product side has greatly enriched user investment, and big data platform has been studied and used.
The characteristics of the third generation architecture; SOA governance, using zookeeper as the registration center, dubbo as the monitoring and scheduling center; cas to achieve single sign-on, using shiro for access control
The characteristics of the fourth-generation architecture; fully enable the micro-service development model, springboot+springcloud technology as the technical support of the fourth-generation architecture
The following is a detailed introduction
First generation system architecture
2014 should be regarded as the first year of Internet finance. in fact, before that, many Internet companies had been living in various models and had been tepid, but it suddenly became popular in 2014. first of all, there was a sudden surge in traffic on third-party websites such as online loans, and then media reports continued to follow. later, there were more and more reports that various Internet financial companies had received investment in XXX dollars, and the policy gradually became clear. So many large companies (groups) took advantage of this craze to follow up, including us.
The first generation system is mainly to seize time, the company hopes to use the shortest time to ensure that the system is online, at that time the mobile wave has started, so decided to give priority to the mobile side, the website can not be considered. At that time, the company had two development language technology reserves of PHP and Java, because PHP had a great advantage in rapid development, so it decided to adopt the front-end PHP+ back-end Java model. The system is divided into three layers: user layer: Android and IOS mobile; interface layer: php provides user and transaction interface; back end: back end has two parts, background and timing system. The background uses PHP development and interface layer to share a system, and the other is a timing system, which is responsible for calculating interest, paying dividends, expiration and other scheduled tasks using java development.
Basic services and middleware, mysql does the most basic master-slave support, the first generation system only uses mysql master library, slave library is only synchronous backup; memcached is used to deal with the concurrency problem of user bidding, and only this piece is used; ActiveMQ is used to use transfer matchmaking in the secondary market and other asynchronous message notifications. Project deployment: php uses apache deployment, timing service uses tomcat6 as the application server, and lvs does the load of the front-end apache. Basically, these technologies are the first generation. The following is the architecture diagram of the first generation system.
After the first generation system was launched, the construction of the website and H5 (mobile browser or WeChat) system became particularly prominent. As an Internet finance company, it could not stand it without an official website, so it began to develop the website and H5 system nonstop. During this period, the backstage piece that PHP did before was taken out, and a new version was planned with java, and PHP is now responsible for the website, APP interface and H5 system. The three systems share a core transaction. The java side is responsible for background management and timing services. We generally call this architecture the 1.1G architecture.
The 1.1 generation system architecture diagram, the green part is the changing part
The disadvantage of the first generation system is that the business is too concentrated, it goes online in a hurry, and there are many problems in the later stage.
Second generation system architecture
The background of the second generation system is that with the rapid development of the company's business volume, many initial technical debts have broken out, and there are a lot of problems online, the most serious one is repeated dividends to individual users, all kinds of scolding, which is still fresh in my memory. On the other hand, there is constant demand from various business departments and continuous demand for the company's products, so at this stage, we are busy repairing various production problems while developing vertical business systems. At that time, I was almost driven crazy, the first generation of system was closed development, and I didn't get over it yet. I was in a hurry to fight here, which was really painful and happy.
The first vertical subsystem came online: the contract system, when users did not have a contract after bidding, and many users were very worried, so they raised the priority to the front. Later, there were three versions of the single contract system, the first version only generated pdf, the second stage launched the electronic signature, the third stage added watermarks, customized and dynamically generated pdf;, followed by the development of points system: user invitation, investment and other production points, used to exchange for discount volumes, etc.; pull out the message system: on-site messages, text messages, emails, etc.; online monitoring system, business monitoring and service monitoring, business failure early warning Various business departments continue to raise demand and go online with financial systems: financial personnel count and calculate amounts; risk control systems: monitor abnormal users and abnormal transactions; develop sales systems for sales; because they are docked with many third-party systems, external access systems are also developed.
The first generation system was in a hurry, and the product interface was very bad, so it immediately launched the planning of website 2.0, APP2.0, H52.0. To meet the needs of the front-end system, the CMS system was developed at the back end to release the project, the company's announcement news, and so on. The second generation product side generally plans some of the requirements of big data's analysis, which will show on the official website where the investment preference and the amount of investment will go after full data analysis, and the front end will show it with a map, and there will also be a repayment calendar for individuals, data analysis, etc., because there is a need to run full data, so it is designed to process offline at the time of planning, synchronizing the data from the mysql database to the mongodb cluster. Using mongdo's mapreduce technology to process large amounts of data, our database layer becomes the following architecture
Mysql is synchronized to mongodb in real time. We use the tool tungsten-relicator, which starts a monitoring agent on the mysql server and monitors the binlog logs of the mysql in real time. At the same time, it also acts as a server on the server side of the mongodb. The agent monitors the data changes and transmits them to the server. The server is parsed and inserted into the mongodb cluster to achieve the effect of real-time synchronization, as shown in the figure above. Originally wrote an article to introduce: big data practice-data synchronization article tungsten-relicator (mysql- > mongo), in fact, this tool in use, is not particularly stable, but the original options are not many, fortunately later slowly familiar with it is stable.
Data cleaning system we boldly used the golang to develop, then using the golang version is 1.3bar, now 1.8, before is also no contact is to exercise the team, fortunately, the golang language itself is very concise and efficient, although stepped on N many pits, but finally we put into production on time; later used golang to develop a background, is based on the beego framework to do. Big data analysis system later upgraded a generation, in the front-end business systems, the UI user layer did a lot of buried points to collect user data, through activeMQ transmission and reception to the final storage to mongodb, in the data cleaning, the cleaned results will be stored in the result database for the front-end business system to use; later, using beego+echart to do a new version of the data analysis system.
The architecture diagram of big data's system
Because of the increasing pressure on the back-end database, the back-end management system and business system have made master-slave separation; the background management system has added cache and started redis as cache; an independent image server has been built using nginx; and the second-generation system development process is also the fastest growing stage for the company, with more than N activities online.
Architecture diagram of the second generation system:
The second generation architecture launched various business systems, separated the master from the slave, and built the big data platform to provide a technical basis for more data processing in the future.
Disadvantages: after the segmentation of each business system, the calls between the projects are complex; there are many background systems, and there are separate account systems between the systems, so the operation needs to switch back and forth to complete the platform operation monitoring.
The third generation system architecture
After the completion of the development of the second generation system, we are left with three painful problems. the first is that with the increasing number of business systems, the call relationship between systems increases exponentially. At the beginning of the third generation system, we developed a lot of basic components, which exacerbated the problem. The second problem and the first problem complement each other. There are too many call relationships between systems. If you move one of the subsystems, you may need to modify the configuration file of the associated system and restart the service. Often because you update a system, other systems also need to be passively updated. Switching between production and fallback is very complex. The third problem is that we have developed a lot of back-end systems, but the accounts are not unified, each subsystem has its own account center, and operators and business personnel need to log in back and forth to complete their daily work. with the increase of business volume, this problem has become increasingly prominent.
So we started research, system selection, etc., to solve the first problem is the introduction of SOA service governance, through service registration and discovery to solve the decoupling between systems, at that time a lot of inspection, the final selection of dubbo, for no other reason, a large number of people have waded through the water of this trip. To solve the second problem is to introduce the configuration center. At that time, we investigated Qihoo360/QConf, spring-cloud-config of Spring, diamond of Taobao, and disconf of Baidu. Finally, we chose disconf for a long time, and perfectly missed spring cloud. But it was from here that we noticed that spring-cloud and Spring-boot foreshadowed the architecture selection of the fourth generation. In fact, disconf was only used in a small number of projects and not fully promoted. The third problem is the account center, which uses cas to achieve single sign-on, shiro for permission control, dubbo to provide server-side interfaces such as permission list after login.
Modified architecture diagram
On this basis, we extract a lot of basic components. Comomn components deal with common basic classes, including character classes, date classes, encryption classes. Set up a fastDFS cluster to deal with the file system and test the redis cluster; develop a timing scheduling system separately, which integrates all timing tasks into the scheduling system, which requires that timing tasks can automatically add scheduling policies on the page; the front-end PHP has done system transformation, such as master-slave separation, static optimization, etc.
Later, the company started the construction of the crowdfunding platform, this time the system was developed entirely in java language, and the app side adopted a mixed development mode, in which all the first-level pages of APP were developed natively, all the second-level pages were in the mode of H5+vue, and the back-end was all serviced by dubbo. The final structure is as follows:
Only part of the system is listed in the figure and other services are used instead.
The third generation system starts SOA service governance and introduces unified account center and basic components, but the disadvantage is that the development environment is complex.
Fourth generation system architecture
People are always dissatisfied, and technology always wants to use the best architecture. In the development of the third generation system architecture, I learned about spring cloud and springboot. After continuous learning, I feel more and more about the convenience of springboot and the advantages of rapid development. The spring cloud system also fully meets all aspects that a large system needs to consider, and the concept of micro services is constantly put forward. The above is the technical background. On the other hand, the state began to strictly require P2P companies to access bank depository. After analyzing the relevant interfaces of banks, it is found that if we strictly follow the rules, our system needs to be greatly reformed. At the same time, in order to meet regulatory requirements, it is also a big project to develop products related to white slips. Taking advantage of the above two backgrounds, we decided to fully embrace micro-services while carrying out bank depository and white slips projects.
As for why we should abandon dubbo to embrace spring cloud for three reasons: 1, dubbo has not been updated for many years, spring cloud is constantly updating and upgrading; 2, dubbo mainly does service governance and monitoring, spring cloud almost considers all aspects of micro services, such as unified configuration center and routing center; 3, spring cloud is non-invasive and perfectly integrated with other spring projects, making development more efficient.
Since spring boot+spring cloud has been selected for transformation, the selection of micro-service technology has been decided here, so how to start the transformation? after all, the transformation of the new generation of systems can not affect the original business at the same time. The main problem is that although the initial systems are carried out in accordance with the distributed development mode, some systems still share a database due to the reasons of the old systems. Micro-service requires that each independent subsystem has its own independent library operation. If other systems need to modify or query the data of the subsystem, they need to be called according to the service indirect port to obtain. Therefore, it is planned to enable the springcloud project from the newly developed projects and projects that need to be modified, and other systems will communicate through router mode for the time being. The final system architecture diagram is as follows:
There is no end point on this road of the architecture, the change is the same forever, the upgrade of the architecture is to better support the business, the two complement each other.
Open source software
In the past few years, we also want to make a little contribution to the open source world, a total of two open source software:
Generator-web
Mybaits is widely used in the project. We have modified the generator of mybaits and made a system interface to facilitate the automatic production of related code according to the relevant parameters (only the table structure is designed, and the system will automatically generate mappper, Entity, dao layer code), and finally open source.
Generator-web
The interface is as follows:
Cloud collection
In order to practice the technology to learn springboot, we have developed a cloud collection of open source software, the main technology is springboot/Spring data jpa/redis/thymeleaf/gradle, the main function is to help users to collect, share and organize their favorites in the cloud.
Favorites-web
Author: a pure smile
Source: http://www.ityouknow.com/
All rights reserved, you are welcome to retain the original link to reprint:)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.