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 2020/02/18 18:33:14 UTC
[Bug 64156] New: Tomcat 7 Performance: acceptor thread bottleneck at
getPoolSize() located at TaskQueue offer function
https://bz.apache.org/bugzilla/show_bug.cgi?id=64156
Bug ID: 64156
Summary: Tomcat 7 Performance: acceptor thread bottleneck at
getPoolSize() located at TaskQueue offer function
Product: Tomcat 7
Version: trunk
Hardware: All
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: dev@tomcat.apache.org
Reporter: torres.yang@broadcom.com
Target Milestone: ---
Tomcat 7 Performance:
During our performance testing, we found out that the acceptor thread
bottleneck at the getPoolSize() located at TaskQueue offer function, which is
an expensive call to AbstractQueuedSynchronizer acquire lock.
Proposed fix is to store and use poolSize as local variable. This reduces 2-3
expensive calls down to 1 for each request.
@Override
public boolean offer(Runnable o) {
//we can't do any checks
if (parent == null) return super.offer(o);
// getPoolSize() is expensive call to AbstractQueuedSynchronizer acquire
lock
final int poolSize = parent.getPoolSize();
//we are maxed out on threads, simply queue the object
if (poolSize == parent.getMaximumPoolSize()) return super.offer(o);
//we have idle threads, just add it to the queue
if (parent.getSubmittedCount() <= poolSize) return super.offer(o);
//if we have less threads than maximum force creation of a new thread
if (poolSize < parent.getMaximumPoolSize()) return false;
//if we reached here, we need to add it to the queue
return super.offer(o);
}
--
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 64156] Tomcat 7 Performance: acceptor thread bottleneck at
getPoolSize() located at TaskQueue offer function
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64156
Mark Thomas <ma...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Mark Thomas <ma...@apache.org> ---
*** This bug has been marked as a duplicate of bug 64155 ***
--
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 64156] Tomcat 7 Performance: acceptor thread bottleneck at
getPoolSize() located at TaskQueue offer function
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64156
--- Comment #1 from Torres Yang <to...@broadcom.com> ---
Created attachment 37023
--> https://bz.apache.org/bugzilla/attachment.cgi?id=37023&action=edit
Improved Tomcat 7 performance by reduced number of getPoolSize() call that
located at TaskQueue offer function
--
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 64156] Tomcat 7 Performance: acceptor thread bottleneck at
getPoolSize() located at TaskQueue offer function
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64156
Torres Yang <to...@broadcom.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
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