Hello,

On 1/15/24 03:45, koteswara Rao Gundapaneni wrote:
On Sun, 14 Jan 2024, 18:13 koteswara Rao Gundapaneni, <
koti.gundapan...@gmail.com> wrote:

hi

Daemon threads have identified the performance issue inorder to complete .



Thread which is set as daemon by default has performance bottleneck

I explain that as below

myeg.setDaemon(true);
myeg.start();


the above start() method is taking long time to complete which is by
default performance bottleneck

The Thread.start() method is not something under the control of the Apache Tomcat team. That is a core JVM method.

so bootstrap has its performance issue as this loader thread is using
daemon thread.



In our code base we have lot of places where we have the code as below as
mentioned above.

myeg.setDaemon(true);
myeg.start();

Whose code is "our code"?

inorder to resolve the issue we will yield the corresponding thread



Inorder to limit the time taking for above line of code we have the
solution like below

myeg.setDaemon(true);
myeg.start();
myeg.yield();

How can a call to Thread.yield() which is made *after* a call to Thread.start() make the call to Thread.start() execute more quickly?

Here is the documentation for Thread.yield (with emphasis added by me):

"
A hint to the scheduler that the current thread is willing to yield its current use of a processor. **The scheduler is free to ignore this hint.**

Yield is a heuristic attempt to improve relative progression between threads that would otherwise over-utilise a CPU. Its use should be combined with detailed profiling and benchmarking to ensure that it actually has the desired effect.

**It is rarely appropriate to use this method.** It may be useful for debugging or testing purposes, where it may help to reproduce bugs due to race conditions. It may also be useful when designing concurrency control constructs such as the ones in the java.util.concurrent.locks package.
"

Note that calling someOtherThread.yield() actually causes the current thread (e.g. Main in your likely example) to yield, rather than instructing someOtherThread to yield.

If this is intentional, it looks like what you are trying to do is instruct the current thread to cause Thread called "myeg" (aka someOtherThread) to start and then to immediate yield the current thread's time back to the scheduler.

This should not be necessary.

the yield method declared as above will reduce the time taking for start
method



Hope this will make sense if not I will write it in my own language telugu.

I get the idea you are trying to convey, but it does not make much technical sense to me.

Your code for Bootstrap.start() is using reflection to invoke Catalina.start from your main thread. But you are not running any of your own code in any non-main thread, so of course the call to Catalina.start is taking "a long time": there is a lot of work to be done to bring a server online.

If you want your main thread to continue while Catalina is starting, then you should run that in a separate thread. For example:

new Thread(r -> catalina.start()).start();

If you think there is a performance problem in Apache Tomcat, the best way to demonstrate it is with a Unit Test which reproduces the problem.

What you are presenting appears to be either a misunderstanding of threading in Java or a misuse of Tomcat's Catalina class.

If you are concerned with performance, you might want to use less reflection in your code, since it's very slow compared to direct method invocations.

-chris

On Sun, Jan 14, 2024 at 4:13 AM Mark Thomas <ma...@apache.org> wrote:

You have yet to provide an explanation of the problem you are trying to
solve.

Unless and until you provide the information requested, further messages
from you on this topic will be ignored.

Mark


On 14/01/2024 12:05, koteswara Rao Gundapaneni wrote:
hi team

before clicking the link or check new private window in mozilla

image.png



when we browse the following link


https://github.com/KoteswararaoGundapaneni/KotiSpringRepository/tree/master
<
https://github.com/KoteswararaoGundapaneni/KotiSpringRepository/tree/master



image.png

Here the code page is shown as above



On Fri, Jan 12, 2024 at 6:41 PM koteswara Rao Gundapaneni
<koti.gundapan...@gmail.com <mailto:koti.gundapan...@gmail.com>> wrote:


     hi mark,

     please check if the code is now available at your end I verified
     from my end it can be visible

     On Fri, Jan 12, 2024 at 1:28 AM koteswara Rao Gundapaneni
     <koti.gundapan...@gmail.com <mailto:koti.gundapan...@gmail.com>>
wrote:


         Sorry for the inconvenience as its been a private repo just now
         i committed my changes to a new public repo


https://github.com/KoteswararaoGundapaneni/KotiSpringRepository/tree/master
<
https://github.com/KoteswararaoGundapaneni/KotiSpringRepository/tree/master


         Please find my attested changes in whole file 'Bootstrap.java'.



         On Fri, Jan 12, 2024 at 12:24 AM Mark Thomas <ma...@apache.org
         <mailto:ma...@apache.org>> wrote:

             On 12/01/2024 08:16, koteswara Rao Gundapaneni wrote:
              > Hi Team,
              >
              > As its milestone contribution for me I have added my
             branch along with the
              > pr created,
              >
              > Please add the reviewer here to commit the changes.
              >
              > Comparing
singlemanager...KoteswararaoGundapaneni-patch-1 ·
              > KoteswararaoGundapaneni/MYREPO (github.com
             <http://github.com>)
              >
             <
https://github.com/KoteswararaoGundapaneni/MYREPO/compare/singlemanager...KoteswararaoGundapaneni-patch-1
<
https://github.com/KoteswararaoGundapaneni/MYREPO/compare/singlemanager...KoteswararaoGundapaneni-patch-1


             That URI returns a 404.

             Unless and until you provide the information requested,
             further messages
             from you on this topic are likely to be ignored.

             Mark



              >
              >
              > ---------- Forwarded message ---------
              > From: Mark Thomas <ma...@apache.org
             <mailto:ma...@apache.org>>
              > Date: Sat, Jan 6, 2024 at 2:05 AM
              > Subject: Re: Supposed to provide performance at daemon
             thread in tomcat
              > To: <dev@tomcat.apache.org <mailto:dev@tomcat.apache.org

              >
              >
              > Please read my previous response and follow the
             instructions you were given.
              >
              > Mark
              >
              >
              > On 06/01/2024 06:26, koteswara Rao Gundapaneni wrote:
              >> Hi All,
              >>
              >> Somebody helps to give permissions to create the pull
             request as I have
              >> been trying to give the change at latest.
              >>
              >> regards,
              >> Koti
              >>
              >> On Fri, Jan 5, 2024 at 12:12 AM Mark Thomas
             <ma...@apache.org <mailto:ma...@apache.org>> wrote:
              >>
              >>> On 05/01/2024 05:15, koteswara Rao Gundapaneni wrote:
              >>>> It seems there are further permissions to be  added at
             Github
              >>>>
              >>>> *Error received via Github is as : **Pull request
             creation failed.
              >>>> Validation failed: must be a collaborator*
              >>>
              >>> Anyone can submit a pull request to the Tomcat
             repository. The only
              >>> exception is users who have been blocked for
spam/abuse.
              >>>
              >>>> Actually i tried creating the pull request for
             providing the solution
              > for
              >>>> daemon thread performance issue
              >>>
              >>> Please provide a link to your branch with the proposed
fix.
              >>>
              >>> Please also provide a better description of the problem
             you are trying
              >>> to solve.
              >>>
              >>> Mark
              >>>
              >>>> daemonthread background processing of the thread
             activity, and  it's
              >>> taking
              >>>> significant amount of time during the tomcat launch.
              >>>>
              >>>> Simple hint over the next step of the solution is just
             like
              >>>>
              >>>> yield() provides the greater performance to the daemon
             thread startup.
              >>>>
              >>>>
              >>>> Regards,
              >>>> Koti
              >>>>
              >>>
              >>>

  ---------------------------------------------------------------------
              >>> To unsubscribe, e-mail:
             dev-unsubscr...@tomcat.apache.org
             <mailto:dev-unsubscr...@tomcat.apache.org>
              >>> For additional commands, e-mail:
             dev-h...@tomcat.apache.org <mailto:
dev-h...@tomcat.apache.org>
              >>>
              >>>
              >>
              >
              >

  ---------------------------------------------------------------------
              > To unsubscribe, e-mail:
dev-unsubscr...@tomcat.apache.org
             <mailto:dev-unsubscr...@tomcat.apache.org>
              > For additional commands, e-mail:
             dev-h...@tomcat.apache.org <mailto:
dev-h...@tomcat.apache.org>
              >


  ---------------------------------------------------------------------
             To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
             <mailto:dev-unsubscr...@tomcat.apache.org>
             For additional commands, e-mail: dev-h...@tomcat.apache.org
             <mailto:dev-h...@tomcat.apache.org>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to