tomcat

 
 
  • 1
  • 2

Motan is a service governance framework. 
The RPC framework can be divided into two categories at present, one is cross-language type represented by Thrift and gRPC, which is characterized by supporting cross-language RPC calls. It is a service governance type.

Compared with Dubbo, Motan supports the same functions while reducing some extension features. In terms of serialization, Motan only supports Heesian and fastJson, the registry Motan only supports zookeeper and Consul, and the underlying communication components can only use netty, while Dubbo also supports mina, grizzly, and corresponding protocols. Motan only supports local calls and protocols defined by motan. In contrast, dubbo also provides protocol support for components such as redis, thrift, and memcache, which can be used to complete services. publications and citations.

Both motan and dubbo use the SPI mechanism to ensure expansion. All configurations are spliced ​​into URLs, and an interface proxy is constructed to hide the details of remote calls. This is similar to JMS-based remote calls. You need to provide the calling interface, method parameters, parameter types, and server-side reflection interface implementation. The execution returns the result.

The mapping of interface and implementation class dubbo and motan are saved with a map. Find the implementation class reflection execution method through the requested interface name.

Motan's module design: The 
evaluation of the quality of a module design is whether different modules depend on each other before, that is, there should be no class inheriting from module B in module A. Even if the class must be extended, the packaging mode should be considered first, that is Is the decoration mode, making the extended class as an attribute of the extending class.

write picture description here

motan provides two configuration methods.

1.注解
2.xml
  • 1
  • 2

The class scanner is customized, which can scan the annotations defined by motan under the specified package, and hide the calling process by replacing the interface attribute with the constructed interface proxy in the beanpostprocessor stage.

xml configuration. 
Under spring, to create your own xsd file and parse it, you only need to prepare 3 things:

1.META-INF下自定义的xsd
2.META-INF下spring.schemas指明xsd地址,spring.handlers指定NameSpaceSupport实现类地址。
3.NameSpaceSupport实现类和你的BeanDefinitionParser实现类,处理完后会自动将Parse的bean类的实例注入到容器。
  • 1
  • 2
  • 3

The calling process of the motanc client: 
write picture description here

The calling process of the motan server: 
write picture description here

Performance comparison:

I tested it on an i5 laptop: 

write picture description here



https://blog.csdn.net/hel_wor/article/details/61742283



Guess you like

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