所以我的问题是:链中附加层有什么好处?
client -> Nginx -> unicorn -> unicorn worker
解决方法
Most benchmarks we’ve seen don’t tell you this,and unicorn doesn’t care about slow clients… but you should.
A “slow client” can be any client outside of your datacenter. Network traffic within a local network is always faster than traffic that crosses outside of it. The laws of physics do not allow otherwise.
Persistent connections were introduced in HTTP/1.1 reduce latency from connection establishment and TCP slow start. They also waste server resources when clients are idle.
Persistent connections mean one of the unicorn worker processes (depending on your application,it can be very memory hungry) would spend a significant amount of its time idle keeping the connection alive and not doing anything else. Being single-threaded and using blocking I/O,a worker cannot serve other clients while keeping a connection alive. Thus unicorn does not implement persistent connections.
If your application responses are larger than the socket buffer or if you’re handling large requests (uploads),worker processes will also be bottlenecked by the speed of the client connection. You should not allow unicorn to serve clients outside of your local network.
原文地址:https://www.jb51.cc/ruby/267090.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。