donglu5047 2013-07-18 21:44
浏览 22
已采纳

如何通过Java Web服务获得Nginx的优势

Along the last years i used Apache httpd server for my servers.

As i understand it - the biggest advantage in using Nginx is that Apache opens a different Thread for each HTTP request - which might load my server very quickly, while Nginx uses some other technique (Event driven) in order to take the maximum out of my server's memory and hardware.

So far so good.

I'm building a new web service which i expect to have lots of HTTP traffic so i've decided to use Nginx.

As a good Java programmer i like Java more than PHP but i have a concept problem using it in my case:

In all the post I've found that the way to use Java on it is to wrap the application with Nginx + Tomcat (or other JavaServer) + Java - so, if i understand correctly - i will not get the Nginx advantage since the Tomcat will open a new thread for each request in order to use the Java web service.

Questions:

  1. Did i understand it correctly?
  2. Does using Nginx with PHP does open a new process for each request but not a new thread ?
  • 写回答

2条回答 默认 最新

  • dongying6659 2013-07-19 00:57
    关注

    Yes you got it correctly, what you're doing here is putting an extra layer above the tomcat, so you'll not get the advantage, the only advantage that you'll get is serving assets ( images and static files ) without passing them to the apache, which might give a slight advantage.

    Why php is has this advantage: because when using nginx instead of running php as a module of apache (mod_php) we install a separate server php-fcgi or php-fpm, so it's independent of apache's method of spawning workers or threads or whatever.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab中使用gurobi时报错
  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂