xgrr.de – the whole not the half

things, thoughts and stuff out of life, daily business and computer science

Comparing Roadsend PHP to PHP/FastCGI

For some projects it might come in handy to have a pre-compiled binary shipped to the customer or run as a separate instance. I took a peek at Roadsend PHP which implemented their own engine and is able to compile PHP source into C binaries which can either run on the command line or with special compilation arguments as a FastCGI program.

But before using it productively and changing a lot of source to make it compatible with the way how Roadsend works I wanted to make sure that the promised performance bonus would be really there. I created a very crude script which does nothing more than to iterate an integer to a certain maximum and measures the time to do this.

NOTE: I know that a proper performance test looks differently and I’m aware that Roadsend PHP can put his design into the works when we deal with a lot of includes. I’ll make another test with including random files to compare if this is impacting the results.

<?php
echo “Simple iteration test to compare performance between interpreted PHP and Roadsend PHP<hr />”;

$max = 1000;
if($_GET["max"] != “” && is_numeric($_GET["max"])) {
$max = $_GET["max"];
}

$start = microtime();

for($i = 0; $i < $max; $i++) {
echo $i.”<br />”;
}

$stop = microtime();
$elapsed = $stop – $start;
echo “<hr />Script took $elapsed seconds to execute”;
?>

To the environment. I didn’t set up a clean room environment. I used my server at home with 2G of memory Athlon64 X2 and a RAID5. Nothing special but I think it resembles real-world situations perfectly (unless you setup a new box for every PHP site you build).

Apache (worker – threaded) is used for serving the requests. FastCGIs are served via mod_fcgid. PHP is also run via mod_fcgid which improved the performance of PHP dramatically so far.

Let’s get to it:

max = 1000
Roadsend PHP: 0.005817
Interpreded PHP: 0.001201

max = 10000
Roadsend PHP: 0.06846
Interpreded PHP: 0.012625

These results are not dramatically but significant. It seems that compiling PHP adds overhead to the execution.

Funambol sync problems solved

When I was playing around with Funambol last week I was brutally stopped by an Exception thrown somewhere in the code of the Funambol DS Server.

java.lang.NullPointerException
at com.funambol.server.session.SyncSessionHandler.processInitSyncMapMessage(SyncSessionHandler.java:905)
at com.funambol.server.session.SyncSessionHandler.processMessage(SyncSessionHandler.java:521)
at com.funambol.server.engine.SyncAdapter.processInputMessage(SyncAdapter.java:533)
at com.funambol.server.engine.SyncAdapter.processXMLMessage(SyncAdapter.java:254)
at com.funambol.transport.http.server.LocalSyncHolder.processXMLMessage(LocalSyncHolder.java:97)
at com.funambol.transport.http.server.Sync4jServlet.doPost(Sync4jServlet.java:399)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.funambol.transport.http.server.LogContextFilter.doFilter(LogContextFilter.java:132)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.funambol.transport.http.server.SyncResponseTimeFilter.doFilter(SyncResponseTimeFilter.java:159)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Unknown Source)

I decided to make the effort and have a look at the code. That was actually what was taking me so long to fix the problem at hand. Today I got a fix on the actual problem. The offending code is in the handling of the session. When I configured my Funambol I supplied the URI of the service I want to create which is at this point in time not the real URI. What happens during the authentication handshake is that the session is bound to this specific URI. This means that if the client requests a specific URI the server overwrites this URI with the one set in Funambol.xml and the session is only valid for this URI.

During sync it is checked if the client is authenticated which is not the case or at least not for the URI specified in the Funambol.xml. In this case a clause in the code is reached which provokes the NullPointerException stated above.

If you have this problem, make sure that the URI in your Funambol.xml file is either empty (then the URI provided by the client is taken) or that your clients use the URI which is specified.

Thunderbird 3 Release Candidate 2

thunderbird

As an early adopter I am using Thunderbird 3 for quite a while now. The Betas have been really stable and other than a few minor glitches I had no problems.

I just saw that RC 2 is out there after RC 1 was released in the last week. Be careful with the release. My copy was crashing every time I tried to send an email. I couldn’t figure out the exact problem yet but not being able to send messages is quite inconvenient in my opinion.

Firefox is HOT

I came across this nice picture. Just another reason to love Firefox!

firefox-on-breast

Musical déjà vu

I really find it astonishing what impact music can have. Last winter during the time I was concocting my BSc thesis I was very intensely listening to Trouble Over Tokyo. As a matter of fact it was playing almost all the time, during jogging writing and in the car.

This summer I didn’t listen to it at all. Probably because I couldn’t stand it anymore due to too much listening during winter. Now it is winter again though and suddenly I have the urge to play it again.

And then when I finally find the time to tune in I have this strong sense of déjà vu. You almost can remember the emotional status and feelings you had before some place else and in a different time.

This is not always preferred… For instance I can’t listen to System of A Down – Toxicity anymore. During the time I listened to it very intensely I was splitting up with my then girlfriend. Still every time I hear the song I can remember the exact moment back then.

Entente Cordiale

This perfect example of Austrian-German relations found today in Bludenz, Austria.

IMG_0267

Beat the Horse – Pomplamoose VideoSong

Just found this passing by. Enjoy!

Virtualized Networks – Next Generation Networks [Update]

In professional areas virtualization of servers and workstations enables us to evaluate operating systems and software packages in an isolated environment and without great costs. But this is still the starting point of virtualization. As our current internet topology and software applications ask for integration – the Cloud is a good keyword here – we have to be not only able to virtualize physical PC hardware but also provide network environments which are abstracted from our current internet.

This would enable network engineers, system administrators and of course scientists to easily develop new network infrastructures, test distributed deployments or invent new protocols on top of the network stack. The impact of a commercial virtualization technology for networks would have a huge impact of the way we currently build networks.

With the development of NGN (Next Generation Networks) this idea is pushed by a few selected but until now it did not surface to the broad public.

Update: I made a bit of research on the topic. Nothing deep really but I still found some interesting material:

I also found a lot of sites talking about network virtualization in connection with classic computer virtualization. This is only a part of what is meant. Network virtualization should be an end to end implementation with virtual nodes on the end points itself in the form of a software or firmware on the NIC and also on the nodes in between. It has not necessarily be linked to virtualized servers although this would of course make a lot of sense.

Jack’s Score

Pfeeeuw. I can’t wait until 24 returns. Not long folks – we’re almost there! In the mean time enjoy:

eBooks – Be ready for the Hype with ebook-spot.de

Surely eBooks are discussed controversially in the media. On the one side you have the publishers and the authors who are afraid of losing their market. Then of course you have the papers which turnover is declining as time progresses. Nevertheless digital versions of books, papers and magazines are more and more demanded by the public. With new technology such as the Kindle by Amazon and other high-tech gadgets it is also becoming very easy to consume these digitals.

But then you want more. And there it stops. Where to get your new eBook fix? There are a lot of different sites out there. Most of them feature PDA documents optimized for hand helds. With the enforcing of the market you can easily miss good sources.

With friends of mine I started a portal which collects links to interesting offerings on the net. We already started to gather links to commercial and non-profit organizations. We’re just started a few days back and have almost 100 links together. Have a look for yourself on ebook-spot.de!