[MAGNOLIA-6623] Speed up DirectoryWatcher on OSX in developer mode Created: 04/Apr/16  Updated: 09/Feb/17  Resolved: 25/May/16

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.4.5
Fix Version/s: 5.4.7, 5.5

Type: Improvement Priority: Major
Reporter: Christopher Zimmermann Assignee: Jaroslav Simak
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: 0d
Time Spent: 0.25h
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-6500 Speed up DirectoryWatcherTest using O... Closed
relates to MAGNOLIA-6677 Remove FTL 5sec cache in Developer mode Closed
dependency
depends upon MAGNOLIA-6662 Investigate JVM crash - and if faster... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Documentation update required:
Yes
Date of First Response:
Sprint: Kromeriz 45
Story Points: 3

 Description   

With the default DirectoryWatcher on OSX, the system typically takes around 5 seconds to notice the changes and report to the console, but sometimes up to 9 seconds has been observed. This delay frustrates, slows down, and gives developers less confidence in Magnolia. Particularly with our emphasis, and frontend deveopers emphasis on speed. People have told me directly that they abandonded developing against magnolia because it appeared slow in general in contrast to the instant turnaround of developing against a frontend build system.

With the conference coming up with lots of workshops and demos, and a lot of focus from the community on this feature, it would make light development more convincing if this improvement was made.
Note - due to changes brought in by the linked ticket, the system ACTUALLY does apply the new files when you refresh a page - you just do not get the log messages until later. So you dont feel in touch with the system, and you are confused that the log messages come later.

When magnolia configuration "magnolia.develop" is true, the directory watcher should be speeded up, using the SensitivityWatchEventModifier if available.
In my tests this works very nicely during development.
(Tests on git branch feature/MAGNOLIA-6623-fast-dirwatch)

If there is some technical risk - such as the JVM core dump Jan mentions, then activate this feature with a new config property. Such as "magnolia.develop.fastresources".

See linked ticket for an implementation in a test class.

Implemented
In 5.4.7 this feature is activated by adding a property to the properties file:
magnolia.resources.watcher.sensitivity=high
(other available values are "medium" and "low".)



 Comments   
Comment by Jan Haderka [ 04/Apr/16 ]

Also note that it tends to cause intermittent JVM core dumps when used on Magnolia 5.4.5. on

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

If you manage to request resource before it is reloaded.
Not sure if due to making watcher faster or due some other changes introduced in 5.4.5.

Comment by Maxime Michel [ 10/May/16 ]

Excellent, thanks for making this happen. I vote for having this in - even as an experimental new config property. I will toy with it ASAP, but if it fixes the last remaining hiccups I was seeing when working on the Gulp live reload setup, then it's going to be a great asset for light development and showcases.

Comment by Michael Mühlebach [ 10/May/16 ]

Instead of having it just on a branch directly on the main level could you move it to featues/... and create a pull request. Helps to continue on this work.

Comment by Christopher Zimmermann [ 10/May/16 ]

OK - recreated branch with new name. Created https://git.magnolia-cms.com/projects/PLATFORM/repos/main/pull-requests/160/overview

Comment by Maxime Michel [ 11/May/16 ]

On my setup this doesn't seem to be making any improvement, actually.

Comment by Christopher Zimmermann [ 11/May/16 ]

It should improve speed of YAML def pickup. Or does it not improve that?
Im not sure if it would help with your FTL issue.

Comment by Christopher Zimmermann [ 12/May/16 ]

I won't close this yet - but I've just learned that the symptoms of slow loading of YAML changes are now gone in 5.4.7 and 5.5 due to
MAGNOLIA-6451 (https://git.magnolia-cms.com/projects/PLATFORM/repos/main/pull-requests/158/overview)

Comment by Christopher Zimmermann [ 12/May/16 ]

I still think we should make this improvement for the sake of the log messages which are a useful indicator to developers that the changes have been successfully registered. But this is a less important reason that the original problem of the system being slow to display the changes.

Comment by Martin Drápela [ 01/Jul/16 ]

Added the magnolia.resources.watcher.sensitivity property to the list at https://documentation.magnolia-cms.com/display/DOCS/Configuration+management#Configurationmanagement-Definingproperties

(An includable page explaining the property also exists now.)

Generated at Mon Feb 12 04:16:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.