Bug 223840 - Performance of embedded server on Windows 8
Performance of embedded server on Windows 8
Status: VERIFIED FIXED
Product: web
Classification: Unclassified
Component: HTML Project
7.3
PC Windows 8 x64
: P2 (vote)
: 7.3
Assigned To: Petr Jiricka
issues@web
: 73_HR_FIX, PERFORMANCE
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-14 12:18 UTC by Vladimir Riha
Modified: 2013-01-27 22:42 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
thread dump after hitting F5 (24.15 KB, application/octet-stream)
2012-12-14 12:18 UTC, Vladimir Riha
Details
thread dump after running file from IDE in Chrome (19.46 KB, application/octet-stream)
2012-12-14 12:19 UTC, Vladimir Riha
Details
IDE log (54.35 KB, application/octet-stream)
2012-12-14 12:23 UTC, Vladimir Riha
Details
the first message after page is loaded from Console (2.50 KB, application/octet-stream)
2012-12-17 08:21 UTC, Vladimir Riha
Details
reloading snapshot (20.30 KB, application/octet-stream)
2012-12-17 08:23 UTC, Vladimir Riha
Details
run file snapshot (53.25 KB, application/octet-stream)
2012-12-17 08:23 UTC, Vladimir Riha
Details
Log from Chrome net-internals (77.65 KB, application/octet-stream)
2013-01-22 13:25 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-12-14 12:18:51 UTC
Created attachment 129374 [details]
thread dump after hitting F5

If I run HTML file from IDE (new HTML project, all default), it takes really long time (~5-10 secs) before the temporary page

file:///C:/Users/hudson/AppData/Local/Temp/blank6534575675095003098.html

is replaced in Chrome with the actual file. Hitting F5 in Chrome brings the same poor performance. Simple reloading of the page on IDE's internal web server without NetBeans integration (so after the Chrome's "Extension is debugging page" is closed) is also slow and according to Chrome DevTools, it takes ~10sec until simple index.html page is reloaded.

This issue is not 100% reproducible, but seems to me that in most attempts, it is.


Notes:
- this happens in Windows8 in VirtualBox, I'm not sure if this could be related to either my Win8 only or to combination of Win8&VirtualBox
- it does not happen in Windows7 in VirtualBox, I could try it later on non-virtualized W7 but I think it will be fine as well
- I tried to make GET request for the same page using Chrome's extension [1]. The response time is ~20ms
- loading page running on embedded server is fast in Firefox/IE
- if I reload F5 the page in Chrome and simultaneously in Firefox, then reloading in Firefox is also slow (as if Chrome "makes it slower") and they both finish approx. at the same time
- I tried loading pages on Apache (XAMPP package) running on localhost but it is fast (so it is probably not related to network configuration?)

I'm attaching 2 thread dumps but I don't know if they'll be useful... I don't know where the problem is. It would be great if someone with non-virtualized Windows8 could try it. 



[1] https://chrome.google.com/webstore/detail/dev-http-client/aejoelaoggembcahagimdiliamlcdmfm?hl=en-US&utm_source=chrome-ntp-launcher



Product Version: NetBeans IDE Dev (Build web-main-9524-on-20121214)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)
Comment 1 Vladimir Riha 2012-12-14 12:19:45 UTC
Created attachment 129375 [details]
thread dump after running file from IDE in Chrome
Comment 2 Vladimir Riha 2012-12-14 12:23:44 UTC
Created attachment 129376 [details]
IDE log

IDE log from moment when page loading is finished in Chrome.
Comment 3 Vladimir Riha 2012-12-14 12:35:16 UTC
...reloading in embedded browser is fast as usual
Comment 4 David Konecny 2012-12-16 21:52:22 UTC
I have only Win7 in vbox so I cannot even test it. PetrJ, is there any way to request Win8 license for myself?

Vlada, it is hard to say where the problem might be. Especially if it works fine on Win7. Few things I would try:

* compare performance of "Chrome with NetBeans Integration" browser versus "Chrome" browser on F5. When testing it try to distinguish cases where: #1 chrome is not running at all; #2 warm up Chrome and NetBeans plugin first by running some other NB project.

One problem I've seen in the past on Win7 was that if proxy was misconfigured on OWAN then NB plugin in Chrome took 5-10seconds to start and connect to the WebSocket server running in the IDE. This should happen only on first page requiring "with NB integration?" - consequent pages opening was fast.

If the problem should be in internal Web Server then you could start IDE profiling before pressing F5 and take a snapshot after page loading in browser has finished.

If the problem should be in Chrome plugin then I usually debug it like this:
#1 restart NetBeans first to make sure internal WebSocket server is not running
#2 start Chrome; go to Extensions; click "Inspect Views" under NetBeans Connector; open Console
#3 Run some project from IDE
The last step should result into NB Chrome plugin to notice that a new tab was opened with tmp file. That is always quick and plugin tries to connect to the IDE and tell it about it via eg.

  Sent message: {"message":"init","url":"file:///tmp
                 /blank3281948603255079744.html","tabId":8,"version":"1.7.3"} 

which should instantly be followed by IDE response eg.

  Received message: {"message":"init","status":"accepted",
                     "tabId":8,"version":"7.3"} 

If there is a visible slowdown we could add more diagnostic messages into our plugin.
Comment 5 Vladimir Riha 2012-12-17 08:20:24 UTC
(In reply to comment #4)
> it is hard to say where the problem might be. Especially if it works
> fine on Win7

I know, it could be problem with my configuration as well

> 
> * compare performance of "Chrome with NetBeans Integration" browser versus
> "Chrome" browser on F5. When testing it try to distinguish cases where: #1
> chrome is not running at all; #2 warm up Chrome and NetBeans plugin first by
> running some other NB project.
> 

As I wrote, it is not always reproducible but I managed to get the slowdown even on reloading page that is running in "Chrome" (w/o NB integration). On Run action, it seems fine. The slowdown is reproducible also if I run page in Chrome with NB integration, break connection e.g. opening Chrome DevTools and then reload the page F5.

Sometimes I have to press F5 several times to see the slowdown, almost as if server is overloaded

Slowdown is visible also if some other project was already running in browser but probably it is not such a huge. Once I have to wait 24sec until the page was loaded (run action, with NB integration). I don't think there is much of a difference in case Chrome was not running at all or if it was running.

> One problem I've seen in the past on Win7 was that if proxy was misconfigured
> on OWAN then NB plugin in Chrome took 5-10seconds to start and connect to the
> WebSocket server running in the IDE. This should happen only on first page
> requiring "with NB integration?" - consequent pages opening was fast.
 
Happens not only on first page, but if I run project while some other is already running,


> If the problem should be in internal Web Server then you could start IDE
> profiling before pressing F5 and take a snapshot after page loading in browser
> has finished.
 
Attaching 2 snapshots - first running of file and then reloading F5 in browser, all with NB integration


>   Sent message: {"message":"init","url":"file:///tmp
>                  /blank3281948603255079744.html","tabId":8,"version":"1.7.3"} 
> 
> which should instantly be followed by IDE response eg.


These 2 messages seems instant. On F5 reload following message is printed to console:

Sent message: {"message":"debugger_command_response","tabId":8,"response":{"method":"DOM.attributeRemoved","params":{"name":":netbeans_highlighted","nodeId":38}}} 

After that, there is the slowdown and after some time, the first printed message is:

[see attachment]]


The fact that reloading seems to work fine in Firefox (I can't tell with embedded browser as either it is instant or I don't see any progress loading bar), it could be related to Chrome as such





Product Version: NetBeans IDE Dev (Build web-main-9541-on-20121216)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)
Comment 6 Vladimir Riha 2012-12-17 08:21:07 UTC
Created attachment 129431 [details]
the first message after page is loaded from Console
Comment 7 Vladimir Riha 2012-12-17 08:23:17 UTC
Created attachment 129432 [details]
reloading snapshot

snapshot taken just before starting reloading to moment when page was loaded
Comment 8 Vladimir Riha 2012-12-17 08:23:53 UTC
Created attachment 129433 [details]
run file snapshot

snapshot for Run file in Chrome with NB integration.
Comment 9 Petr Jiricka 2013-01-16 12:47:53 UTC
> this happens in Windows8 in VirtualBox, I'm not sure if this could be related to either 
> my Win8 only or to combination of Win8&VirtualBox

I tried on my personal Win8 machine at home, and the problem is also reproducible there.

> One problem I've seen in the past on Win7 was that if proxy was misconfigured
> on OWAN then NB plugin in Chrome took 5-10seconds to start and connect

This is not OWAN-related, I am trying outside of OWAN on a machine that was never connected to OWAN - always direct internet connection.

I'll try to dig more.
Comment 10 Petr Jiricka 2013-01-17 16:23:43 UTC
I have no idea why this is happening. On Windows 8, there seems to be an extra request - first time after the socket is created in org.netbeans.modules.web.common.api.WebServer.Server.run(), it takes 10 seconds to create a reader from this socket, see line 284:
                String line = r.readLine();

This is visible e.g. in attached snapshot reloadingFile in Thread-16.
After the line is read, it is null. And next time we read from a socket, it finally contains the GET request.

Although now I see that also on Mac I sometimes get null line, but this request does not block the others.
Comment 11 Petr Jiricka 2013-01-17 16:41:11 UTC
> This is visible e.g. in attached snapshot reloadingFile in Thread-16.

The IDE is stuck for 10 seconds in native method java.net.SocketInputStream.socketRead0()
Comment 12 Petr Jiricka 2013-01-17 18:04:57 UTC
I think something like this will be needed to make progress: http://stackoverflow.com/questions/1566234/sniffer-for-localhost-windows-os
Comment 13 Petr Jiricka 2013-01-22 13:25:27 UTC
Created attachment 130487 [details]
Log from Chrome net-internals
Comment 14 Petr Jiricka 2013-01-23 10:29:21 UTC
Fixed in trunk: http://hg.netbeans.org/web-main/rev/b847db1f6dc2

The patch was reviewed by Petr Hejl. Vlado, can you please verify so this can be transplanted to 7.3?
Comment 15 Vladimir Riha 2013-01-23 10:31:53 UTC
will do today, thanks
Comment 16 Vladimir Riha 2013-01-23 13:19:35 UTC
Page reloading is definitely way better in most cases "instant" but few times during common editing I encountered the slowness again (easy "fix" seems to be reopen browser tab). If increasing pool's size would help, I'd vote for it. 


I also tried to let the application running for few minutes and then save to refresh page in browser and I hadn't seen slowness caused by the "idle" time.


Product Version: NetBeans IDE Dev (Build web-main-9739-on-20130123)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)
Comment 17 Petr Jiricka 2013-01-23 15:46:24 UTC
Additional fix that increases the thread pool size to 10: http://hg.netbeans.org/web-main/rev/ac8302bc63fe
Comment 19 Quality Engineering 2013-01-24 00:54:20 UTC
Integrated into 'releases', will be available in build *201301232200* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/a05b44841271
User: Petr Jiricka <pjiricka@netbeans.org>
Log: #223840 - improving internal server performance on Windows 8 by making it multi-threaded so multiple requests can be processed at the same time.
Comment 20 Quality Engineering 2013-01-24 03:01:44 UTC
Integrated into 'main-golden', will be available in build *201301240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b847db1f6dc2
User: Petr Jiricka <pjiricka@netbeans.org>
Log: #223840 - improving internal server performance on Windows 8 by making it multi-threaded so multiple requests can be processed at the same time.
Comment 21 Vladimir Riha 2013-01-24 10:00:03 UTC
Verified in RC1. With the 2nd fix I can't reproduce the occasional slowness anymore.


Product Version: NetBeans IDE 7.3 RC1 (Build 201301232200)
Java: 1.6.0_38; Java HotSpot(TM) Client VM 20.13-b02
Runtime: Java(TM) SE Runtime Environment 1.6.0_38-b05
System: Windows 8 version 6.2 running on x86; Cp1252; en_US (nb)
Comment 22 David Konecny 2013-01-27 22:42:11 UTC
Thanks for fixing this Petr.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo