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

Deployment is taking too much time #5456

Open
5 tasks done
Atif-Sheikh opened this issue Apr 8, 2024 · 9 comments
Open
5 tasks done

Deployment is taking too much time #5456

Atif-Sheikh opened this issue Apr 8, 2024 · 9 comments
Labels
need-information Further information is requested

Comments

@Atif-Sheikh
Copy link

Check List

  • I have already read Docs page & Troubleshooting page.
  • I have already searched existing issues and they are not help to me.
  • I examined error or warning messages and it's difficult to solve.
  • I am using the latest version of Hexo. (run hexo version to check)
  • My Node.js is matched the required version.

Expected behavior

It should take less than 10 minutes

Actual behavior

Takes 40+ minutes for deployment and Blog generation.

How to reproduce?

hexo g

Is the problem still there under Safe mode?

Yes

Your Node.js & npm version

v18.19.0
10.2.3

Your Hexo and Plugin version

No response

Your package.json

No response

Your site's _config.yml (Optional)

No response

Others

No response

@Atif-Sheikh Atif-Sheikh changed the title Deployment is taking too much timr Deployment is taking too much time Apr 8, 2024
@stevenjoezhang
Copy link
Member

Currently, we are aware that in some cases, Hexo generation can be very slow: #2579 #4309
To answer your question, we need more information, such as whether your blog has a lot of articles or images?

@uiolee uiolee added the need-information Further information is requested label Apr 9, 2024
@Atif-Sheikh
Copy link
Author

Currently, we are aware that in some cases, Hexo generation can be very slow: #2579 #4309 To answer your question, we need more information, such as whether your blog has a lot of articles or images?

@stevenjoezhang We have around 600+ articles and yes every article has images as well.

@Atif-Sheikh
Copy link
Author

@stevenjoezhang Can we expect the fix from the Hexo ASAP as most of the users are struggling with this issue?

@stevenjoezhang
Copy link
Member

Did you encounter this problem after upgrading your Hexo version? As far as I know, slowdowns in generation time are not common, so I can't pinpoint the exact cause of this issue, nor do we know how to optimize it.
If possible, you can help us by conducting an experiment: run the command

npm i -g 0x
0x node_modules/.bin/hexo g

This command will generate an HTML file (flamegraph), and we can use this information to identify where the performance bottleneck is.

@yoshinorin
Copy link
Member

yoshinorin commented Apr 14, 2024

@Atif-Sheikh
As mentioned in comment #2579, almost certainly your environment will be speed improvement by deleting db.json before running hexo g or hexo s, as suggested if you're not using the id for persistence purposes.

Of course, these times will be influenced by machine specs, the theme you're using, and the plugins, but there's no doubt it speeds up the process.

There are no official Hexo plugins that use ids for persistence purposes, but we don't know about third-party plugins.

In fact, I've been deleting db.json before running hexo g and hexo s for quite some time, and it's quite effective. In my current environment, I have 1800 .md files and 1500 image files (jpg, png), and db.json is 37MB. Without deleting db.json, hexo g takes about 8 minutes to complete, but with it deleted, it finishes in less than a minute.

@Atif-Sheikh
Copy link
Author

Did you encounter this problem after upgrading your Hexo version? As far as I know, slowdowns in generation time are not common, so I can't pinpoint the exact cause of this issue, nor do we know how to optimize it. If possible, you can help us by conducting an experiment: run the command

npm i -g 0x
0x node_modules/.bin/hexo g

This command will generate an HTML file (flamegraph), and we can use this information to identify where the performance bottleneck is.

@stevenjoezhang Here is the flamegraph file, Please take a look at it and yes I'm using the latest Hexo version.

@stevenjoezhang
Copy link
Member

@Atif-Sheikh I found that the hexo-related-posts plugin accounts for nearly 30% of the processing time. You could try disabling this plugin first.

@stevenjoezhang
Copy link
Member

Additionally, the hexo-asset-pipeline also occupies a significant amount of processing time. This plugin has actually been deprecated by the Hexo team since 2022: https://github.com/hexojs/hexo-asset-pipeline. If you need to compress HTML files, I recommend using the hexo-optimize plugin, which uses a Rust-based HTML compression library for better performance. For image compression, you may need to look for other tools as alternatives.

@Atif-Sheikh
Copy link
Author

Additionally, the hexo-asset-pipeline also occupies a significant amount of processing time. This plugin has actually been deprecated by the Hexo team since 2022: https://github.com/hexojs/hexo-asset-pipeline. If you need to compress HTML files, I recommend using the hexo-optimize plugin, which uses a Rust-based HTML compression library for better performance. For image compression, you may need to look for other tools as alternatives.

@stevenjoezhang Thanks for spending time on this issue, I'll try the changes you suggested and will get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-information Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants