Is instantiating a new JVM for every server request a large load?

风格不统一 提交于 2019-12-21 21:33:57

问题


I'm using Apache PHP for my web application. I'd like to use the exec function in PHP and call a java class (Im not going to be using a java to php bridge), however this now requires not only distributing the request thread in apache but also starting a new JVM with the java execution. Is this going to be extremely large of a load on server resources if we have a significant amount of users?

The only reason I'm not doing a java to php bridge is because it seems a bit difficult and time consuming to get up and running.


回答1:


You need only one java process to make this work. Write a Java Socket server. Then you can write a PHP Client with PHP Sockets to send commands to your Java Server which do the work.




回答2:


Yes, starting a new process (Java or otherwise) for each request is going to perform very poorly.




回答3:


Google App Server does this and it can handle in the order of 2 to 10 requests per second per server. If you use a Java server which is running all the time you should expect around 100-1000 requests per second. If you use a persisted connection, and efficient messages, you can handle over 100K message per second.

In short, it could work but I would have trouble accepting such a inefficient solution. ;)



来源:https://stackoverflow.com/questions/17507375/is-instantiating-a-new-jvm-for-every-server-request-a-large-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!