Connection between 2 servers [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this questionMy project is planned to have 2 servers running -
1. The first is used as an interface and will serve users. software is built with php 2. The second supposes to do some c开发者_开发知识库omputational work and will NOT be connected directly to users.software is built with Java. the 1st server sends constantly information to the 2nd server. Which will be the preferred way to communicate between them? I was thinking XML files, but I'd like to know if there is some toolkit or some COTS for this kind of interaction. p.s. I had no idea how to tag this question, so if someone has a better idea - feel free to retag it.Anything will work here, whatever floats your boat. Depends a little on the size of the payload, XML has a marshalling cost associated with it, but it's not much more than any other plain text format. It's certainly likely easier to do with PHP than something more native.
You could also consider JSON, it's a little less verbose than XML and suitable if you're simply interested in moving data back and forth versus the other features of XML.
Heck, CSV will work fine as well.
The easiest way to pull this off would be to host a simple Java Web App and simply tunnel the data over HTTP to your process. If the process isn't designed to be synchronous (i.e the PHP system should wait for processing), then you can simply store the data in a "work_to_be_done" table in a DB, or use one of the many queueing systems (JMS and its ilk).
Nothing really magic here. Just do it. If you're moving millions and millions of messages, then it's different, and a different discussion. If not, fire away and have at it.
精彩评论