views:

78

answers:

2

Hello, i need to make multiple calls to different web services using PHP and i was wondering if the php-java combination would be more appropriate in dealing with this issue.

The multiple calls to the services if called sequentially will create a significant amount of delay, so i am looking for ways to overcome that.

I have read articles that 'simulate' concurrent processing in php and deal with this particular issue but i was wondering if the introduction of let's say a java socket server that accepts requests and creates worker threads would be more efficient (faster).

Any comments appreciated.

regards,

+1  A: 

Interestingly I've been thinking about this issue as well. You have a number of options:

  1. Use PHP calls to fork new processes;
  2. Use a worker framework like beanstalkd to create work requests and have something pick them up;
  3. Use something else like memcache to create work requests.

(2) is the interesting one (to me). You could run CLI PHP scripts to do the processing of beanstalk requests. Or you could use Java. Which depends on a large number of factors. I'd generally favour a single language environment over multi-language where possible and practical. But I can also envision instances where a Java backend would be a good idea.

cletus
A: 

That's exactly the reason why we switched from php to java - because of multithreading. We had an app that reads rss feeds through http. Switching from single threaded php app to several threads in java gave about 10x boost. I can't say anything about php threading simulation though.

serg