Professional Documents
Culture Documents
discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/221587695
CITATIONS
READS
13
1,230
5 authors, including:
Toyotaro Suzumura
Michiaki Tatsubori
IBM
IBM
SEE PROFILE
SEE PROFILE
Akihiko Tozawa
Tamiya Onodera
IBM
IBM
SEE PROFILE
SEE PROFILE
Abstract
PHP is well known as a programming language in the
Web 2.0 era enabling agile server-side software
development. It has officially supported SOAP messaging
since version 5 through a C-based built-in library. In this
paper we perform a thorough study of the capability of
PHP as a web service engine in both qualitative and
quantitative aspects while comparing it with other web
service engines implemented in Java and C. We used
Axis2 for this purpose as it is an open source web service
engine whose implementation is available both in Java
and C. We report that PHP as a web service engine
performs competitively with Axis2 Java for web services
involving small payloads, and greatly outperforms it for
larger payloads by 5-17 times. As the authors expected,
Axis2 C performs best, but the experimental results
demonstrate that PHP performance is closer to Axis2 C
with larger payloads. This performance difference comes
from the fact that the SOAP engine within the PHP
runtime is implemented in C with a monolithic
architecture, whereas Axis2 uses a more modular
architecture for the flexible insertation of handlers for an
assorted set of WS-* standards, and also that Axis2 uses a
different data binding mechanism known as ADB (Axis2
Data binding). This paper is the first attempt to compare
web services engines implemented in PHP, Java and C,
and the authors believe that this boosts the development
of SOAP-based Web services in PHP by letting people
know its decent performance score and high productivity
characteristics.
1. Introduction
Web service technology, especially that based on WS-*,
plays a key role for the realization of Service Oriented
Architecture. However, it is difficult to argue that web
services are as widely used as assumed when the
technology was first emerged. Potential reasons include
the performance problem of XML processing, too many
complicated WS-* standards, and so forth. Recent
technologies seen in the Web 2.0 era have arisen through
the community driven approach, where average
programmers are playing the key role as they use it. From
this viewpoint, one of the biggest reasons for the above
385
3. Qualitative Comparison
This section presents a comparative study between web
services support provided by PHP and Axis2 from variety
of perspectives including software architecture, the XML
processing model, WS-* standard support, the
programming model and deployment model for server
providers, the support for RESTful service, and other
functionalities.
386
that LIBXML2
implementations.
is
much
faster
than
all
other
REST Support
Asynchrony Support
The major contribution of JAX-WS 2.0 is to support
asynchronous web services. The SOAP extension
provided in the PHP implementation available in [11]
currently does not support this feature because the PHP
language itself does not support threading. Possible
alternative implementations would be similar to Java New
I/O (NIO) introduced in Java 1.4 or to extend PHP to
support threading.
4. Quantitative Comparison
This section describes a quantitative comparison among
3 SOAP engines: the SOAP engine in PHP5, Axis2 Java,
and Axis2 C. Especially for PHP, we also compare two
web servers, Lighttpd [9] and Apache 2.
3.4. Functionalities
WS-* Standard Support
As described in the previous section, Axis2 is designed
to have a flexible architecture to support an assortment of
WS-* standards. In constrast, the standard SOAP
extension provided by the current PHP distribution
supports subsets of SOAP 1.1, SOAP 1.2, and WSDL 1.1
specifications. However, the Web Services Framework
387
Apache 2.2
7418
Apache 2.0
6897
Lighttpd
12471
Tomcat
4364
2000
4000
6000
8000
10000
Throughput (# of requests per second)
12000
14000
Server
Configuration
Label
Axis2 Java
Axis2 C
PHP+Lighttpd
PHP+Apache
HTTP
Server
Connector
Tomcat
5.5.26
(Java)
Apache
2.2.8 (C)
Lighttpd
1.4.19 (C)
Apache
2.0.63
None
(thread)
mod_axis2
FastCGI
mod_php
SOAP
Engine
Web
Services
Axis2
Java 1.3
(Java)
Axis2 C
1.3.0 (C)
PHP5
5.2.5 (C)
PHP5
5.2.5 (C)
Java
500
1000
1500
2000
2500
3000
3500
4000
4500
PHP
PHP
388
2000
2196
1877
1613
)d 1500
no
ce
s 1000
1831
500
0
Axis2 Java
PHP+Lighttpd
PHP+Apache
Axis2 C
1.4
av
1.2 Ja
2s
ix
1
A
st
0.8 nia
ga
0.6 iot
aR
0.4 pu
de
0.2 ep
S
0
2500
re
p
st
esu
qe
r
fo
(#
tu
ph
gu
roh
T
7
2000
6
5
d)n 1500
coe
s
1000
3
2
500
1
0
0
1
Axis2 Java
Axis2 C
Axis2C/Java
5
6
# of structs
PHP+Lighttpd
PHP+Lighttpd/Java
PHP+Apache
PHP+Apache/Java
389
10
av
Ja
2s
ix
A
re
vo
iot
ar
pu
de
ep
S
1400
re
p
st
se
uq
er
fo
#(
tu
ph
gu
or
hT
18
16
1200
av
Ja
2s
i
12 x
A
st
10 n
ia
ga
8
iot
ar
6
pu
de
ep
4
S
14
1000
)d 800
no
ce
s 600
400
200
0
10
20
30
40
50
60
70
80
# of structs contained in SOAP message
Axis2 Java
PHP+Lighttpd/Axis2 Java
PHP+Lighttpd
PHP+Apache/Axis2 Java
90
100
8
7
6 APO
S
5 PH
(P )
Axis2
PHP SOAP
PHP/Axis2
o 2
4 ita xisA
R
e
3 can
m
r
2 orfe
PHP+Apache
re
p
st
esu
qe
r
fo
(#
tu
ph
gu
or
hT
1400
)d 1200
no
ce
s 1000
erp
tss
eu 800
qe
fro
600
(#
tu
ph 400
gu
or
hT
200
5
6
7
# of list nodes
10
1600
18
1400
16
84.5824
av
Ja
2s
12 ix
A
r
10 e
vo
iot
8
aR
pu
6
de
ep
4
S
13.1556
2.262
14
1200
)d 1000
onc 800
se
600
400
200
0%
1 0%
20 %
30%
php
Figure 9
20
Axis2 Java
Axis2 C
C/Java
30
40
50
60
70
80
# of structs contained in SOAP message
PHP+Lighttpd
PHP+Lighttpd/Java
90
60 %
70%
80%
9 0%
10 0 %
others
0%
1%
00%
0%
% 0%
0
10
5 0%
lighttpd
40%
100
21%
php-cgi
libc-2.6.so
libxml2.so.2.6.29
e1000
libpthread-2.6.so
aic79xx
uhci_hcd
ld-2.6.so
ext3
PHP+Apache
PHP+Apache/Java
50%
28%
700
d)n 600
coe
s 500
re
p
st
se 400
uq
ref
o 300
(#
tu
ph 200
gu
or
h
T
100
0
6%
2% 2%1%
10%
4
5
6
7
# of threads (pow(2,x)
10
46%
12%
libphp5.so
libc-2.6.so
libxml2.so.2.6.22
httpd
libapr-0.so.0.9.5
libaprutil-0.so.0.9.5
e1000
ext3
21%
390
libc-2.6.so
3%
3%
2%
00%2%
%
0%
0%
0%
0%
1%
1%
2%1%
libxml2 .so.2.6.29
libaxis2_axiom.so.0
21%
libaxu til.so.0
PHP vs. C
The performance of the stock quote web service
experiment demonstrates that Axis2 C performs well in
comparison to other SOAP engines. Axis2 C is
implemented in C, but this performance score might be
expected but since Axis2 is designed to be highly modular.
It is not well known whether Axis2 C still outperforms the
PHP SOAP engine, which has been designed around with
a monolithic approach and is also written in C. However,
from the point of view of productivity, programmability,
ease of deployment, and debuggability, it is well behind
the other engines. Especially in terms of ease of
debugging, it is not straightforward to debug web services
written for Axis2 C, as the relationship between resulting
core dumps from segmentation faults and the original web
service definitions is not obvious.
h ttpd
libaxis2_e ngin e.so .0
5%
libapr-1.so.0.2.8
libaxis2_parse r.so.0
mo d_axis2.so
6%
e 1000
libaprutil-1 .so.0.2.8
libTestServic e.so
libpcre .so.0.0.1
7%
19%
libpthread-2.6.so
jbd
e xt3
mo d_lo g_config.so
11%
aic79 xx
mo d_lo gio.so
14%
3%
2%
0%
1%1%1%
2% 2%
27%
4%
5%
6%
7%
8%
22%
9%
Thread
GC
JIT
anon (1)
anon (2)
Java VM
anon (3)
anon (4)
Class Library
anon (5)
anon (6)
anon (7)
libj9ute23.so
libc-2.6.so
e1000
libpthread-2.6.
6. Related Work
5. Discussion
In this section, we will summarize the overall
comparison based on our qualitative and quantitative test
results described in the previous sections, and also our
experience when conducting these experiments.
.
PHP vs. Java
One of the main reasons the good performance seen with
the PHP web services stack comes from the use of the
fastest xml parser, libxml2, which is written in C.
Regarding interfacing with C modules, PHP's extension
API is designed for high efficiency (but not for robustness
or portability), while the Java Native Interface (J NI) is
designed for robustness and portability rather than for
efficiency. If we used libxml in the Java WS stack, it
would cause a significant overhead due to frequent
expensive call-ins from C to Java. Please also note that
the xml parser written in java is slower than in C because
of Java's inefficient handling of strings and of disallowing
(potentially type-unsafe) pointer arithmetic. However,
391
<?php
function getStock($symbol) {
$stock = new Stock();
$lastTrade = new LastTrade();
$lastTrade->price = 100.0;
$lastTrade->date = 1165997291;
$change = new Change();
$change->dollar = 98.00000;
$change->percent = 10.0000;
$stock->lastTrade = $lastTrade;
$stock->change = $change;
$stock->symbol = "IBM";
$stock->volume = 1000;
return $stock;
}
$server = new SoapServer("StockQuoteService.wsdl");
$server->addFunction("getStockQuote");
$server->handle();
?>
References
[1] Alex Ng, Shiping Chen, and Paul Greenfield, An
Evaluation of Contemporary Commercial SOAP
Implementations, AWSA (Australasian Workshop on
Software and System Architecture) 2004
[2] Emmanuel Cecchet, Anupam Chandra, et.al,
Performance Comparison of Middleware Architectures
for Generating Dynamic Web Content, Middleware 2003
[3] Subramanyam S., et al., Designing a web services
benchmark, In ICWS 03. International Conference on
Web Services, Las Vegas, USA.
[4] Toyotaro Suzumura, Satoshi Makino and Naohiko
Uramoto, Optimizing Differential XML Processing by
Leveraging Schema and Statistics, ICSOC 2006,
Springer, Lecture Notes in Computer Science, pp. 264p276
[5] Srinath Perasa, Chathura Herath, Jaliya Ekanayake, et.
Al. Axis2, Middleware for Next Generation Web
Services, ICWS 2006, URL: http://apache.axis.org/axis2/
[7] PHP Usage: http://www.php.net/usage.php
}
Table 3 Java code for Stock Quote web service
392