PHP-Java Bridge vs RESTful WebService : With regar

2019-05-27 01:27发布

问题:

We have a drupal (PHP) CMS system, which quickly out grew its original requirements. A Java backend has since been built, which now does much of the functionality. These two comms using RESTful WS. Both systems run on the same server, so this is a local WS call. Even though this is a local call, it feels too clunky, and I feel that we shouldn't really be using web services for this integration.

I believe a php-java bridge would be better performing (http://php-java-bridge.sourceforge.net/pjb/) as they claim to be 50 times faster than a local RPC call via SOAP. I see that the php-java bridge uses XML streaming so I would have thought that the performance would be similar to XML-RPC.

I know the best way to answer this would be to write a POC, but this is not possible due to time constraints (tight deadlines). So my question is, has anyone benchmarked these or can anyone provide an insight about their experience relating to the two technologies. In particular, information relating to performance.

Thanks in advance.

回答1:

I have had a similar situation, but ultimately decided to implement with JSON and REST rather than the php-java bridge. The reduced complexity and greater re-use of services exposed as REST outweighed the need for better performance.



回答2:

Some thoughts

  1. Does your RESTFul WS expose resources in JSON format? JSon format is lighter and faster to process than XML
  2. Bare in mind that SOAP undergoes validation via a given XSD, maybe this framework is not using XSD to perform validation (which might be risky)
  3. The solution above conforms to JSR 223 which is the Script Engine JSR - this is good - as if needed you will be able to replace it with other vendors
  4. I see that it uses a fast CGI HTTP server - from what I know this is a highly scalable with very good performance of CGI.

Sounds like this can be a good candidate - the protocol is optimized comparing with SOAP (I have experience with SOAP).

To conclude - if your RESTFul web service cannot expose SOAP - I would consider this approach, however you need to verify that drupal works with FastCGI.