Design and Implementation of an Aspect‑Oriented Plugin Framework at 58 Real Estate
This article presents the design, architecture, and performance evaluation of a lightweight aspect‑oriented plugin framework developed by 58 Real Estate, detailing its motivation, module decomposition, integration with SCF and WF, benchmark results, practical usage scenarios, and guidelines for extending it with custom plugins.
The article introduces an aspect‑oriented plugin system created for 58 Real Estate, explaining that the term “aspect‑oriented” is familiar to Java developers and that the system combines this concept with a plugin architecture to provide non‑intrusive, reusable functionality across multiple services.
Key terminology is defined: SCF (Service Communication Framework), a high‑performance RPC framework, and WF (Web Framework), an internal Java MVC framework. The plugin system acts as a lightweight AOP framework that depends only on cglib and slf4j, supporting both synchronous and asynchronous modes and integrating seamlessly with SCF and WF.
The development background describes the need to address repetitive cross‑cutting concerns such as monitoring, alarm, disaster recovery, and service degradation across many micro‑services. Existing solutions were either too invasive or required heavy configuration, prompting the creation of a unified plugin mechanism.
The design is broken into several modules: a class‑loading module that scans and registers target classes, a plugin‑repository loader that discovers annotated plugins, framework‑specific adapters for SCF, WF, Dubbo, etc., a core proxy layer that performs method interception via reflection, an asynchronous thread‑pool for low‑impact execution, and a plugin repository that stores both built‑in and custom plugins.
A comparative table shows the advantages of the custom plugin system over Spring‑AOP and AspectJ, highlighting its minimal dependencies, ease of use, and integration with internal frameworks, while acknowledging that it lacks some advanced features of the larger AOP solutions.
Performance tests using JMH demonstrate that the plugin system adds negligible overhead for millisecond‑level method calls, and that asynchronous mode can even improve throughput when the before/after logic is significant.
Practical deployment scenarios include web front‑ends, micro‑service back‑ends, and any internal method calls where lightweight, non‑intrusive instrumentation is desired. The article also provides step‑by‑step guidance for creating custom plugins by defining annotations and implementing either the asynchronous base class or the synchronous interface.
Finally, the authors discuss future work, such as extending support to external frameworks like Spring and Dubbo, open‑sourcing the plugin repository for community contributions, and continuing to refine the system to focus development effort on core business logic.
58 Tech
Official tech channel of 58, a platform for tech innovation, sharing, and communication.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.