Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slower page saves with 1.7.6 — 30 secs for date md edit via Admin #3231

Closed
MattAppleton opened this issue Feb 19, 2021 · 24 comments
Closed
Assignees

Comments

@MattAppleton
Copy link
Contributor

MattAppleton commented Feb 19, 2021

I have noticed recently that a simple page edit (changing a date) is taking around 30 seconds to save?!

This site running

Grav v1.7.6
Admin v1.10.5
PHP Version 7.4.15 with plenty of memory allocated (1024MB)

The site does have a fair few pages — 734 at the minute... the page I was editing as an example here — but this applies to the whole admin it seems to be going pretty slow...

edit — changing plugin settings seems to save quickly, page amends are taking a long time to see... **

I was wondering if this was something to do with the admin plugin and associated cache? If I edit the page directly on the server via FTP it saves pretty much instantly...

thanks for looking

@mahagr
Copy link
Member

mahagr commented Feb 22, 2021

You could enable debugger and install clockwork into your browser to see what's taking the time. Additionally, you could also install PHP extension https://github.com/tideways/php-xhprof-extension which will provide data from the individual method calls.

Saving shouldn't take that much time, though it does clear some cache and also recreates index file, which can be pretty large with 1000+ items.

@mahagr mahagr self-assigned this Feb 22, 2021
@MattAppleton
Copy link
Contributor Author

MattAppleton commented Feb 26, 2021

SS- 2021-02-26 at 15 10 19

Hi @mahagr Here is a debugger screenshot when simply saving a css change on a fairly untouched local Typhoon install... is that helpful? Just looking at clockwork...

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Feb 26, 2021

So using Chrome and Clockwork now I am getting 35312ms in the log when it saves... not sure what I am looking for though that might point out what the issue is.

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Feb 26, 2021

All I am doing is adding a character to the text and hitting save! The thing that seems to be taking up all the time is loads and loads of 'onFlexObjectBeforeSave' — it seems GRAV is checking every page in the site?

SS- 2021-02-26 at 17 15 47

SS- 2021-02-26 at 17 21 09

@MattAppleton
Copy link
Contributor Author

MattAppleton commented Feb 26, 2021

trying to figure out the sharing... seems the logs are so big it kills Clockwork sharing!

@MattAppleton
Copy link
Contributor Author

Just the performance log: https://clockwork.underground.works/share/nbocwail

@mahagr
Copy link
Member

mahagr commented Feb 26, 2021

Check which plugins are using the event. You can do that by going to the events tab and finding the event from there. In the right there's a small arrow icon that will show the hooked up listeners.

@mahagr
Copy link
Member

mahagr commented Feb 26, 2021

Hmm, also.. Do you have all the pages at the same level? All visible?

@MattAppleton
Copy link
Contributor Author

This is an example page structure — I am trying to save (for example) news/general/item one of 335
Uploading SS- 2021-02-26 at 18.20.42.png…

@MattAppleton
Copy link
Contributor Author

Thing is, this is definitely a new issue with newer versions of Grav. Site was originally built by @rhukster :)

@mahagr
Copy link
Member

mahagr commented Feb 26, 2021

I just saved a page in 1800 pages in a single folder test site. Saving takes 300ms.

@MattAppleton
Copy link
Contributor Author

The thing that is clogging up 'events' is LOADS of 'onFlexObjectBefore / After Save entries...

https://clockwork.underground.works/share/ifedhqsm

@MattAppleton
Copy link
Contributor Author

The onFlexObject events seem to have no listeners then finally

AdminPlugin->onAdminAfterSave() GitSyncPlugin->onAdminAfterSave()

and then

GitSyncPlugin->synchronize()

(GitSync is set to NOT sync on page save tho')

@MattAppleton
Copy link
Contributor Author

SS- 2021-02-26 at 18 26 37

@mahagr
Copy link
Member

mahagr commented Feb 26, 2021

Looks like I can see the clockwork in the frontend. (BTW)

Can you contact me privately and send the installation to me, so I can take a look. This is clearly something I'm not able to reproduce locally.

@mahagr
Copy link
Member

mahagr commented Mar 1, 2021

I'm able to reproduce the issue.

@mahagr
Copy link
Member

mahagr commented Mar 1, 2021

@MattAppleton Can you try if everything looks good with above fix? Please test saving pages in the news as well as adding new pages to there.

@MattAppleton
Copy link
Contributor Author

Will do. Swapping out this file

system/src/Grav/Common/Flex/Types/Pages/PageObject.php

right?

@MattAppleton
Copy link
Contributor Author

So far that seems much quicker, now 6-7 secs per save...

@mahagr
Copy link
Member

mahagr commented Mar 1, 2021

Cool. I think you're also using gitsync, which also slows down saves. Let me know if you find any side effects from the fix.

@MattAppleton
Copy link
Contributor Author

I'll check that on live site ASAP. Does Gitsync slow things down even if the 'Automatic Synchronization Settings' are toggled 'off'? If so, I guess its best to disable Gitsync between development stages then?

thanks

@mahagr
Copy link
Member

mahagr commented Mar 1, 2021

It only slows the save when it pushes to the repository.

@w00fz
Copy link
Member

w00fz commented Mar 1, 2021

Automatic synchronization off won’t slow things down as no push will happen on save. Of course there will be the push time when you manually sync.

@rhukster
Copy link
Member

Released version should be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants