High CPU when using redeploy feature

119 views
Skip to first unread message

Micah Smith

unread,
Jun 6, 2016, 12:35:24 PM6/6/16
to vert.x
Is anyone else getting crazy high CPU when using redeploy? The java process is using constantly >= 80% cpu when using redeploy, and virtually no CPU when not using redeploy feature.

Command im using:

java -jar build/libs/web-fat.jar --conf src/main/conf/config.json --redeploy="src/main/java/**/*.java" --on-redeploy="./gradlew shadowJar -x test"


Macbook Pro - OSX 10.11.2
Vertx - 3.3.0-SNAPSHOT    (I needed features in the latest redis-client, although i believe 3.2.x did it as well)
Single Vertical

Julien Viet

unread,
Jun 6, 2016, 4:21:05 PM6/6/16
to ve...@googlegroups.com
Hi,

can you record a Java Flight Recorder session and provide it ?

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/8158812d-47fa-48f4-a410-cb764ff6b8d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Clement Escoffier

unread,
Jun 7, 2016, 2:17:35 AM6/7/16
to ve...@googlegroups.com
Hi,

Here you are running gradle on every change, so yes it may take some CPU. You can configure the redeploy-scan-period and redeploy-grace-period to 1) avoid polling too much on the file system - this is useful if you have a large project, 2) avoid launching gradle too much (grace is the minimum time between 2 executions of the on-redeploy command).

Clement


Micah Smith

unread,
Jun 8, 2016, 10:35:05 AM6/8/16
to vert.x
@Julien
I attached the JFR here. I've never done one before but used this command:

java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=2m,filename=recording.jfr -jar build/libs/web-fat.jar --conf src/main/conf/config.json --redeploy="src/main/java/**/*.java" --on-redeploy="./gradlew shadowJar -x test"


@Clement

Its running ~80% all the time, not just when gradle is rebuilding. It stays at ~80% using an intellij idea launcher as well run with this:

run com.postsurge.web.MainVerticle --conf src/main/conf/config.json --redeploy=build/classes/main/**/*.class --launcher-class=io.vertx.core.Launcher -Dvertx.disableFileCaching=true

The redeploy-scan-period definitely brought it down, but still very high.
recording.jfr
Screen Shot 2016-06-08 at 9.26.25 AM.png

Micah Smith

unread,
Jul 27, 2016, 9:49:47 AM7/27/16
to vert.x
Ok, I've discovered this is because I have a ton of files (node_modules) in my webroot...After I remove them cpu is back down. Can someone explain whats going on and how to remedy this? The redeploy flag is set to 'src/main/java/**/*.java
So why does it matter if i have a lot of files in src/main/webapp? My gradle setup is setup like the example here (with shadowJar and run tasks)
https://github.com/vert-x3/vertx-examples/tree/master/gradle-redeploy





On Monday, June 6, 2016 at 11:35:24 AM UTC-5, Micah Smith wrote:

Micah Smith

unread,
Jul 27, 2016, 10:01:15 AM7/27/16
to vert.x
Update:
It actually runs with high cpu even when the webapp (and node_modules) are outside src, at the root of the project


On Monday, June 6, 2016 at 11:35:24 AM UTC-5, Micah Smith wrote:

Julien Viet

unread,
Jul 27, 2016, 3:09:28 PM7/27/16
to ve...@googlegroups.com
I just looked at the JFR and indeed it shows that the launcher Watcher spend lot of time there 

sorry I missed the JFR file… (somebody else could have look though…)


-- 
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.

Clement Escoffier

unread,
Jul 28, 2016, 4:07:42 AM7/28/16
to ve...@googlegroups.com
Hi,

 Can you tell me how many files you have in the watched directory.
I’ve tried with 30000 files and detect changes in less than a 500 ms.

We can optimize a bit by replacing the hash maps by another type, or use string as map key. But before that I will need to reproduce the issue as I don’t have it on mac and linux (hard for me to test on windows as it would be a virtual machine).

So if you can provide a reproducer with almost the same number of files you have and a similar structure it would be great.

Clement



clement escoffier

unread,
Jul 28, 2016, 6:51:51 AM7/28/16
to ve...@googlegroups.com
Quick update, I think I've found the issue. The watcher track all change of the current directory. It's not linked to the patterns. It should be changed.

Clement

Clement Escoffier

unread,
Jul 29, 2016, 6:00:57 AM7/29/16
to ve...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages