You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Rafael H. Schloming" <ra...@redhat.com> on 2005/11/30 22:21:08 UTC
directory listings
Hi,
I've been looking into the performance problems associated with many
concurrent requests of large directories. After doing some informal
benchmarking I've come up with the attached patch that improves
performance in this scenario. The patch adds a size limited Map with a 5
second timeout for caching rendered directory listings. My tests show a
significant performance improvement and the server no longer keels over
from OutOfMemory exceptions at higher concurrency levels.
Below are the results of the benchmarks I performed against the
unmodified server.
c | total | mean
-------------------------------------------------------------
1 | 33.72985 seconds | 330.730 ms
10 | 12.807910 seconds | 1280.791 ms
20 | 12.641188 seconds | 2528.238 ms
30 | 12.930321 seconds | 3879.096 ms
40 | -- | --
50 | -- | --
60 | -- | --
70 | -- | --
80 | -- | --
90 | -- | --
100 | -- | --
Here are the same benchmarks with the attached patch applied:
c | total | mean
-------------------------------------------------------------
1 | 0.949313 seconds | 9.493 ms
10 | 0.148746 seconds | 14.875 ms
20 | 0.167047 seconds | 33.409 ms
30 | 0.198910 seconds | 59.673 ms
40 | 0.202527 seconds | 81.011 ms
50 | 0.176821 seconds | 88.410 ms
60 | 0.203042 seconds | 121.825 ms
70 | 0.257176 seconds | 180.023 ms
80 | 0.283165 seconds | 226.532 ms
90 | 0.304787 seconds | 274.308 ms
100 | 0.196776 seconds | 196.776 ms
c = number of concurrent requests (see the -c flag for ab)
total = total time for benchmark to complete
mean = the average time until each request is complete
-- = benchmark timed out
In all cases the total number of requests is 100 and the test
directory being listed contains 2000 empty files.
--
Rafael H. Schloming <ra...@redhat.com>
Re: directory listings
Posted by "Rafael H. Schloming" <ra...@redhat.com>.
Thanks for the feedback. I'll make the changes you suggest as soon as I
have a chance and repost the patch.
On Wed, 2005-11-30 at 19:47 -0500, Yoav Shapira wrote:
> Hi,
> It's an interesting patch and an interesting idea in general. I'm
> impressed with the performance findings, although I haven't seen
> anyone recently complaining about many concurrent directory listings
> requests.
>
> I have a couple of requests for the patch, if you don't mind some
> feedback. I'd prefer a separate class for the DirectoryListingCache
> or whatever you want to call it, with its CacheEntry and rendering,
> encoding methods. It's kind of ugly to throw all of that into
> DefaultServlet. DefaultServlet can then use the cache class. I'd
> also prefer the relevant parameters (5, 1000) to be configurable, at
> least via protected setter/getter methods. Finally, assuming the
> above refactoring is done, I'd like a parameter from web.xml to
> DefaultServlet setting whether to use the directory listing cache or
> not. That way people can turn it off easily.
>
> Yoav
--
Rafael H. Schloming <ra...@redhat.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: directory listings
Posted by Yoav Shapira <yo...@apache.org>.
Hi,
It's an interesting patch and an interesting idea in general. I'm
impressed with the performance findings, although I haven't seen
anyone recently complaining about many concurrent directory listings
requests.
I have a couple of requests for the patch, if you don't mind some
feedback. I'd prefer a separate class for the DirectoryListingCache
or whatever you want to call it, with its CacheEntry and rendering,
encoding methods. It's kind of ugly to throw all of that into
DefaultServlet. DefaultServlet can then use the cache class. I'd
also prefer the relevant parameters (5, 1000) to be configurable, at
least via protected setter/getter methods. Finally, assuming the
above refactoring is done, I'd like a parameter from web.xml to
DefaultServlet setting whether to use the directory listing cache or
not. That way people can turn it off easily.
Yoav
On 11/30/05, Rafael H. Schloming <ra...@redhat.com> wrote:
> Hi,
>
> I've been looking into the performance problems associated with many
> concurrent requests of large directories. After doing some informal
> benchmarking I've come up with the attached patch that improves
> performance in this scenario. The patch adds a size limited Map with a 5
> second timeout for caching rendered directory listings. My tests show a
> significant performance improvement and the server no longer keels over
> from OutOfMemory exceptions at higher concurrency levels.
>
> Below are the results of the benchmarks I performed against the
> unmodified server.
>
> c | total | mean
> -------------------------------------------------------------
> 1 | 33.72985 seconds | 330.730 ms
> 10 | 12.807910 seconds | 1280.791 ms
> 20 | 12.641188 seconds | 2528.238 ms
> 30 | 12.930321 seconds | 3879.096 ms
> 40 | -- | --
> 50 | -- | --
> 60 | -- | --
> 70 | -- | --
> 80 | -- | --
> 90 | -- | --
> 100 | -- | --
>
>
> Here are the same benchmarks with the attached patch applied:
>
> c | total | mean
> -------------------------------------------------------------
> 1 | 0.949313 seconds | 9.493 ms
> 10 | 0.148746 seconds | 14.875 ms
> 20 | 0.167047 seconds | 33.409 ms
> 30 | 0.198910 seconds | 59.673 ms
> 40 | 0.202527 seconds | 81.011 ms
> 50 | 0.176821 seconds | 88.410 ms
> 60 | 0.203042 seconds | 121.825 ms
> 70 | 0.257176 seconds | 180.023 ms
> 80 | 0.283165 seconds | 226.532 ms
> 90 | 0.304787 seconds | 274.308 ms
> 100 | 0.196776 seconds | 196.776 ms
>
> c = number of concurrent requests (see the -c flag for ab)
> total = total time for benchmark to complete
> mean = the average time until each request is complete
> -- = benchmark timed out
>
> In all cases the total number of requests is 100 and the test
> directory being listed contains 2000 empty files.
>
> --
> Rafael H. Schloming <ra...@redhat.com>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>
--
Yoav Shapira
System Design and Management Fellow
MIT Sloan School of Management
Cambridge, MA, USA
yoavs@computer.org / www.yoavshapira.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: directory listings
Posted by "Rafael H. Schloming" <ra...@redhat.com>.
I can confirm that the benchmarks I was doing were without XSLT. I was
using a directory with 2000 empty files on a dual processor 2.8Ghz Xeon
with 1G of RAM. I didn't make any changes to the default config produced
by ant deploy.
On Thu, 2005-12-01 at 19:18 +0000, Mark Thomas wrote:
> Tim Funk wrote:
> > It looks like this issue only occurs when the XSLT transformation is
> > done on the directory listing. Which is not an out of box configuration
> > so there is no worry for DOS (in case anyone is wondering).
>
> Actually, there is an issue here without the XSLT. This is why
> directory listing is now disabled by default. See
> http://marc.theaimsgroup.com/?l=tomcat-dev&m=113148731122439&w=2
>
> Mark
--
Rafael H. Schloming <ra...@redhat.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: directory listings
Posted by Mark Thomas <ma...@apache.org>.
Tim Funk wrote:
> It looks like this issue only occurs when the XSLT transformation is
> done on the directory listing. Which is not an out of box configuration
> so there is no worry for DOS (in case anyone is wondering).
Actually, there is an issue here without the XSLT. This is why
directory listing is now disabled by default. See
http://marc.theaimsgroup.com/?l=tomcat-dev&m=113148731122439&w=2
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: directory listings
Posted by Tim Funk <fu...@joedog.org>.
It looks like this issue only occurs when the XSLT transformation is done on
the directory listing. Which is not an out of box configuration so there is
no worry for DOS (in case anyone is wondering).
Otherwise - looks interesting. cacheTTL and cacheMax should be configurable
at servlet init time.
-Tim
Rafael H. Schloming wrote:
> Hi,
>
> I've been looking into the performance problems associated with many
> concurrent requests of large directories. After doing some informal
> benchmarking I've come up with the attached patch that improves
> performance in this scenario. The patch adds a size limited Map with a 5
> second timeout for caching rendered directory listings. My tests show a
> significant performance improvement and the server no longer keels over
> from OutOfMemory exceptions at higher concurrency levels.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org