Articles
-
Integrating ReactJS with Spring Boot
Nowadays, architectures with separate frontend & backend deployments are becoming more and more popular. Because it decouples the frontend from the backend, improves maintainability of the code and the work efficiency. In this article, by tracing the source code, I introduce how the static web contents are hosted in Spring Boot; Then I present the common ways to create a React application; In the end, I illustrate the methods of hosting frontend & backend on different origins, and discuss the problems relating to CORS policy. This is an easy-to-follow reading, suitable for full stack learners.
-
Dynamic Data Source Routing in Spring
Recently we designed a system that needs to switch the data sources based on the region infos in each request. We accomplished that idea by adopting the AbstractRoutingDataSource, which is a very useful feature in spring framework if you want to choose a particular data source when user belongs to certain locale and switch to another data source if user belongs to another locale. In this post, I will show an example that using AbstractRoutingDataSource with a thread-bounded context to implement the dynamic data source routing.
-
An Overview of Reactive Programming
If you are following the Java community, you may notice that the reactive programming is not something new, it’s been around for a while. But in these years, it seems to be getting more and more popular. Recently, Java community released many new version tools on this theme, which can be confusing sometimes.
In this article, we firstly pick some of the new updates and sort out their relationship, then we walk through some of the basic concepts about reactive programming, and finally we provide some example codes which could help you get a better understanding about this topic.
-
A Brief Introduction to Alibaba's Canal
In the previous article, I introduced the deployment of our Elasticsearch cluster, which is used for a product retrieval system. In order to synchronize the data from MySQL database to our ES cluster in near real time, we investigated many middle wares, and finally chose the Canal as our solution. Canal is a data synchronization middle ware, which is one of Alibaba’s open source projects. The way it works is that it disguises itself as the slave database and ingests data from a real master database. By parsing the binary logs, it re-plays the events happened in the master database, and pushes the events in the form of messages to its downstream.
In this article, I will firstly introduce the background, then the general structure of Canal, and in the end I will talk about its high availability (HA) design. This article is entirely technical, anything related to commercial information has been excluded.
-
Elasticsearch: from Concepts to Actual Deployment
In a project in recent months, I was responsible for investigating
Elasticsearch
and constructing a cluster for a product retrieval system. At this moment, the project is almost complete. So I record some of the key technical points for review. In this article, I will briefly introduce some of the basic concepts, the high availability mechanism of Elasticsearch, and then I will talk about some of the problems in actual cluster deployment.This article is entirely technical, anything related to commercial information has been excluded.
-
TCP Connection And DDoS Attack
TCP is connection-oriented, which means that before any data can be transmitted, a reliable connection must be obtained and acknowledged. A DDoS attack is an attempt to make an online service unavailable by overwhelming it with traffic from multiple sources. SYN Flood Attack, one of the most popular DDoS, exploits part of the normal TCP three-way handshake to consume resources on the targeted server and render it unresponsive.
-
Basic Concepts and Practices About RabbitMQ
RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr. Postman will eventually deliver the mail to your recipient. In this analogy, RabbitMQ is a post box, a post office and a postman. In this article, I will give a brief introduction of it, including the basic concepts and the common situations where the MQ is needed.
-
Redis Interview Questions
Redis is an open-source, advanced key-value data store. It is also referred as a data structure server which keys not only contains strings, but also hashes, sets, lists, and sorted sets. Redis mostly used for cache solutions and session management. In this article, I record down some of the important points about Redis for the further review.
-
Distributed Transactions
Local transactions are specific to a single transactional resource like a JDBC connection, whereas global transactions can span multiple transactional resources like transaction in a distributed system. A distributed or a global transaction is executed across multiple systems, and its execution requires coordination between the global transaction management system and all the local data managers of all the involved systems.
-
Spring Transaction Management
A database transaction is a sequence of actions that are treated as a single unit of work. These actions should either complete entirely or take no effect at all. Transaction management is an important part of RDBMS-oriented enterprise application to ensure data integrity and consistency. The concept of transactions can be described with the following four key properties described as ACID.