“What will be hot and what to learn in 2022? This article is participating in the” Talk about 2022 Technology Trends “essay campaign.
For Taiwan (business in Taiwan) technology development is mainly the use of the basic technology stack, and is to improve the abstract ability, because we are the bottom service can not go wrong, need to constantly do compatibility. Some Java technology background, design patterns, and in-depth knowledge of the most common technical principles are required. Today we are going to take a look at some of the technical frameworks commonly used in Java business and some of the technologies that may be used in the future.
Spring
Spring Framework is a basic open source Framework in Spring, mainly used for enterprise development of JavaEE. What is Spring? First, it is an open source project and very active; It is an IOC – and AOP-based framework for architecting multi-layer JavaEE systems, but it does not force you to use Spring in every layer, because it is well modularized and allows you to use one of its modules according to your needs. It implements elegant MVC, provides a unified interface to different data access technologies, uses IOC to make it easy to implement Bean assembly, provides concise AOP to implement Transaction Management, and so on.
The current mainstream version of Spring support is 5.3, with open source support by 2025 at the latest.
Spring Boot
Spring Boot is a new framework from the Pivotal team designed to simplify the initial setup and development process for new Spring applications. The framework uses a specific way to configure so that developers no longer need to define boilerplate configurations. In this way, Spring Boot aims to be a leader in the burgeoning field of rapid Application development.
Spring Cloud
Spring Cloud is an ordered collection of frameworks. It takes advantage of the development convenience of Spring Boot to subtly simplify the development of distributed system infrastructure, such as service discovery registry, configuration center, message bus, load balancing, circuit breakers, data monitoring, etc., which can be started and deployed with one click using Spring Boot’s development style. Instead of reinventing the wheel, Spring Cloud simply combines mature, proven service frameworks developed by various companies and encapsulates them in Spring Boot style, eliminating complex configuration and implementation principles. Finally, a simple and easy to understand, easy to deploy and easy to maintain distributed system development kit was set aside for developers.
Netflix is the strongest framework in Spring-Cloud 1.x, offering excellent components such as Eureka, Hystrix, Zuul, Ribbon, etc. But after a period of downtime, it is replaced by some other components of Spring-Cloud, such as Spring Cloud Alibaba. After all, Netflix has also been a central mover in the Spring Cloud journey.
MyBatis
MyBatis is an excellent ORM middleware for data persistence layer. We commonly use XML and annotations in two ways, and MyBatis-Generator plug-in helps us quickly generate DATABASE CRUD code.
MyBaits also supports the integration with Spring, and is one of the data persistence layer frameworks commonly used in Internet and business platforms.
In fact, the excellent persistence layer framework is Hibernate, which I have used since 14 or 15 years ago but rarely used by companies involved in the latter
Alibaba middleware
I have to say that Alibaba is one of the big teams in Java technology stack and has contributed many excellent open source frameworks such as Doubbo, Nacos, Seata, Sentinel, etc.
Nacos
Nacos is a service discovery, service configuration, and service management middleware. Nacos provides an easy-to-use feature set to quickly implement dynamic service discovery, service configuration, service metadata, and traffic management.
Nacos allows us to build, deliver, and manage microservices platforms more quickly and easily. Nacos is the service infrastructure for building modern “service” centric application architectures (e.g., microservices paradigm, cloud native paradigm).
Key features of Nacos include:
- Service discovery and Service Health Monitoring Nacos supports DNs-based and RPC-based service discovery. After a Service provider registers a Service using a native SDK, OpenAPI, or a separate Agent TODO, Service consumers can use DNS or HTTP&API to find and discover services. Nacos provides real-time health checks on services to prevent requests from being sent to unhealthy hosts or service instances. Nacos supports health checks at the transport layer (PING or TCP) and the application layer (e.g. HTTP, MySQL, user-defined). Nacos provides two health check modes: Agent report mode and server active check mode for complex cloud environments and network topologies, such as VPCS and edge networks. Nacos also provides a unified health check dashboard to help you manage service availability and traffic based on health status.
- Dynamically configured services Dynamically configured services allow you to manage application and service configurations for all environments in a centralized, external, and dynamic manner. Dynamic configuration eliminates the need to redeploy applications and services when configuration changes, making configuration management more efficient and agile. Centralized configuration management makes it easier to implement stateless services and make it easier for services to scale flexibly on demand. Nacos provides an easy-to-use UI to help you manage the configuration of all your services and applications. Nacos also provides a number of out-of-the-box configuration management features including configuration version tracking, Canary publishing, one-click rollback configuration, and client configuration update status tracking to help you more securely manage configuration changes and reduce the risks associated with configuration changes in a production environment.
- Dynamic DNS Service The dynamic DNS service supports weighted routing, enabling you to implement load balancing at the middle layer, flexible routing policies, traffic control, and simple DNS resolution services on the data center Intranet. Dynamic DNS services also make it easier for you to implement DNS protocol-based service discovery to help eliminate the risk of coupling to vendor-proprietary service discovery apis. Nacos provides some simple DNS APIs to help you manage your service’s associated domain name and available IP:PORT list.
- Service and Metadata Management Nacos allows you to manage all services and metadata in your data center from a microservices platform construction perspective. This includes management service description, life cycle, static dependency analysis of the service, health of the service, traffic management of the service, routing and security policies, SLA of the service, and most importantly metrics statistics. \
Nacos architecture Diagram:
Sentinel
With the popularity of microservices, stability between services becomes increasingly important. Sentinel takes flow as the entry point to protect the stability of service from multiple dimensions such as flow control, fusing downgrading and system load protection.
Sentinel has the following characteristics:
- Rich application scenarios: Sentinel has undertaken the core scenarios of Alibaba’s double Eleven traffic drive in the past 10 years, such as SEC killing (i.e. burst traffic control within the range of system capacity), message peaking and valley filling, cluster flow control, real-time fusing of unavailable downstream applications, etc.
- Complete real-time monitoring: Sentinel also provides real-time monitoring capabilities. From the console, you can see a summary of the performance of a single machine-by-second data, or even a cluster of less than 500 machines, for accessing the application.
- Extensive Open source ecosystem: Sentinel provides out-of-the-box integration modules with other open source frameworks/libraries, such as Spring Cloud, Apache Dubbo, gRPC, Quarkus. You can quickly access Sentinel by introducing the appropriate dependencies and simple configuration. Sentinel also provides native implementations of Java, Go, C++ and other languages.
- Comprehensive SPI extension mechanism: Sentinel provides an easy-to-use, comprehensive SPI extension interface. You can quickly customize the logic by implementing an extension interface. For example, customize rule management and adapt dynamic data sources.
\
Sentinel ecological
Seata
Seata is an open source distributed transaction solution dedicated to providing high performance and easy to use distributed transaction services. Seata will provide users with AT, TCC, SAGA and XA transaction modes to create a one-stop distributed solution for users.
AT mode
Based on a relational database that supports local ACID transactions. Java applications, access the database through JDBC. Implementation based on two-phase commit.
TCC mode
The TCC mode mainly focuses on service separation. When resources are horizontally expanded based on services, the consistency of calls between micro-services is solved and transaction attributes of read resource access are guaranteed.
SAGE mode
Saga mode is a long transaction solution provided by SEATA. In Saga mode, each participant in the business process submits a local transaction, and when a participant fails, the previous successful participant is compensated. One-stage forward service and two-stage compensation service are implemented by business development.
Arthas
Arthas is an open source Java diagnostic tool for Alibaba. For example, when we run into OOM or interface timeouts, we need analysis tools like Arthas to do runtime analysis to find performance bottlenecks.
ElasticSearch
Elasticsearch is a distributed, scalable, real-time search and data analysis engine. It makes it easy to search, analyze and explore large amounts of data. Taking advantage of Elasticsearch’s horizontal scalability can make data more valuable in a production environment. Elasticsearch is implemented in the following steps: First, users submit data to the Elasticsearch database, then use the word segmentation controller to classify the corresponding words, and store their weight and word segmentation results in the data. When users search for data, they rank and score the results based on the weight. The result is then presented to the user.
ElasticSearch can be used as a complement to queries that can’t be handled by a relational database.
Reference documentation
- zhuanlan.zhihu.com/p/32611740
- github.com/seata/seata
- Github.com/alibaba/Sen…
- nacos.io/
- arthas.aliyun.com/doc/