• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

buffer attribute verses autoflush - confusion?

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attributes of the page directive...
Re buffer attribute:
Servers can use a larger buffer than you specify, but not smaller one.
So, if I specify 32kb buffer then the server can use say 64kb or 128kb ( anything > 32kb).
Good.
Re autoflush attribute:
Controls wether the output buffer should be automatically flushed when it is full or whether an Exception should be raised when buffer overflows.
What is the upper limit for the buffer?
IMO, it is set by the amt of RAM on my system.
When they talk abt the buffer overflow do they mean when I run out of RAM on my system?
Thanks for any help.
- satya
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The amount you set or the default 8kb
Just bought the voucher* Guess i am gonna take it this Saturday i got bored.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ersin:
I agree we can set it or the default value it has, but you haven't answered my qstn. We are setting the lower limit, what is the upper limit?

Just bought the voucher*
I did that at the very beginning of the year...
Guess i am gonna take it this Saturday i got bored.
Good luck.
- satya
 
Manjunath Subramanian
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satya :
I tried a piece of code for evaluating your question..
<html>
<head>
<title>Buffer Test</title>
<body>
<%@ page language="java"buffer ="12800"%>
<%
out.println("Working fine with buffersize:"+out.getBufferSize());
%>
</body>
</html>
The output i got was ..
Working fine with buffersize: 13107200.
I think the buffer size is 1/10 of the ram size.
I have a 128 MB ram on a win2k m/c and so the program works fine when i set a buffer size of "12800".For a buffer set to this size the server sets a size which is shown in the output.
When i change the buffer size to "128001" then the program bombs.The lines in the log file are...
" Exception initializing page context"
"java.lang.IllegalStateException: failed initialize JspWriter"
at so and so ....
So my conclusion is that the buffer size is 1/10 of the RAM size.Of course it could also depend on the web-server.I have Tomcat-4.0.1.I don't have other servers to try this out..
The other point is that..buffer over flow occurs when we set the "autoFlush" attribute to false and we do not flush it when it is has become full and we try to write more contents into it.
Hope this helps,
Manjunath
[ January 29, 2002: Message edited by: Manjunath Subramanian ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Manjunath.
So basically, the free RAM available determines the upper limit and hence overflow can occur when autoflush is "false". On the other hand, when autoflush=true, the response is committed to the client. Thats my understanding now.
Also, I am not sure your theory of 1/10 th RAM is correct. Personally, I am comfortable thinking that it is set by the amt of free memory avail rather thatn the 1/10 th magic number.
Thanks again.
- satya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic