I am seeing this also (see my previous post).
We can deal with Very Large Objects in our archive, and the hard-coded 2k buffer size in org/apache/slide/webdav/method/GetMethod.java was killing read performance. Getting a single chunk of data from our archive is a bit expensive, so I implemented a better buffering scheme (with a still hard-coded limit). Unified diff is attached.
On my local machine, I went from ~115KB/sec reads to ~9MB/sec reads for large objects.
If someone with commit privs would review, I would appreciate it.
Thanks -John
EngR H wrote:
Hello Again!
Am working with WCK, customized it to work on my DMS, the problem is that the performance is too slow! when i tried to debug and see which methods takes much time, I found that alot of methods are called twice, and don't know why, for example giving the uri of /files the following methods are called twice before going to the next level: getChildrenNames() readProperties() getLastModified() getLastModified()
Is there any thing that should be adjusted?? or is that the normal behaviour of the WebdavServlet??
any suggestions??
Regards rony
--------------------------------- Do you Yahoo!? The all-new My Yahoo! – What will yours do?
--- GetMethod.java.~1.55.~ 2004-11-09 10:00:28.000000000 -0500
+++ GetMethod.java 2004-12-03 22:13:09.000000000 -0500
@@ -70,8 +70,11 @@
// -------------------------------------------------------------- Constants
- protected final int BUFFER_SIZE = 2048;
+ /** The default buffer size */
+ protected final int DEFAULT_BUFFER_SIZE = 2048;
+ /** The maximum buffer size */
+ protected final int MAX_BUFFER_SIZE = 200 * 1024;
/**
@@ -393,7 +396,7 @@
(resourceInputStream, input);
// Copy the input stream to the output stream
- exception = copyRange(istream, ostream);
+ exception = copyRange(istream, ostream, resourceInfo.length);
// Clean up the input and output streams
try {
@@ -544,11 +547,12 @@
* @return Exception which occured during processing
*/
private IOException copyRange(InputStream istream,
- ServletOutputStream ostream) {
+ ServletOutputStream ostream,
+ long resourceLength) {
// Copy the input stream to the output stream
IOException exception = null;
- byte buffer[] = new byte[input];
+ byte buffer[] = new byte[getBufferSize(resourceLength)];
int len = buffer.length;
while (true) {
try {
@@ -591,7 +595,7 @@
IOException exception = null;
long bytesToRead = end - start + 1;
- byte buffer[] = new byte[input];
+ byte buffer[] = new byte[getBufferSize(bytesToRead)];
int len = buffer.length;
while ( (bytesToRead > 0) && (len >= buffer.length)) {
try {
@@ -615,6 +619,16 @@
}
+ /**
+ * Get a reasonable buffer size.
+ */
+ private int getBufferSize(long resourceLength)
+ {
+ if (resourceLength <= 0)
+ return DEFAULT_BUFFER_SIZE;
+
+ return (int)Math.min(resourceLength, MAX_BUFFER_SIZE);
+ }
/**
* Parse the range header.--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
