Library

High Performance Web Services in C++

Archived Content
This article is provided for historical perspective only, and may not reflect current conditions. Please refer to relevant product page for more up-to-date product information and resources.
  • By Nandika Jayawardana
  • 14 Feb, 2010

A web services stack written in C/C++ can provide much better performance in comparison to stacks implemented in other languages due to native code. Therefore when high performance is required in web services interactions, often a C/C++ web services stack offers a much better solution. In order to quantify the performance advantage offered by WSF/C++ (WSO2 Web Service Framework for C++). we carried out a simple performance test. The article explains the procedure followed for the performance comparison and the results.

Contents

  1. Performance Testing Scenario
  2. Performance Testing Environment
  3. Message sizes and Tools used for the Performance test
  4. Performance Test results for plain text messages
  5. Performance Test results for signed and encrypted messages
  6. Summary
  7. References

Performance testing scenario.

The main objective of this performance test was to measure the performance of each of the web services stacks selected for the performance comparison under a varying load. We used a simple WSDL and implemented the web service in all four web services stacks.

The performance test service was an echo service which implemented an echo operation. The message sizes was varied in order to measure how the performance vary according to the size of the message. The message sizes used were 150 bytes , 1k, 10k and 100k. The xml processing overhead increase with the message size was not dependent on the xml structure since the same xml structure was used with only the echo element's child xml text changing. 

Performance Testing Environment

The performance testing environment was 2.40 G Hz dual core machine with 8GB memory. The operating system was Ubuntu 9.10 and the same runtime conditions were maintained for all web service stacks used in the performance comparison.The compared web services stacks were as follows.

  1. WSO2 Web Services Framework for C++(WSF/C++)[ version 2.1.0]
  2. WSO2 Web Services Application Server (WSAS)[version 3.1.1]
  3. gSOAP(An open source C/C++ based Web Services stack ) [version 2.7.15]
  4. A proprietary C++ Web Services stack

Deployment conditions for each of the Web Services Stacks were as follows. 

  1. WSF/C++ :- WSF/C++ was deployed as an Apache2 module and the log level was set to error in order to minimize the logging overhead
  2. WSAS :- WSO2 Web Services Server was run using the built in standalone server
  3. gSOAP :- gSOAP services were deployed as CGI web services which contributed to some performance reduction for gSOAP
  4. A Proprietary Web Services Stack :- The proprietary web services stack was deployed using its standalone server

Message sizes and Tools used for the Performance test

As the performance measuring tool, we used the Apache benchmark tool (ab)) that comes with Apache web server. The requests were sent to the server with the concurrency level set to 25. The message sizes were 150 bytes, 1k, 10k and 100k. The WSDL used to generate the services is available as an attachment to the article.

Performance Test results for plain text messages

The performance test results obtained for different plain message sizes are shown in the following graph. 

 

The graph is constructed with the message size against the number of messages handled per second. As can observed from the graph, all servers handle small messages fairly well and as the message size increases, the number of messages handled decreases, which is expected since the increased memory requirement would have an impact on performance as well as the increased processing required. gSOAP case is bit skewed since, we could only try it in CGI mode which is less performing. Therefore we would have to configure it with a better setting to accurately indicate the comparative performance. In all cases, WSF/C++ has shown a substantial performance lead over the other considered stacks for this particular scenario. 

Performance Test results for signed and encrypted messages

Next we carried out another test to measure the comparative performance with security enabled. In this case, we ran the scenario with WSAS server and WSF/C++. Again the same messages sizes were used and a mutual certificate sign and encryption scenario was used as the test case. The results are plotted in the graph shown below. 

As can be observed from the graph, there is a substantial performance gain in the C/C++ based WSF/C++ in comparison to java based WSAS. This is due to efficient processing capability in WSF/C++ stack.Therefore it is specially advantages to leverage this WS-Security handling capability of WSF/C++ if the requirement is to handle secured information efficiently.

summary

In this article, a comparative performance measuring work is described. As shown from the graphs, WSF/C++ indicated a substantial lead in terms of the number of requests handled per second in comparison to the other web services stacks considered. For the plan messages, WSF/C++ offers 2-3 times better performance. We expect to conduct much enhanced and elaborate performance measuring work in the near future. The results will be published as we progress.

References

  1. WSO2 Web Services Framework for C++
  2. WSO2 Web Services Framework for C++ Documentation
  3. Apache Benchmarking tool

Author

Nandika Jayawardana

Team Lead, WSO2 Inc.

About Author

  • Nandika Jayawardana
  • Software Developer
  • WSO2