浏览 7.6k
nginx与tomcat区别?之间有什么大的区别嘛?

按点赞数排序
按时间排序
1、从功能上来说:1)Tomcat是Serlet,或者叫Web容器,在其上做定制化应用开发很简单,因为它会分配1个线程给你,随便用阻塞API来处理请求;2)Nginx只适合静态资源和Proxy(Lua生态只适合开发简单的动态服务),并不适合做Web容器。
2、从性能上来说:1)Tomcat用Java开发,未使用全异步、非阻塞的事件驱动模式,并发能力极为有限,通常只能处理数百个并发请求;2)Nginx用C开发,为了CDN、负载均衡、缓存等目的存在,性能强悍,可以实现百万、千万级的并发能力。
5
回答于2020-09-09 10:11
第1种。参考官方文档:
“When buffering is enabled, nginx receives a response from the proxied server as soon as possible, saving it into the buffers set by the proxy_buffer_size and proxy_buffers directives. If the whole response does not fit into memory, a part of it can be saved to a temporary file on the disk. Writing to temporary files is controlled by the proxy_max_temp_file_size and proxy_temp_file_write_size directives.
When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.”
微信公众号
加入微信群