You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Noordermeer <mi...@normi.net> on 2016/06/20 10:06:59 UTC

Tomcat 8.5 slowdown with Resources element

Hi,

I'm experiencing a very weird issue, and do not really have an idea
where to start looking for the solution, hopefully someone here has an
idea.
As the Tomcat 8.5 Cache.getResource() call added some logging about
the cache being too small, I'm trying to increase the size. The weird
thing, is that simply defining a <Resources /> element slows down my
webapp startup greatly.

==============

Setup 1:

server.xml
---
<Host name="localhost" appBase="webapps"
            unpackWARs="true" autoDeploy="false" deployOnStartup="false">
        <Context path="" docBase="../app/warfile.war">
                <Resources />
        </Context>
</Host>
---

Deploy time app: 180 seconds

==============

Setup 2:

server.xml
---
<Host name="localhost" appBase="webapps"
            unpackWARs="true" autoDeploy="false" deployOnStartup="true">
</Host>
---

Catalina/localhost/ROOT.xml
---
<Context docBase="../app/warfile.war">
        <Resources />
</Context>
---

Deploy time app: 20 seconds

==============

If I remove the Resources element, everything is fine in all
scenario's (but then I cannot increase the cache size).

Going through the code, I can't see what would be different about
defining an empty Resources element or no Resources element, or what
would be different in defining the webapp in server.xml or in a
separate context file. Any insights and ideas are appreciated.

Many thanks,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 slowdown with Resources element

Posted by Mike Noordermeer <mi...@normi.net>.
> As an answer to your last question above, look here :
> http://tomcat.apache.org/tomcat-8.0-doc/config/context.html
> --> Defining a context

I'm not sure what you are referring to?
I know that a server.xml can contain multiple contexts, and cannot be
changed at runtime, but that does not really explain the issues I'm
seeing.

Regards,

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 slowdown with Resources element

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 20.06.2016 12:06, Mike Noordermeer wrote:
> Hi,
>
> I'm experiencing a very weird issue, and do not really have an idea
> where to start looking for the solution, hopefully someone here has an
> idea.
> As the Tomcat 8.5 Cache.getResource() call added some logging about
> the cache being too small, I'm trying to increase the size. The weird
> thing, is that simply defining a <Resources /> element slows down my
> webapp startup greatly.
>
> ==============
>
> Setup 1:
>
> server.xml
> ---
> <Host name="localhost" appBase="webapps"
>              unpackWARs="true" autoDeploy="false" deployOnStartup="false">
>          <Context path="" docBase="../app/warfile.war">
>                  <Resources />
>          </Context>
> </Host>
> ---
>
> Deploy time app: 180 seconds
>
> ==============
>
> Setup 2:
>
> server.xml
> ---
> <Host name="localhost" appBase="webapps"
>              unpackWARs="true" autoDeploy="false" deployOnStartup="true">
> </Host>
> ---
>
> Catalina/localhost/ROOT.xml
> ---
> <Context docBase="../app/warfile.war">
>          <Resources />
> </Context>
> ---
>
> Deploy time app: 20 seconds
>
> ==============
>
> If I remove the Resources element, everything is fine in all
> scenario's (but then I cannot increase the cache size).
>
> Going through the code, I can't see what would be different about
> defining an empty Resources element or no Resources element, or what
> would be different in defining the webapp in server.xml or in a
> separate context file. Any insights and ideas are appreciated.

As an answer to your last question above, look here :
http://tomcat.apache.org/tomcat-8.0-doc/config/context.html
--> Defining a context



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 slowdown with Resources element

Posted by Mark Thomas <ma...@apache.org>.
On 20/06/2016 13:47, Mark Thomas wrote:
> On 20/06/2016 13:27, Mike Noordermeer wrote:
>> Further profiling leads me to believe that Tomcat starts using
>> JarWarResources if a <Context><Resources/></Context> block is placed
>> in the server.xml file (even if unpackWars and unpackWar are true).
>> Still looking into why it is doing this though...
> 
> It is caused by the StandardRoot being started earlier (in
> StandardContext.initInternal()) before the docBase has been adjusted to
> the expanded WAR.
> 
> It may be possible to remove the WebResource initialisation from
> StandardContext.initInternal() entirely but that would need some
> research to figure out why it was there in the first place.

I dug into the history. It looks to be an unnecessary hangover from the
previous resources implementation. This has been fixed in 9.0.x [1] and
I'll back-port it to 8.5.x and 8.0.x.

Mark

[1] http://svn.apache.org/viewvc?view=revision&revision=1749328

> 
> Mark
> 
>>
>> --Mike
>>
>> On 20 June 2016 at 12:06, Mike Noordermeer <mi...@normi.net> wrote:
>>> Hi,
>>>
>>> I'm experiencing a very weird issue, and do not really have an idea
>>> where to start looking for the solution, hopefully someone here has an
>>> idea.
>>> As the Tomcat 8.5 Cache.getResource() call added some logging about
>>> the cache being too small, I'm trying to increase the size. The weird
>>> thing, is that simply defining a <Resources /> element slows down my
>>> webapp startup greatly.
>>>
>>> ==============
>>>
>>> Setup 1:
>>>
>>> server.xml
>>> ---
>>> <Host name="localhost" appBase="webapps"
>>>             unpackWARs="true" autoDeploy="false" deployOnStartup="false">
>>>         <Context path="" docBase="../app/warfile.war">
>>>                 <Resources />
>>>         </Context>
>>> </Host>
>>> ---
>>>
>>> Deploy time app: 180 seconds
>>>
>>> ==============
>>>
>>> Setup 2:
>>>
>>> server.xml
>>> ---
>>> <Host name="localhost" appBase="webapps"
>>>             unpackWARs="true" autoDeploy="false" deployOnStartup="true">
>>> </Host>
>>> ---
>>>
>>> Catalina/localhost/ROOT.xml
>>> ---
>>> <Context docBase="../app/warfile.war">
>>>         <Resources />
>>> </Context>
>>> ---
>>>
>>> Deploy time app: 20 seconds
>>>
>>> ==============
>>>
>>> If I remove the Resources element, everything is fine in all
>>> scenario's (but then I cannot increase the cache size).
>>>
>>> Going through the code, I can't see what would be different about
>>> defining an empty Resources element or no Resources element, or what
>>> would be different in defining the webapp in server.xml or in a
>>> separate context file. Any insights and ideas are appreciated.
>>>
>>> Many thanks,
>>>
>>> Mike
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 slowdown with Resources element

Posted by Mark Thomas <ma...@apache.org>.
On 20/06/2016 13:27, Mike Noordermeer wrote:
> Further profiling leads me to believe that Tomcat starts using
> JarWarResources if a <Context><Resources/></Context> block is placed
> in the server.xml file (even if unpackWars and unpackWar are true).
> Still looking into why it is doing this though...

It is caused by the StandardRoot being started earlier (in
StandardContext.initInternal()) before the docBase has been adjusted to
the expanded WAR.

It may be possible to remove the WebResource initialisation from
StandardContext.initInternal() entirely but that would need some
research to figure out why it was there in the first place.

Mark

> 
> --Mike
> 
> On 20 June 2016 at 12:06, Mike Noordermeer <mi...@normi.net> wrote:
>> Hi,
>>
>> I'm experiencing a very weird issue, and do not really have an idea
>> where to start looking for the solution, hopefully someone here has an
>> idea.
>> As the Tomcat 8.5 Cache.getResource() call added some logging about
>> the cache being too small, I'm trying to increase the size. The weird
>> thing, is that simply defining a <Resources /> element slows down my
>> webapp startup greatly.
>>
>> ==============
>>
>> Setup 1:
>>
>> server.xml
>> ---
>> <Host name="localhost" appBase="webapps"
>>             unpackWARs="true" autoDeploy="false" deployOnStartup="false">
>>         <Context path="" docBase="../app/warfile.war">
>>                 <Resources />
>>         </Context>
>> </Host>
>> ---
>>
>> Deploy time app: 180 seconds
>>
>> ==============
>>
>> Setup 2:
>>
>> server.xml
>> ---
>> <Host name="localhost" appBase="webapps"
>>             unpackWARs="true" autoDeploy="false" deployOnStartup="true">
>> </Host>
>> ---
>>
>> Catalina/localhost/ROOT.xml
>> ---
>> <Context docBase="../app/warfile.war">
>>         <Resources />
>> </Context>
>> ---
>>
>> Deploy time app: 20 seconds
>>
>> ==============
>>
>> If I remove the Resources element, everything is fine in all
>> scenario's (but then I cannot increase the cache size).
>>
>> Going through the code, I can't see what would be different about
>> defining an empty Resources element or no Resources element, or what
>> would be different in defining the webapp in server.xml or in a
>> separate context file. Any insights and ideas are appreciated.
>>
>> Many thanks,
>>
>> Mike
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 8.5 slowdown with Resources element

Posted by Mike Noordermeer <mi...@normi.net>.
Further profiling leads me to believe that Tomcat starts using
JarWarResources if a <Context><Resources/></Context> block is placed
in the server.xml file (even if unpackWars and unpackWar are true).
Still looking into why it is doing this though...

--Mike

On 20 June 2016 at 12:06, Mike Noordermeer <mi...@normi.net> wrote:
> Hi,
>
> I'm experiencing a very weird issue, and do not really have an idea
> where to start looking for the solution, hopefully someone here has an
> idea.
> As the Tomcat 8.5 Cache.getResource() call added some logging about
> the cache being too small, I'm trying to increase the size. The weird
> thing, is that simply defining a <Resources /> element slows down my
> webapp startup greatly.
>
> ==============
>
> Setup 1:
>
> server.xml
> ---
> <Host name="localhost" appBase="webapps"
>             unpackWARs="true" autoDeploy="false" deployOnStartup="false">
>         <Context path="" docBase="../app/warfile.war">
>                 <Resources />
>         </Context>
> </Host>
> ---
>
> Deploy time app: 180 seconds
>
> ==============
>
> Setup 2:
>
> server.xml
> ---
> <Host name="localhost" appBase="webapps"
>             unpackWARs="true" autoDeploy="false" deployOnStartup="true">
> </Host>
> ---
>
> Catalina/localhost/ROOT.xml
> ---
> <Context docBase="../app/warfile.war">
>         <Resources />
> </Context>
> ---
>
> Deploy time app: 20 seconds
>
> ==============
>
> If I remove the Resources element, everything is fine in all
> scenario's (but then I cannot increase the cache size).
>
> Going through the code, I can't see what would be different about
> defining an empty Resources element or no Resources element, or what
> would be different in defining the webapp in server.xml or in a
> separate context file. Any insights and ideas are appreciated.
>
> Many thanks,
>
> Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org