Reputation: 21
I am building a website which will have a rigorous database access. It should also have a good exception handling mechanism and be fast. To avoid DB access, I want to load some of the values in RAM using Java.
Now my problem is:
So, Should I use JSP? But JSP is not available on all servers, so thats a dilemma for me.
Is PHP -> Java bridge a good solution? Is it scalable and has good performance as compared to JSP->Java combination
Upvotes: 2
Views: 546
Reputation: 13348
This is actually a common situation. While not necessarily in Java, it is common practice to have compiled back-ends to a pseudo-interpreted (I know PHP isn't an interpreted language) front end. Then, you get the benefits of speed and thread-persistence in a language such as Java with the iterative capabilities (read: no compilation necessary) of a PHP front end.
My advice would be for you to check out the Apache Thrift project. This will generate common interfaces between a Java server and PHP client which allow you to execute service calls from your PHP environment and pass them off to Java.
Basically, in PHP, you establish a TCP connection to your Java server. Java does the database call, loads the data, whatever else it needs to do, and returns the object back to you in PHP. Thrift will help you create consistent objects and interfaces and keep them in sync between the two environments.
Upvotes: 1