AMFPHP vs. WeborbPHP

On March 14, 2008, Flash / Flex,php - 8 Comments

The other day, we were discussing remoting frameworks and the options you have on a php server. At my work, we use AMFPHP, and never really looked for other solutions. For .NET applications we use WebOrb, so I was wondering how the php version of WebOrb would perform. The results are quite shocking.

This information is outdated, please see WebOrb closes the gap! for updated test results.

First some information:

AMF WebOrb
download here here (registration needed)
license free (?) Mozilla Public License
version 1.9 beta 2 2.0.2
size 700kb 3700kb
supported php versions php 4, php 5 php 5 (not tested on php 4)
remoting flavours amf0, amf3 amf0, afm3
service browser yes yes
code generator no yes, different frameworks

AMFPHP runs out of the box, you don’t have to change settings in order to get it to run, just move your php classes to the services folder and you’re good to go. For WebOrb, you need to change the remoting-config.xml and add your gateway variables. Also, if you want to use it in a production environment, you need to clean up that file.

A good thing of WebOrb is the code generator, if you use one of the supported frameworks.

Enough of this, show me the test!

I created a small flex sample app and a small php class to test both products. It turns out that, depending on the request size, AMF-PHP is a whopping 4 times faster! When the request becomes larger, the difference is even bigger. (The when you set the for loop in php to 10000, WebOrb will time out, while AMF-PHP happily returns the result.

The source of the flex app is available under the right mouse button, the source of the php looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
	class test {
		var $lorum;
 
		function test() {
			$this -> lorum = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut id nisl non mi consectetuer rutrum. Phasellus a libero. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent tempus commodo justo. Curabitur vestibulum, tortor eu eleifend feugiat, arcu libero auctor lorem, id varius massa nisl ac sem. Morbi aliquet, purus at ullamcorper porta, sapien purus rhoncus est, nec tincidunt nulla massa non lectus. Phasellus ut elit et augue pellentesque tincidunt. Sed eu purus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla velit nibh, sagittis sed, iaculis vitae, pellentesque et, neque. Praesent vulputate imperdiet orci.";
		}
 
		function testMethod() {
			return date("m/d/Y H:i:s");
		}
 
		function testLargeMethod() {
			$res = array();
			for($i = 0; $i < 5000; $i++) {
				$res[] = $this -> lorum;
			}
			return $res;
		}
	}
 
?>

Pretty straight forward, just place it under [amfdir]/services/ and [webOrbdir]/Services/
You can run the test yourself and download the source code here.

So, concluding, it turns out that when you want remoting on a PHP based server, AMF-PHP is the way to go. It’s lightweight, fast and free. The only downside could be that the team developing it has been quiet for a while. WebOrb has the better (more professional) console, but that’s it. It’s just dead slow! I hope that the .NET, java and ruby versions of WebOrb are faster, because this performance is not acceptable.

If there’s anyone with suggestions to speed up WebOrb, please let me know!



What others have to say:

1

AMFPHP was handed over to a new developer who is doing some house cleaning. Even if future development ceased completely I wouldn’t be worried because the AMF spec is fully implemented and it does what I need it to do efficiently. You can speed up AMFPHP even further with a c extension . I think framework support and stuff is something that could be contributed by developers like us (I’m not pointing fingers cause I do feel that I don’t contribute enough to a product that I have used for so long). One I have been working on is integration into zend framework. (I also did integration with Code Igniter)

2

Thanks for your reply. Framework support at the backend is indeed also an important feature, but not what I meant with the code generator. The code generator in WebOrb can generated AS code for frameworks like Cairngorm.

But you are right when you say that support of frameworks and content management systems is something the community should do, not the developers of AMFPHP and WebOrb.

3

Thanks for these tests. ;)
Now, performance is important, but what about security? AMFPHP’s lack of a decent authentication system is a major issue. WebORB’s system, while far from being perfect, is decent.
Besides, WeborbPHP remoting-config file configuration is not something you always have to do. I use a “GenericDestination” from the flex side, and I’ve never had to edit any WebORBPHP file to make it work. Just like AMFPHP, I publish the folder to my server, and it just works.
Finally, WebORBPHP’s manager is, IMHO, far better than AMFPHP’s ServiceBrowser.
I understand that the community would really love AMFPHP to be the best PHP gateway out there, since it’s a completely free/opensource initiative, while midnightcoders is a company. Unfortunately, I’m really not sure about it (notwithstanding performance issues).

4

Nice test. Always good to know. Not only is it fast but also a lot smaller :)

grtz Arno

5

Ok, I didn’t know you could use a generic destination, good to know. I haven’t really digged in the authentication of WebOrb, but I agree that the system AMFPHP uses is not very usable.
I will make a test for authentication next week, so just wait and find out.
I also agree that the WebOrb management system has more features than the AMFPHP Service Browser, the question is: do you need them?
I don’t like the flexed Service Browser of AMFPHP, I liked the HTML version better (because it would just parse your classes and tell you where the errors in your code are, unlike the flex version, which just gives a flex error).
And don’t get me wrong, I did this test to see which product would be better to use for my company (which also uses the .NET version of WebOrb and is quite happy about it). So, money and licensing is not really an issue. So it’s not that I WANT AMFPHP to be the better gateway, it IS the better gateway (imho).

Furthermore, I got an e-mail from the midnightcoders, stating that I should give them heads up, before publishing a test like this. I cannot think of any reason why I should do that, and even if I did, I also should send AMFPHP a message. Come on guys, you’re a professional company and you’re beaten by some open source initiative (at least at the performance part). Instead of whining, start doing something one those performance issues.

6

I totally agree with you on this. I see no reason why one shouldn’t be able to run such tests. If they do not agree with the results or the methodology, then I’d like them to tell us why. To me, this kind of attitude is actually more concerning than the actual performance issues.

7

Make sure you run these tests again and update this post in about three weeks. All take the time to type pecl install amfext and watch AMFPHP smoke your .net gateway. AMFPHP is live and strong be there is some massive house cleaning going on.

8

On April 30, 2008, Midnight coders released version 3.0.0 for PHP.

I just ran your test code, with the new version and AMF still beats Weborb for the Invoke & Invoke 100 times. For invoke large dataset, AMF completed in 750ms & Weborb in 780ms.

Not too bad for large datasets.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Submit comment