You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/01/20 10:03:26 UTC

[Bug 60615] New: 20% CPU use while check for modified resource

https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

            Bug ID: 60615
           Summary: 20% CPU use while check for modified resource
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: elghayani.yassine@gmail.com
  Target Milestone: -----

When context is configured to auto reload web resources, the call to:
org.apache.catalina.loader.WebappClassLoaderBase#modified consume huge
resources (up to 10%~20%)

after investigation it seem that the algorithm of this method isn't optimized,
we think that instead of looping throughout all loaded classes
(resourceEntries.entrySet() : almost classes come from jars =~ 11000 classes)
would be better if we loop only throughout classes come from DirResource
(WEB-INF/classes =~300 classes).


for more details thanks to mailing me.

Thx.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

--- Comment #1 from Yassine <el...@gmail.com> ---
Created attachment 34654
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34654&action=edit
resource use - apache 8 - with no activite

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

--- Comment #3 from Yassine EL GHAYANI <el...@gmail.com> ---
Thx, indeed this feature in tomcat 7.x work better, and never have any probleme
with it.

NB: our prod servers never use reloadable feature, only test env that have this
option activated.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
I've put together a possible patch for this:
http://home.apache.org/~markt/patches/2017-01-27-bug60615-tc9-v1.patch

It does require a change to the WebResource interface as well as to a number of
the resource implementation classes. I'm a little concerned about the impact it
may have on any custom resource implementations (although I haven't seen any of
those).

The patch also assumes that class loader only resources won't be modified.
While that is correct for classes in JAR files, it is possible that a custom
implementation could use class loader only resources that could be modified.

What is really required is "does this resource need to be checked for
modifications" flag.

There is another argument that if a JAR is updated to replace a class file that
has not yet been used, then a reload is unnecessary. The current implementation
correctly handles this scenario and only by checking individual classes can it
be handled correctly. The requested change would break this behaviour.

The more I think about this, the more I am leaning towards WONTFIX as a
solution. Keep in mind that if re-loading is required then it may be a simpler
option to update the .class file(s) and then touch web.xml to trigger a reload
rather than setting reloadable on the Context.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
Having thought about this some more, closing as WONTFIX as per my previous
comment.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
I've looked back at 7.0.x (before the new resource handling was introduced) and
that did only check JARs rather than individual classes in JARs.

While in theory a class could be modified in a JAR without changing the JAR's
timestamp, that wouldn't happen by accident. Therefore, only checking the JAR's
timestamp seems reasonable.

I'll take a look at a patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60615] 20% CPU use while check for modified resource

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60615

Yassine <el...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |9.0.0.M17
                 OS|                            |All

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org