TheProgrammer Posted April 21, 2008 Share Posted April 21, 2008 Hey everybody, I have a more tricky situation here and maybe you can throw some ideas. So, i have a site written in php that needs to communicate preaty intensive with a live server (on the same machine, written in Java), in order to get/set some resources, benefit from some real caching and persistence etc. I have several options for this, and I'm not sure what is best as performance. 1. Classic communication via sockets. This might be slow if i have a socket connect on every page. Maybe with a good setup i can benefit a performance boost from permanent connections. 2. RPC via SOAP or something else. I think this would be slower than sockets. 3. Shared memory communication (pipes?). At a first glance this looks to be the fastest alternative. I'm preaty new to shared memory communication in php, actually in general. I don't know what the connect overhead is but since it's not passing thought the whole tcp/ip protocol stack it should be way faster. The problems might be that the communication is not asynchronous or buffered which could cause big problems, and that the 2 communicator will have to stay on the same virtual machine. Plus, I'm not sure how i can send/receive more complex types of data, like arrays/maps. Maybe there are libraries to handle pipe communication more efficiently. Do you know any? 4. the php-java bridge http://php-java-bridge.sourceforge.net/ looks very nice and interesting and they say that the communication is 50 times faster than with rpc. however, i don't see how i can use it. it only allows me to instantiate java classes in php not communicate with an already started application. maybe if i run php inside a java servlet it could work, but i'm not sure it's the right thing to do since the java server should only be a tool not the main process. What do you think it's the best choice, or do you know any other? I'm especially interested by performance, but i can't ignore scalability either. Quote Link to comment https://forums.phpfreaks.com/topic/102117-php-communicating-with-java-server/ Share on other sites More sharing options...
Jenk Posted April 21, 2008 Share Posted April 21, 2008 Use a RESTful protocol of your own design. Much quicker than the highly bloated SOAP protocol. Failing that, ditch the PHP code for Java, or vice versa. Quote Link to comment https://forums.phpfreaks.com/topic/102117-php-communicating-with-java-server/#findComment-522761 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.