是否为每个服务器实例化一个新的JVM负载很大? [英] Is instantiating a new JVM for every server request a large load?

查看:135
本文介绍了是否为每个服务器实例化一个新的JVM负载很大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Apache PHP用于我的Web应用程序.我想在PHP中使用exec函数并调用一个Java类(我不会使用Java到php的桥),但是现在这不仅需要在apache中分配请求线程,而且还需要启动一个新的JVM.与Java执行.如果我们有大量的用户,这是否会对服务器资源造成极大的负担?

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?

我不使用Java到php进行桥接的唯一原因是,它似乎有点难以启动且耗时.

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.

推荐答案

您只需一个Java进程即可完成此工作. 编写一个Java Socket服务器.然后,您可以编写带有PHP套接字的PHP客户端,以将命令发送到Java Server,以完成工作.

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.

这篇关于是否为每个服务器实例化一个新的JVM负载很大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆