BudWk V7 builds a microservice development framework from scratch - 02 Technology selection

Basic Web Framework

After reviewing and examining a bunch of similar open source frameworks in Gitee, they mostly use SpringBoot and SpringCloud technology systems, and they also use SpringCloud to build a semi-finished V7.

First of all, the emergence of SpringBoot greatly reduces the development difficulty of Spring series development frameworks such as SSH and SSM. His componentization error slightly reduces the complicated configuration and initialization work, but after using nutz for many years, I have become accustomed to her concise, flexible and grammatical habits. Some aspects of SpringBoot are still a bit "circumscribed", and SpringCloud's technical system is still numerous, without nutzboot, which saves time and worry, and the learning cost of switching basic framework companies is high, so can we achieve the goal of V7 with the original nutzboot series? Come on, give it a try.

Permission Framework

V7 has been using the Shiro permission framework before. I want to complain here. Why do a bunch of foreign frameworks have to be so complicated to write? Obviously very simple things have to be so abstract and complicated. ... In short, after some screening, I feel that sa-token is more in line with my needs, simple, powerful, worry-free and labor-saving, the key is that it is domestically produced like nutz!

Snowflake Primary Key

Before V7, the primary keys of permission-related tables are all in UUID format. Some small partners asked why not to use the self-increasing primary key generation method that comes with the database? That's because of stepping on the pit, when deploying from Tomcat dual-machine and when microservices are deployed in a distributed manner, there may be problems such as primary key conflict, unsatisfactory table and database scenarios, etc.

The UUID primary key is non-sequential and has an impact on performance. It no longer meets the business requirements of the current IoT big data scenario. The previous version of V7 also provided a mechanism to generate the primary key using Redis incr, but the maximum size of the database must be set at startup. The ID is synchronized to Redis, which brings trouble to system maintenance.

V7 needs to implement the snowflake primary key mechanism, which does not have the above shortcomings. I just found a new open source project yitter/IdGenerator , tested it, and it works.

Registration Center & Configuration Center

Both V5 and V6 have released versions based on zookeeper and nacos respectively, and nacos takes up more memory than zk. Although for customers using a single system, nacos occupies a large amount of memory, and the server configuration requirements are higher, but for customers who use multiple systems "integrated", only one set of nacos can achieve configuration and service management. Cost-effective.

V7 uses nacos as the registration center, the configuration center is equivalent to a gift function, haha, and the API gateway can also be used, killing three birds with one stone.

API Gateway

After some struggles, I finally chose to use nutzcloud -perca in nutzboot to simplify and in- depth transformation. It realizes the proxy function based on jetty-proxy, and realizes service discovery based on nacos, and nacos is the service registration center and configuration center of V7, good news.

{{o.name}}
{{m.name}}

Guess you like

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