The development of webservice applications can not be separated from the support of the framework, when the Open-open site listed there are many kinds of, this for developers how to choose to bring certain doubts. The key elements of performance WebService, there are great differences in the performance of different frameworks, but currently in the official web site, network data can easily find the introduction of their respective frameworks, but there are few test data for different framework performance. This article has chosen several popular frameworks:
Apache Axis1, Apache Axis2, Codehaus XFire, Apache CXF, Apache Wink, Jboss resteasy, Sun Jax-ws (most simple, convenient), Alibaba Dubbo (except), Using Java as a test case, through the local and remote testing methods, the performance of these frameworks are tested, and the test results analysis and performance comparisons, and finally the performance of the framework is recommended.
At present, three kinds of mainstream Web service implementation methods:
REST (new): Representational state transitions (software architecture style) Resteasy, Wink, CXF, Axis2 ...
SOAP (more Mature): Simple Object Access Protocol Xfire, Axis2, CXF, Axis1
XML-RPC (OBSOLETE): Remote Procedure Call protocol (slowly replaced by soap)
Rest is easy to use, efficient, looks like the future has a lot of room for development, but also claims that rest performance is more convenient than soap, there are many frameworks that claim support for rest such as spring 3.0, struts ... (Baidu View)
High level of SOAP maturity and better security
Keywords: Axis1, Axis2, XFire, CXF, Spring, SOAP, StAX, WSDL 2 Framework Introduction 2.1 Apache AXIS1
Axis is essentially a soap engine (Apache Axis is a implementation of the soap), which provides the basic framework for creating server-side, client, and gateway SOAP operations. But axis is not exactly a soap engine, it also includes:
L is a separate SOAP server.
L is a server that embeds a servlet engine (for example, Tomcat).
L Support WSDL.
L provides tools for translating WSDL into Java classes.
L Provide example programs.
L provides TCP/IP packet monitoring tools. 2.2 Apache Axis2
The Apache Axis2 is more efficient, more modular, and more XML-oriented than the Apache AXIS1, enabling easy plug-in modules to extend new features and features, such as security and reliability. The Apache Axis2 is based on the Apache AXIOM, which is a high-performance, pull-based XML object model. Key features of Apache Axis2:
L Parse XML faster. Adopt your own object model and Stax (streaming API for XML).
L Lower memory footprint.
L Support Hot deployment. New services are added to the system without restarting the service.
L Support Asynchronous WebService,
L MEP support, flexible support for message Exchange Patterns (MEPs) defined in WSDL 2.0
L more flexible. The engine provides developers with sufficient freedom to extend customer header information processing, System management,
L more stable.
• The transport framework does not depend on specific protocols. For integration and Transfer Protocol (SMTP, FTP, message-oriented middleware, etc) there is a simple and abstract, the engine core is completely independent of the specific transport protocol.
L Support WSDL. Support WSDL1.1, WSDL2.0.
• Facilitate integration of other components (add-ons). Several Web services have been integrated, including: wss4j for Security (Apache Rampart), Sandesha for reliable messaging, kandula which are an Encapsula tion of ws-coordination, ws-atomictransaction and ws-businessactivity.
L Good Extensibility. 2.3 Codehaus XFire
The Xfire core is a lightweight, Stax message processing model used to interact with SOAP messages, which supports different types of binding mechanisms, containers, and transport protocols.
Supports WebService standards-SOAP, WSDL, WS-I Basic profile, ws-addressing, ws-security, etc.
L High Performance Soap STACK
• Pluggable bindings POJOs, XMLBeans, JAXB 1.1, JAXB 2.0, and Castor support
• Use the JSR 181 API to configure services through Java1.5 and 1.4 (Commons attributes JSR Syntax 181)
L Support Multi-medium transport protocol-HTTP, JMS, XMPP, IN-JVM, etc.
• Embeddable and Intuitive APIs
L support Spring, Pico, Plexus, and loom
L Support JBI
L Client and server stub code generation
L Support Jax-ws Early access 2.4 Apache CXF
The Apache cxf is an open source service framework. Apache CXF = Celtix + Xfire,apache CXF formerly known as Apache Celtixfire, has now officially changed its name to Apache CXF, hereinafter referred to as CXF. CXF inherits the essence of both Celtix and Xfire's open source projects, such as Jax-ws and Jax-rs, with key features including:
L Support Web services standards. Includes: SOAP, the WSI Basic profile, WSDL, ws-addressing, Ws-policy, ws-reliablemessaging, Ws-security, Ws-secureconversation and Ws-securitypolicy.
L support different types of front-end development models. CXF implements the Jax-ws APIs and supports JAX-RS development.
L easy to use. CXF design is simple and intuitive, with concise APIs quickly build a code-based service, the MAVEN plug-in makes tool integration easier, JAX-WS API support, Spring 2.x XML makes configuration easier.
L support binary and legacy protocols. CXF is designed as a pluggable architecture that supports not only XML but also non-XML type bindings, for example, JSON and CORBA, in combination with different transport protocols. 2.5 Resteasy (Baidu view is better)
Resteasy is an open source project for JBoss that provides a variety of frameworks to help you build restful WEB services and restful Java applications. It is a complete implementation of the JAX-RS specification and is certified through JCP. As an JBoss project, it certainly integrates well with the JBoss application server. However, it can also run in any servlet container running JDK5 or above. Resteasy also provides a resteasy Jax-rs client invocation framework. Can be easily integrated with EJB, Seam, Guice, Spring, and spring MVC. Enables automatic gzip decompression on the client and server side. (less information can be compared)
There are more professional people on the CXF, Restlet, Resteasy, Jersey framework Test "data", he said from the performance of the Resteasy is the best, Jersey second (but the jersey can be consulted in English documents are relatively few people do not recommend use), CXF and Restlet were the worst,
2.6 Dubbo (Personal opinion----no reason)
Dubbo is an open source and High-performance service framework for Alibaba, enabling applications to seamlessly integrate with the spring framework through High-performance RPC implementations of the output and input capabilities of the service. 2.7 Java6jax-ws jax-ws2.0 (JSR 224) is the Sun's new Web services protocol stack Java with three WebService specifications, Jax-ws (JAX-RPC), Jax-rs, Jaxm&saaj. Jax-ws (Java API for Xml-webservice), JDK1.6 is a version of jax-ws2.1, with the underlying support for JAXB. The Early Java Web Service specification JAX-RPC (Java API forxml-remote Procedure call) is now replaced by the JAX-WS specification, JAX-WS is a JAX-RPC version of evolution, but JAX-WS JAX-RPC is not fully backward compatible. ()
2.8 Apache Wink
REST (representational state Transfer) based Web service "http://baike.soso.com/v812054.htm" is relative to the traditional Web service (soap+ WSDL+UDDI) and proposed. Traditional Web service can solve the communication problem between heterogeneous systems well, but it needs to define the contract (WSDL) in XML format first, client and server must obey the protocol strictly, not easy to upgrade and cluster scaling. REST Web Service does not need to define the format in advance, the contents of the transmission can also be based on different client changes (json,xml,html, etc.), the most important thing is to use the source URL to uniquely locate the resource, the deletion of resources to check the four methods mapped to HTTP, no state transmission, Has a very good scalability.
The Apache wink is a pure Java rest framework. It fully implements JSR 311 and extends part of the functionality, and provides good scalability, and is also a valuable seamless integration with the popular Java framework spring. The project is still under development. The so-called framework is nothing more than a well-defined format, providing tools and hooks that allow developers to focus on the development of business logic.
3 Test Preparation
Table 1 Test basic elements
Test conditions
Describe
Host Environment
A test machine: Cpu:1.60ghz Memory: 1.37G
B Test machine: Cpu:1.83ghz Memory: 1G
Web Services
Framework
AXIS1 1.3
AXIS2 1.2
Xfire 1.2.6
Application environment
JDK 1.4, Spring 2.x
Client code
public void Testgetversion () throws Java.lang.Exception {
String url = "Http://localhost:8081/boss/services/Calculate";
Initial time of Client
Long starttime = System.currenttimemillis ();
The client stub code is the AXIS1/AXIS2/XFIRE/CXF framework Wsdl2java generation, respectively.
Calculatecalculatehttpportstub stub = new calculatecalculatehttpportstub (URL);
Long endtime = System.currenttimemillis ();
SYSTEM.OUT.PRINTLN ("Client init time is:" + (Endtime-starttime));
Call 10 consecutive times
for (int i = 0; i < i++) {
Long startTime1 = System.currenttimemillis ();
String ret = Stub.getversion (). Get_return ();
Long endTime1 = System.currenttimemillis ();
System.out.println ("[+ i +"] elapsed time is: "+ (ENDTIME1-STARTTIME1) +" MS ");
System.out.println ("Stub.getversion () is:" + ret);
}
}
Service-side code
Public String getversion ()
Note: The interface has no business logic and returns only one string: "Hello";
Test method
The native interface test, the client and the server are all on the a test machine;
Remote interface testing, a test machine as a client, B test machine as a server. This test is done in the LAN.
Result Precision
Number accurate to two decimal places
noun explanation
Server side: A program deployed to the server.
Client: Initiates a request to invoke a webservcie on the server.
Client initial time: The time required to initialize a client Java object when an interface call is initiated.
For example: calculatecalculatehttpportstub stub = new calculatecalculatehttpportstub (URL); Generating a client stub from the framework Wsdl2java
Table 2 on End-to-end performance, a client-side driver uses a FAT client Web service stack to send and receive SOAP requests
WebService Service Side
WebService Client
Webservice Stack
SOAP over HTTP 4 performance Test 4.1 test method
This assumption is tested under the same network and host environment, so the performance difference is mainly determined by the implementation mechanism of different frameworks.
L test in two ways: native test, remote test.
L Server side uses: Axis1, Axis2, Xfire, CXF, for the selected server side, with different frameworks corresponding to the toolkit WSDL generation client stub code for testing.
L There is no complex business logic inside the server interface, and when the client invokes, it simply returns a string.
L each time, use Java loop to call 10 times server interface, and record the time from initiation to return result. 4.2 Test Results
Limited to space, this article only provides: the detailed test results with the CXF framework as the server, and the comprehensive test results of each framework.
Table 3 takes CXF as the service-side test detail results
Native test results (unit: MS)
Server-side
Cxf
Client
Cxf
Axis1
Client initialization
1th Group
2nd Group
3rd Group
4th Group
5th Group
1th Group
2nd Group
3rd Group
4th Group
5th Group
2547
2594
2563
2578
2563
2569
422
422
407
50W
421
415.6
Call interface Test 10 consecutive times
1th Group
2nd Group
3rd Group
4th Group
5th Group
1th Group
2nd Group
3rd Group
4th Group
5th Group
1
297
281
281
282
266
281.4
234
219
219
234
219
225
2
0
0
0
15
15
0
16
0
0
16
3
0
16
16
0
0
16
15
16
16
0
4
0
0
0
0
0
0
0
0
0
15
5
16
0
0
0
0
15
16
15
0
0
6
0
15
15
0
16
0
0
0
16
0
7
0
0
0
0
0
16
16
16
0
16
8
15
0
0
0
0
0
0
0
15
0
9
0
0
0
0
15
16
15
16
0
16
10
0
16
16
15
0
0
0
0
16
0
10 times average
32.8
32.8
32.8
31.2
31.2
32.16
29.7
29.7
28.2
29.7
28.2
29.61
After 9 times average
3.444
5.222
5.222
3.333
5.111
4.467
7
8.667
7
7
7
7.333
Remote test Results (unit: MS)
Server-side
Cxf
Client
Cxf
Axis1
Client initialization
1th Group
2nd Group
3rd Group
4th Group
5th Group
1th Group
2nd Group
3rd Group
4th Group
5th Group
2703
2547
2578
2563
2531
2584
50W
50W
422
407
422
412.6
Call interface Test 10 consecutive times
1th Group
2nd Group
3rd Group
4th Group
5th Group
1th Group
2nd Group
3rd Group
4th Group
5th Group
1
344
281
281
281
297
296.8
219
234
235
234
687
321.8
2
0
0
16
16
16
16
0
15
16
16
3
0
16
0
0
0
62
16
0
0
0
4
16
0
16
15
0
47
16
16
15
16
5
0
15
0
0
15
16
15
15
16
0
6
0
0
15
16
0
31
0
0
0
15
7
0
16
0
0
16
16
16
16
15
0
8
15
0
0
0
0
31
0
16
16
16
9
0
16
16
15
0
31
15
0
0
0
10
0
0
0
0
15
31
16
15
16
15
10 times average
37.5
34.4
34.4
34.3
35.9
35.3
50
32.8
32.8
32.8
76.5
43.37
After 9 times average
3.444
7
7
6.889
6.889
6.244
31.22
10.44
10.33
10.44
8.667
14.22
Table 4 native and remote test results for different frames
Native test results (unit: MS)
Server-side
Axis2
Axis1
Xfire
Cxf
Client
Axis2
Axis1
Axis1
Axis2
Xfire+spring
Axis1