ASF Bugzilla – Attachment 37022 Details for
Bug 64155
Tomcat 7 Performance: acceptor thread bottleneck at getPoolSize() located at TaskQueue offer function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Reduced getPoolSize
getPoolSize.patch (text/plain), 1.52 KB, created by
Torres Yang
on 2020-02-18 18:31:51 UTC
(
hide
)
Description:
Reduced getPoolSize
Filename:
MIME Type:
Creator:
Torres Yang
Created:
2020-02-18 18:31:51 UTC
Size:
1.52 KB
patch
obsolete
>Index: java/org/apache/tomcat/util/threads/TaskQueue.java >IDEA additional info: >Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP ><+>UTF-8 >=================================================================== >--- java/org/apache/tomcat/util/threads/TaskQueue.java (revision 75cec48b92d593b0beed19d3befedf86d497edfa) >+++ java/org/apache/tomcat/util/threads/TaskQueue.java (date 1582049473504) >@@ -66,14 +66,16 @@ > > @Override > public boolean offer(Runnable o) { >- //we can't do any checks >- if (parent==null) return super.offer(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 (parent.getPoolSize() == parent.getMaximumPoolSize()) return super.offer(o); >+ if (poolSize == parent.getMaximumPoolSize()) return super.offer(o); > //we have idle threads, just add it to the queue >- if (parent.getSubmittedCount()<=(parent.getPoolSize())) return super.offer(o); >+ if (parent.getSubmittedCount() <= poolSize) return super.offer(o); > //if we have less threads than maximum force creation of a new thread >- if (parent.getPoolSize()<parent.getMaximumPoolSize()) return false; >+ if (poolSize < parent.getMaximumPoolSize()) return false; > //if we reached here, we need to add it to the queue > return super.offer(o); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 64155
: 37022