Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimal buffer size for JSP's and autoflush property

Tags:

jsp

Does anyone have recommendation for setting optimal buffer size for JSP's? You can use the following page directive to set the buffer size in JSP's

    <%@page buffer="xxxkb" autoFlush="true" %>

My questions are the following

  1. My understanding is that the less buffer size that you use, the performance is better for client side browsers. Does my assumption correct? If you think otherwise, please explain

  2. What should be the optimal buffer size

  3. Is there a way to know what is the default buffer size?

  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

like image 313
webjockey Avatar asked Jun 03 '12 06:06

webjockey


People also ask

What is the optimal buffer size?

A good buffer size for recording is 128 samples, but you can also get away with raising the buffer size up to 256 samples without being able to detect much latency in the signal. You can also decrease the buffer size below 128, but then some plugins and effects may not run in real time.

How do you determine buffer size?

To check the buffer window, multiply the bit rate (bits per second) by the buffer window (in seconds) and divide by 1000 to get the size, in bits, of the buffer for the stream.

What is buffer attribute in JSP?

The buffer attribute specifies the buffering characteristics for the server output response object.

What is buffer size in Java?

BufferedOutputStream(OutputStream out) Creates a new buffered output stream to write data to the specified underlying output stream with a default 512-byte buffer size. BufferedOutputStream(OutputStream out, int size)


1 Answers

1.My understanding is that the less buffer size that you use, the performance is better for client side browsers. Does my assumption correct? If you think otherwise, please explain

Answer: Yes, not actually in terms of performance. But in terms of rendering the content. Because the client will get data at faster rate. Buffer size should be greater than or equal to the underlying socket buffer size. Otherwise, though the jsp's flushes when the buffer size is reached it will not be actually written to the client.

2.What should be the optimal buffer size

Answer: As I have said above it should be greater than or equal the underlying socket buffer size. The optimal size also depends on your application. It should be such a value that once the buffer size is reached, the response will be committed and you can no more do operation which result in adding response header.

3.Is there a way to know what is the default buffer size?

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

like image 58
Ramesh PVK Avatar answered Nov 09 '22 22:11

Ramesh PVK