Bug 406273 - Idle Jetty thread seen in Eclipse 4.2.2
Summary: Idle Jetty thread seen in Eclipse 4.2.2
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo, performance
Depends on:
Blocks:
 
Reported: 2013-04-23 01:12 EDT by Pavan V CLA
Modified: 2013-04-30 10:48 EDT (History)
3 users (show)

See Also:


Attachments
Profiling stats noticed on Jetty thread (204.14 KB, image/jpeg)
2013-04-23 01:12 EDT, Pavan V CLA
no flags Details
profiling stats for a right-click context menu operation (90.25 KB, image/jpeg)
2013-04-27 06:21 EDT, Pavan V CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavan V CLA 2013-04-23 01:12:20 EDT
Created attachment 230001 [details]
Profiling stats noticed on Jetty thread

On simple actions on Eclipse like right-click on PE or opening of editors, I can see the Jetty thread running in the background (as revealed by some profiling). 

I've attached the thread trace that I see during profiling

Is there a way to disable the Jetty jobs from running ?
Comment 1 Dani Megert CLA 2013-04-23 05:05:45 EDT
There should not be a Jetty job out of the box. Can you check who creates/uses the job?
Comment 2 John Arthorne CLA 2013-04-26 14:50:26 EDT
Jetty is used for help content so I think this is completely normal. The attached trace shows that the thread is idle for all of the time. You need to look at CPU time rather than elapsed time because idle threads have negligible impact on performance.
Comment 3 Pavan V CLA 2013-04-27 06:21:56 EDT
Created attachment 230206 [details]
profiling stats for a right-click context menu operation
Comment 4 Pavan V CLA 2013-04-27 06:27:52 EDT
The profiler stats (as attached in the previous comment) show that the actual operation (running on the main thread) takes much lesser time than the time spent in the Jetty thread. I hope I've read these stats alright, let me know if I've missed something

It indeed looks like these threads have been started by the Eclipse help engine (JettyHelpServer class). If so, I have a couple of questions -

1) How was this managed earlier in Eclipse 3.6.x, where I don't see traces of Jetty threads at all ? 
2) I've disabled all the information centers listed @ Window>Preferences>Help>Content - I see that this doesn't turn the Jetty threads off. Can I control this via any preference option ?
Comment 5 John Arthorne CLA 2013-04-29 14:56:06 EDT
I spent a bit of time today running the profiler on the base Eclipse SDK today. I am not able to see a Jetty-related job appearing at all when profiling basic operations like context menus, open/closing editors, etc. I wonder if what you are seeing is even related to Eclipse's use of Jetty or whether your product might be doing something else with Jetty here? Steps to reproduce with Eclipse SDK are needed here. I have also answered your questions:


(In reply to comment #4)
> 1) How was this managed earlier in Eclipse 3.6.x, where I don't see traces
> of Jetty threads at all ? 

Eclipse 3.6 also used Jetty in exactly the same way. The Jetty version has changed and the package names for Jetty also changed, but otherwise it is similar.

> 2) I've disabled all the information centers listed @
> Window>Preferences>Help>Content - I see that this doesn't turn the Jetty
> threads off. Can I control this via any preference option ?

That preference is unrelated. Jetty is also used for rending things like hover help in the editor, which is unrelated to whether you have any help systems connected. There is no global way to "turn off Jetty".
Comment 6 Pavan V CLA 2013-04-30 00:26:33 EDT
Alright, I did spend some time debugging through the lifecyle of these threads & the JettyServer is indeed started by one of our product plugins that I was completely unaware of. Sorry about this

Having said that, although started by our product, when it does run, it seems to consume a lot of CPU. Can you programmatic-ally invoke it via any of your plugin startup & validate this? There may indeed be a valid case of starting Jetty & we don't want our performance to be hampered because of this.
Comment 7 John Arthorne CLA 2013-04-30 10:48:56 EDT
Jetty is a very high performance web server. If it is consuming lots of CPU it means it is serving lots of requests and/or doing lots of I/O as a result of those requests. I am certain that simply starting jetty and having an idle Jetty server has very minimal impact. We do start jetty in our help system, and as I said this is not showing up at all in profiling of the Eclipse SDK. Jetty has extensive logging that you can enable to diagnose your problem further:

http://wiki.eclipse.org/Jetty/Tutorial/RequestLog