0

如果我用 php 编写彗星推送,但通过 quercus 在 java 服务器上使用此代码,这是否会解决 apache 所具有的每个请求一个进程的问题,并且可以很好地与许多使用我的聊天的用户一起扩展?

4

2 回答 2

2

的,Quercus 解决了每个请求一个进程的 Apache 瓶颈。但是,您需要了解 JVM 可能存在的瓶颈。不过,在我看来,您应该使用 libevent、Erlang、Google Go 之类的 C/C++ 编写服务或应用程序,或者仅仅为了可移植性而将其作为 Java servlet。

于 2010-02-02T06:34:55.390 回答
1

Well, Quercus runs on the (J)VM so it can run with other code that can start threads. But why do you need threads to do chat? You simply set the timeout on a vanilla PHP request to 0 (no timeout) and wait for there to be something to send back to the user.

That something else will be in response to someone else's request (ie A says "hello" which interrupts B's wait for something to happen). That doesn't require multithreading.

Also you could keep using Apache/PHP and do the above and instead connect to a Java (or other) service via something like XML RPC, which could wait forever. That server could do run multiple threads or do whatever it needs to.

于 2010-02-02T07:17:59.547 回答