1.我的理解是,您使用的缓冲区大小越小,客户端浏览器的性能越好。我的假设正确吗?如果您不这么认为,请解释
答:是的,实际上不是在性能方面。但在渲染内容方面。因为客户端会以更快的速度获取数据。缓冲区大小应大于或等于底层套接字缓冲区大小。否则,尽管当达到缓冲区大小时 jsp 会刷新,但实际上不会将其写入客户端。
2.最佳缓冲区大小应该是多少
答:正如我上面所说,它应该大于或等于底层套接字缓冲区大小。最佳尺寸还取决于您的应用。它应该是这样一个值,一旦达到缓冲区大小,响应将被提交,您不能再进行任何操作,从而导致添加响应头。
3.有没有办法知道默认缓冲区大小是多少?
Answer : Yes , by using JspWriter class. JspWriter has a getter getBufferSize()
which gives you the buffer size. The JspWriter can be obtained using pageContext.getOut()
.
4.Setting autoflush to true should flush the buffer once the max size reached. If you set it to false, its upto you to decide when to flush
Answer: If set to true, it will flush when the max buffer size is reached. If set to false, it will throw an exception