MyBatis Deep Dive - Level 1 Cache, Code Testing, and Source Code Analysis
Detailed introduction to MyBatis level 1 cache working principles, code testing, invalidation scenarios, and source code analysis.
Deep dives into Java backend, message queues, caching, and distributed systems from theory to production.
199 articles
Detailed introduction to MyBatis level 1 cache working principles, code testing, invalidation scenarios, and source code analysis.
Detailed introduction to MyBatis level 2 cache working principles, enable configuration, code testing, and source code analysis.
Currently, the level 2 cache we implement is per service. At this time, the cache is on a single server.
ORM stands for Object/Relation Mapping: an abbreviation for object-relation mapping.
This article provides an in-depth explanation of MySQL master-slave replication: master-slave mode, read-write separation, semi-sync replication principles and configurat...
This article provides an in-depth explanation of MySQL database design: availability (redundancy, failover), scalability (sharding, read-write separation), consistency.
This article provides an in-depth explanation of MySQL deadlocks: deadlock definition, necessary conditions, table lock deadlocks, row-level deadlocks, shared to exclusiv...
Pessimistic locking is a concurrency control mechanism based on a conservative "lock first, then modify" strategy.
This article provides an in-depth explanation of MySQL parallel replication technology: from 5.6 database-based parallel to 5.7 group commit-based to 8.
MySQL dual-master mode is a common high-availability database architecture solution, particularly suitable for the following business scenarios:
Deep dive into MySQL MHA high availability solution: MHA architecture, fault handling, primary-standby switch, lag issues and solutions. This article analyzes principles...
Sharding is the core technology for horizontal scaling in distributed databases.
Explore MySQL distributed primary key strategies including UUID, SnowFlake, COMB, Redis, and database ID table approaches with their principles, pros and cons...
Explore MySQL database horizontal scaling solutions for capacity, performance, and concurrency bottlenecks.
A comprehensive guide to Sharding-JDBC, a lightweight Java database middleware solving database sharding, read-write separation and distributed transactions.
In distributed databases, sharding is implemented through physical tables, logical tables, data nodes and binding tables.
Deep dive into ShardingSphere's sharding flow including SQL parsing, query optimization, SQL routing, SQL rewriting, SQL execution and result merging six major stages wit...
Read-write separation is a common database architecture optimization technique that separates write operations to master and read operations to slaves through master-slav...
Deep dive into ShardingSphere's SQL support scope, limitations, and optimization practices in sharding scenarios. Learn about supported SQL types, pagination subquery res...
In distributed databases, sharding uses physical tables, logical tables, data nodes and binding tables for efficient data storage and queries.
ShardingSphere's flexible transactions are implemented through the third-party servicecomb-saga component, using SPI mechanism for dynamic injection.
Distributed transaction patterns mainly include TCC, message queue, and Saga.
Seata is Alibaba's open-source distributed transaction solution providing one-stop transaction management with high performance, low intrusion and multi-language support.
Traditional approaches rely on database vendor XA drivers and application server transaction managers. Modern systems use embedded transaction managers.
CAP theory reveals that distributed systems cannot simultaneously satisfy consistency, availability and partition tolerance.
Data masking is a key data security technology that balances data utility and privacy protection by replacing, encrypting or perturbing sensitive information.
ShardingSphere's flexible transactions are implemented through the third-party servicecomb-saga component, using SPI mechanism for dynamic injection.
MyCat is an open-source distributed database middleware fully compatible with MySQL protocol.
Sharding-Proxy is one of the core products in the Apache ShardingSphere ecosystem, using a transparent database proxy architecture.
MyCat distributed database sharding strategies include E-R table sharding, global table mechanism, shard nodes, node hosts and sharding rules.
server.xml is MyCat's core configuration file, storing almost all system configuration information needed by MyCat.
MyCAT is an open-source database middleware supporting MySQL protocol, commonly used for database sharding and data sharding management.
MySQL transaction isolation levels include READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ and SERIALIZABLE. Each level solves different concurrency problems.
MySQL database transaction is a set of SQL operations executed as a single logical unit of work, following ACID principles: Atomicity, Consistency, Isolation and Durabili...
schema.xml is MyCat's core configuration file managing logical databases, logical tables, data nodes and data hosts.
Common issues in database transactions include dirty read, non-repeatable read, and phantom read. These issues are closely related to database isolation levels.
Transaction propagation is an important mechanism in Spring for handling transaction boundaries, defining how methods interact with transaction context in the call chain.
Introduces declarative transaction and programmatic transaction concepts, usage methods and comparative analysis.
Spring transactions are implemented through AOP dynamic proxies. JDK dynamic proxy requires the target method to be public.
Detailed introduction to @Transactional annotation parameters in Spring Boot, including transaction propagation, isolation levels, and exception rollback strategies.
Generally, open-source frameworks provide plugins or extension points for developers to extend on their own.
Spring transaction pitfalls commonly occur in scenarios like classes not managed by Spring, transaction manager not started, improper method modifiers (final, static...
Spring transaction pitfalls include rollbackFor configuration errors, transaction annotation overrides, nested transaction issues and more.
MongoDB common commands include show dbs to list databases, use to switch databases, db.createCollection() to create collections, show collections to list collections, db.
NoSQL is a general term for non-relational databases, including document-based MongoDB, key-value Redis, column-store HBase, and graph database Neo4j, each with its own c...
BSON is MongoDB's core storage format, a binary-encoded JSON-like format. Compared to JSON, BSON supports more data types like Date, Binary, ObjectId, with better perform...
Spring transaction pitfalls include multi-threaded calls, exception catching without rollback, manual exception throwing errors.
MongoDB indexes are core mechanisms for improving query performance, including single field indexes, compound indexes, multi-key indexes, geospatial indexes...
MongoDB index management includes createIndex, getIndexes, dropIndex operations.
MongoDB aggregation framework processes documents through multi-stage pipelines, implementing complex operations similar to SQL GROUP BY, JOIN, SUM, AVG.
MongoDB implements pagination through combination of skip(), limit() and sort() methods.
MongoDB data operations include single insertOne() and batch insertMany(). Query operators include $eq, $ne, $gt, $lt, etc. Logical operators include $and, $or, $not.
MongoDB uses B-tree indexes where nodes store both data and keys. MySQL uses B+tree indexes with all data concentrated in leaf nodes.
MongoDB is suitable for website data storage, caching systems, big data analysis, IoT, social media, live streaming platforms and more.
Two ways to connect Spring Boot to MongoDB: MongoTemplate and MongoRepository, with complete Java code examples and common problem troubleshooting.
Complete guide to accessing MongoDB with Java, including environment setup, Maven dependencies, connection, CRUD operations, POJO mapping, index management.
MongoDB slow query analysis through built-in Profiler, set db.setProfilingLevel(1, m) to record slow queries. EXPLAIN analysis helps identify performance bottlenecks and...
Comparison of MongoDB's two main storage engines WiredTiger and InMemory, including configuration methods and verification steps. WiredTiger recommended for production en...
MongoDB 7 replica set containerization best practices: generate keyfile, explicitly enable --auth, use one-time container for rs.initiate and admin user creation.
MongoDB replica set single machine three instance deployment guide including configuration, initialization, adding/removing nodes, elections, read-write separation and ro...
MongoDB data modeling choice between embedded and reference, following three principles: embed for 1:few, use reference for unbounded growth, use $lookup+index for cross-...
MongoDB replica set concepts: oplog location and idempotency, heartbeat frequency and election timeout, member/voting limits (50/7). Note that master-slave replication wa...
MongoDB production environment security hardening guide including authentication, RBAC minimum privileges, internal network bindIp/firewall ACL, TLS/SSL encryption.
MongoDB sharded cluster detailed explanation: sharding consists of Shard, Config Server, Mongos. Shard key selection includes range sharding, hashed sharding...
MongoDB authentication and permission configuration from single instance to sharded cluster. Implementation order: create admin/root first → enable authorization → assign...
Step-by-step MongoDB sharded cluster setup (configsvr×3 + two shard replica sets×3 nodes + multiple mongos), including configuration, initialization, adding shards...
Euler path/circuit determination: undirected graphs check connectivity and odd-degree vertices, directed graphs check weak connectivity and in/out-degree balance.
This article provides an in-depth explanation of MySQL transaction isolation levels: Read Uncommitted, Read Committed, Repeatable Read, and Serializable...
MyBatis quick start tutorial covering MyBatis development steps including POM dependency configuration, Mapper mapping files, SqlMapConfig core configuration file...
Detailed introduction to MyBatis pagination plugin PageHelper and Generic Mapper usage, including configuration, code examples, PageInfo class usage, and Generic Mapper C...
MyBatis quick start continuation covering CRUD operations, XML mapping configuration, annotation-based development, and datasource/transaction management.
Neo4j graph database Docker installation and remote access configuration, 10-minute quick start guide.
2k, likes: 27, favorites: 13. Configuration comes from two sources: configuration files (main config.xml, mapper.xml) and Java code annotations.
In-depth explanation of MyBatis core components: SqlSessionFactory and SqlSession working principles, traditional DAO layer implementation, and MyBatis proxy development...
In-depth explanation of MyBatis dynamic SQL configuration including if conditions, where tags, foreach loops, and sql fragment extraction.
Neo4j CQL query language guide: CREATE creates nodes and relationships, MATCH queries graph data, with complete code examples for graph database operations and traversal...
Detailed introduction to MyBatis Mapper Proxy dynamic proxy implementation principles, including getMapper source code analysis and MapperMethod execution process.
Detailed explanation of one-to-one model mapping in MyBatis, including database table design, Java entity class definitions, Mapper interface and XML configuration.
In database design, one-to-many (One-to-Many) relationship is one of the most common relationship models.
Neo4j CQL advanced queries: WHERE clause filtering, DELETE removal, SET updates, ORDER BY sorting and pagination.
In database design, a "many-to-many" relationship means records in two tables can be associated with each other, with multiple records associated with multiple records.
Detailed introduction to MyBatis annotation development approach, including usage of common annotations (@Select, @Insert, @Update, @Delete, @Results, etc.
Neo4j CQL functions quick reference: string functions, aggregate functions, relationship functions and shortest path queries.
The relationship between user table and order table: one user has multiple orders, one order belongs to one user.
Neo4j transaction handling, index creation, constraint settings and concurrency issue troubleshooting.
Neo4j database backup and recovery, data warm-up and execution plan analysis.
Neo4j embedded database vs server mode comparison, Java API access examples.
Complete guide to integrating Spring Boot with Neo4j: Java Driver, Neo4jTemplate, Repository pattern with practical examples for graph database CRUD operations and relati...
Detailed introduction to design patterns used in MyBatis source code including builder pattern, factory method pattern, singleton pattern, proxy pattern...
Proxy Pattern: Provides a proxy for an object and controls access to the original object through the proxy. The English name of proxy pattern is Proxy.
FastDFS distributed file system architecture, evolution from standalone to distributed. This article analyzes principles and practices to help readers master key technica...
First article in the handwritten ORM framework series, introducing problems and disadvantages of traditional JDBC development and ORM framework design ideas and solutions.
In the current project, create under resources: sqlMapConfig.xml mapper.xml
Complete guide for FastDFS 6.15.0 source compilation and Nginx fastdfs-nginx-module configuration. This article analyzes principles and practices to help readers master k...
In-depth analysis of SqlSession and Executor working principles in handwritten ORM framework, detailing implementation mechanisms of SqlSessionFactoryBuilder...
Optimize handwritten ORM framework, focusing on getMapper method implementation in DefaultSqlSession, using JDK dynamic proxy to create Mapper interface proxy objects.
FastDFS core architecture deep dive: Tracker Server, Storage Server, Group mechanism. This article analyzes principles and practices to help readers master key technical...
Comprehensive introduction to Spring framework basics, evolution from EJB to Spring, detailed explanation of Spring's core concepts including IoC and AOP with practical i...
Step-by-step guide to implementing a simple Spring IoC container, Part 1 covering Servlet basics, characteristics, working principles, and writing your first Servlet prog...
Manually implement business logic layering without using Spring, including DAO layer, Service layer, and Controller layer, demonstrating dependency management issues in t...
FastDFS architecture design: lightweight Tracker, peer storage structure, file upload and sync principles. This article analyzes principles and practices to help readers...
Step-by-step guide to manually implement an IoC container using BeanFactory and XML configuration to manage Bean dependencies and complete core dependency injection imple...
Manually implement AOP aspect-oriented programming on top of business logic, using JDK dynamic proxies and CGLIB to implement transaction manager for automatic commit and...
"BeanFactory is the top-level interface of the Spring framework's IoC container.
Detailed explanation of Spring IoC configuration in pure XML mode including three ways to create Beans, lifecycle, scope, and XML configuration for constructor injection...
Explaining Spring's XML and annotation combined configuration mode, including the correspondence between annotations and XML tags, and usage of dependency injection annot...
Detailed introduction to Spring pure annotation configuration including usage of @Configuration, @ComponentScan, @Bean, @PropertySource annotations and Web environment co...
In-depth explanation of the differences between FactoryBean and BeanFactory in Spring, lazy loading mechanism of beans, and usage of BeanPostProcessor and BeanFactoryPost...
Detailed explanation of Spring IoC container architecture, complete Bean lifecycle, and execution timing of BeanPostProcessor and BeanFactoryPostProcessor.
In-depth analysis of Spring IoC container initialization flow through breakpoint debugging, detailed explanation of Bean creation timing and AbstractApplicationContext.
In-depth analysis of Spring IoC container system covering BeanFactory process analysis and Bean lazy loading mechanism with practical examples.
In-depth analysis of Spring IoC container system covering circular dependency, prototype beans, prototype scope, and lazy ObjectFactory with solutions.
In-depth introduction to Spring AOP aspect enhancement covering core concepts, related terminology, and proxy configuration with practical examples.
In-depth introduction to Spring AOP aspect enhancement covering core concepts, advice types, XML+annotation approaches with code examples
In-depth introduction to Spring declarative transaction support covering transaction control, concepts, four characteristics, and isolation levels with practical examples.
In-depth guide to Spring declarative transaction support covering transaction configuration with XML mode and XML+annotation mode with practical examples.
In-depth introduction to Nginx covering its origins, development history, common scenarios, and quick configuration guide with practical examples.
In-depth guide to Nginx configuration covering nginx.conf structure, Events block, HTTP block, reverse proxy, and load balancing with practical examples.
In-depth analysis of Nginx underlying process mechanism covering Master Worker mechanism principles and commonly used commands with practical examples.
In-depth analysis of Tomcat core architecture and processing flow covering Coyote IO model and protocol with comprehensive explanations.
In-depth analysis of Tomcat core architecture covering Catalina container full analysis, startup flow, and threading mechanism with comprehensive explanations.
In-depth analysis of Tomcat core architecture covering detailed configuration of main tags including Server, Service, Executor, Engine with practical examples.
Step-by-step guide to implementing a Mini Tomcat called MiniCat covering Bootstrap, Socket server, Request/Response handling with practical code examples.
Step-by-step guide to implementing MiniCat part 2 covering HttpServlet, Request, RequestProcessor components with detailed implementation code.
Step-by-step guide to implementing MiniCat part 3 covering startup testing, StaticResourceUtil, and Servlet implementation with complete code examples.
In-depth analysis of Tomcat class loading mechanism covering parent delegation model, lifecycle, and plugin architecture with detailed explanations.
In-depth guide to Tomcat covering SSL working principle, performance optimization, parameter configuration, and JVM optimization with practical examples.
In-depth guide to Tomcat performance optimization covering JVM memory model, garbage collection GC, and Tomcat configuration optimization with practical examples.
In-depth guide to distributed services covering basic concepts, cluster comparison, common patterns, communication methods, and detailed explanation of three states.
In-depth analysis of distributed services covering distributed consistency including strong consistency, weak consistency, monotonic read consistency, and eventual consis...
This article provides an in-depth analysis of the Three-Phase Commit protocol (3PC) and its differences from Two-Phase Commit (2PC) in distributed transaction processing.
This article provides an in-depth analysis of the Two-Phase Commit protocol (2PC) for distributed transactions, covering ACID properties and practical implementation.
This article provides an in-depth analysis of the Paxos distributed consensus algorithm, covering algorithm optimization and how to guarantee liveness properties.
This article provides an in-depth analysis of the CAP theorem in distributed systems, explaining Consistency, Availability, and Partition Tolerance trade-offs.
This article provides an in-depth analysis of the Paxos distributed consensus algorithm, explaining Proposal and Acceptor roles with detailed derivation process.
This article provides an in-depth analysis of RPC and RMI network communication in distributed systems, with practical Java code implementations.
This article provides a detailed analysis of BIO, NIO, and AIO network I/O models in distributed systems, with practical Java code examples.
This article provides an in-depth analysis of heartbeat detection mechanisms and high availability design principles in distributed systems.
This article provides a comprehensive explanation of the Raft distributed consensus algorithm, covering leader election, log replication, and safety mechanisms.
This article provides an in-depth analysis of RPC and RMI communication technologies in distributed systems, covering principles, architecture, and implementations.
This article provides a detailed guide to implementing a custom RPC framework using Netty, with complete code examples for provider and consumer.
This article provides a comprehensive introduction to Apache Dubbo RPC framework, covering core features, service governance, and getting started guide.
This article provides a practical guide to implementing Netty-based server and client applications with detailed Java code examples.
This article provides an in-depth analysis of Netty's EventLoop mechanism, thread model, and core components for building high-performance network applications.
This article provides an in-depth analysis of software architecture evolution from monolithic to distributed to microservices architectures, covering RPC fundamentals.
This article provides a comprehensive guide to Dubbo Admin visual management platform, covering installation methods, source code compilation, and Docker deployment.
This article provides a detailed guide to the Dubbo consumer module, covering configuration to proxy generation, with practical code examples.
This article provides a detailed explanation of the Dubbo producer module, covering key components, startup flow, and production environment best practices.
This article provides an in-depth analysis of Java SPI mechanism, explaining the evolution from JDK SPI to Dubbo's plugin-based extension system.
This article provides a guide to setting up Dubbo parent project configuration with detailed POM and code examples for multi-module Maven projects.
This article provides a comprehensive analysis of Dubbo's Adaptive and Filter interceptor mechanisms for dynamic extension and service chain enhancement.
Comprehensive analysis of Dubbo load balancing strategies, configuration methods, and custom implementation guide covering Random, RoundRobin, LeastActive...
This article provides an in-depth analysis of Dubbo dynamic service degradation, from avalanche prevention to second-level configuration center activation.
This article provides a comprehensive analysis of Dubbo load balancing strategies and asynchronous call implementation with practical examples.
This article provides an in-depth analysis of Dubbo's dynamic routing architecture, from rule design to production system integration.
MySQL development history, main branches, architecture evolution (standalone -> master-slave -> sharding -> cloud database).
MySQL four-layer architecture: network connection layer, service layer, storage engine layer, system file layer.
MySQL connection mechanism, half-duplex communication, query cache, query optimizer explained.
MySQL storage engine comparison: InnoDB, MyISAM, Memory, Archive - transactions, locking mechanisms, index structures.
InnoDB memory structure: Buffer Pool, Change Buffer, Adaptive Hash Index, Log Buffer
InnoDB disk structure: system tablespace, file-per-table tablespace, general tablespace, temporary tablespace, Doublewrite Buffer, Redo Log, Undo Log - complete storage a...
MySQL 5.7/8.0 storage engine optimization, InnoDB thread model: IO Thread, Purge Thread, Page Cleaner Thread, Master Thread
InnoDB storage structure: Tablespace, Segment, Extent, Page, Row. Row formats: REDUNDANT, COMPACT, DYNAMIC, COMPRESSED
Undo Log for rollback, Redo Log for redo, transaction atomicity, durability, MVCC.
Binlog three recording modes: STATEMENT, ROW, MIXED, file format, write mechanism, master-slave replication.
Index types: BTree, Hash, FULLTEXT, RTree, regular index, unique index, primary key index, composite index, clustered index.
Index principles: B+Tree, Hash index, binary search, InnoDB adaptive hash index.
Clustered index (secondary index, primary key index), secondary index, table lookup query, covering index.
EXPLAIN command: selecttype, type, possiblekeys, key, rows, key_len, Extra.
Table lookup queries, covering index, leftmost prefix principle, LIKE queries, NULL value handling.
filesort sorting, index sorting, two-pass sorting, single-pass sorting, clustered index and secondary index sorting.
Slow query log, mysqldumpslow, EXPLAIN analysis, common optimization solutions.
ACID properties: atomicity, consistency, isolation, durability, WAL mechanism.
Concurrent transaction problems: lost update, dirty read, non-repeatable read, phantom read, lock mechanism: shared lock, exclusive lock, MVCC.
Read-write separation principles, implementation methods, master-slave lag solutions, database middleware.
MHA high availability solution: Manager, Node, fault handling, failover.
Database sharding explained: vertical partitioning, horizontal partitioning, vertical sharding, vertical table splitting, horizontal table splitting.
Deploy tracker, storage, and Nginx on three hosts with round-robin upload. Key points: Nginx+mod_fastdfs routing and monitoring verification.
Scenario: High concurrency / massive small files (trunk) / single disk or RAID Conclusion: Upgrade to v5.04+, increase max_connections and align with nofile
Two ways for Java applications to integrate with FastDFS: official source compilation (happyfish100/fastdfs-client-java 1.37-SNAPSHOT) and Maven dependency (cn.
Enterprises and individuals migrating images/audio/video/static resources to Aliyun OSS need stable operations and cost control.
For multi-team and cross-account collaboration, OSS needs public access, least privilege, and auditability.
High concurrency read-heavy business, database can't handle it, need to improve throughput and stability.
Guava Cache uses 'lazy cleanup + LRU+FIFO' strategy. Passive deletion and active deletion need to be used together. Deep dive into expireAfterAccess, expireAfterWrite and...
Deep dive into LocalCache, Guava Cache's core implementation class, covering segmented lock design, five queue mechanism, eviction strategy and lazy cleanup principles.
Deep dive into concurrencyLevel, refreshAfterWrite and LoadingCache dynamic loading behavior, with horizontal comparison with custom LinkedHashMap LRU implementation.
Using Guava Cache for local caching in Java projects, troubleshooting and fixing production issues like OOM, abnormal hit rate, thread blocking and performance regression.
Guava Cache is widely used in production, but many lack source-level understanding of LocalCache/Segment/LoadingCache behavior.
Want to learn Netflix's EVCache system for self-development, but only know it's 'Memcached-based distributed cache'.
Java applications wanting to experience Netflix EVCache locally or in small teams, but server not open source, can only self-build based on Memcached.
Using EVCache in large-scale distributed cache needs understanding of underlying Memcached memory management and eviction behavior.
After distributed service splitting, inter-service communication evolved from synchronous calls to async decoupling, with retry, idempotency, and reliability patterns for...
Java service integrating with Memcached needs to understand Spymemcached's thread model, sharding routing and serialization details.
Implement a minimal runnable message model with queue buffering and async decoupling using Java concurrency.
Coexisting with traditional IBM MQ, need open source, operatable, scalable, consistency/reliability.
E-commerce seckill/ticket-grabbing scenarios with instantaneous traffic peaks, high read/write concurrency. Use pre-static + rate limiting queuing
Java systems doing async decoupling and event-driven need unified understanding of JMS message model, object model and message types.
JMS Topic broadcasts in application cluster, causing same business to be repeatedly consumed by multiple nodes.
Deep dive into RabbitMQ message persistence mechanism: queue index (.idx) + msg_store (.