-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Question] Use Hexo for generate more than 10000 posts #2579
Comments
|
@NoahDragon Thanks for your reply. Can you make me some other suggestion based on this new information about my app? |
I have been through the same problem. In the end, we decided to get rid of some hexo-plugins like. |
@rahil471 Yes I checked my system monitor and it seems Hexo only use 1 CPU core. I have 4 core and one of my core increased until 100% but others between 2% to 19%. |
@mnlbox It's okay to put all configuration into the app _config.yml file, the theme configuration will fall back to the app when it is not set. @rahil471 I believe @tommy351 has tried the multi-cores approach but I don't know why he didn't continue, maybe creating multiple Hexo rendering instances may increase the complexity and maintenance efforts. I think it is a good approach, and may re-think about it. |
Maybe related: #2164 |
@NoahDragon I can build my site with Hugo in just 25 second. (with hexo my build not finished after 5 hour) |
@mnlbox Thanks for the info. I will take a look into Hugo, I'm assuming it uses multiple processors and the performance between javascript and go also impacts. |
@mnlbox did you tried the default theme without any plugin? (init a new site and copy your posts over) See discussion starting from here: |
@leesei Yes I also try default theme and also try remove unused plugins but it's not different for this issue. |
I have tested a site with 2000 posts, and found the following code was executed over 10k times, taking up 20% of the execution time of Lines 35 to 43 in 58a8f8c
One of the reasons is that queries ( Update: with 8000 posts, Update: I tried to disable CC @hexojs/core |
I have a site with over 1400 posts and almost 10K assets. It takes HEXO over 30 minutes to generate if I don't run |
|
I've been deleting My environment has 1800 As a result, it seems that toObject in the warehouse is taking time. |
So the culprit is the But here is a thing: JSON doesn't support circular reference, hence why the warehouse uses |
I have found some JSON libraries that handle circular references very well, such as flatter. However, switching the implementation of warehouse over to this would require a significant amount of manpower. |
In my own experiments, |
Below is my environment. I didn't include Hexo, Node version$ hexo -v
hexo: 7.1.1
hexo-cli: 4.3.1
os: win32 10.0.22631
node: 20.11.1
...
v8: 11.3.244.8-node.17 Machine Info
Dependencies// package.json
"dependencies": {
"hexo": "7.1.1",
"hexo-filter-nofollow": "2.0.2",
"hexo-generator-archive": "git+https://github.com/hexojs/hexo-generator-archive.git#master",
"hexo-generator-category": "git+https://github.com/hexojs/hexo-generator-category.git#master",
"hexo-generator-feed": "git+https://github.com/yoshinorin/_hexo-generator-feed.git#master",
"hexo-generator-index": "git+https://github.com/hexojs/hexo-generator-index.git#master",
"hexo-generator-sitemap": "git+https://github.com/yoshinorin/_hexo-generator-sitemap.git#master",
"hexo-generator-tag": "git+https://github.com/hexojs/hexo-generator-tag.git#master",
"hexo-html-minifier": "git+https://github.com/hexojs/hexo-html-minifier.git#master",
"hexo-pagination": "git+https://github.com/yoshinorin/hexo-pagination.git#my-site",
"hexo-renderer-ejs": "git+https://github.com/hexojs/hexo-renderer-ejs.git#master",
"hexo-renderer-markdown-it": "git+https://github.com/hexojs/hexo-renderer-markdown-it#master",
"hexo-server": "git+https://github.com/hexojs/hexo-server.git#master"
} ThemeI'm using a theme that I've delete many features from https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak. db.json size
Number of posts, assets etcPlease see
Appendix 1. (How to get number of x)const Hexo = require('hexo');
const hexo = new Hexo(process.cwd(), {silent: false});
hexo.init().then(() => {
hexo.load().then(() => {
const posts = hexo.locals.get('posts').toArray();
const postAsset = hexo.model('PostAsset');
let numOfPostAssets = 0;
let postContentTotalLen = 0;
for(let post of posts) {
const dir = post.path.slice(0, post.path.lastIndexOf("/"));
const assets = postAsset.filter(x => x._id.includes(dir));
numOfPostAssets = numOfPostAssets + assets.length;
postContentTotalLen = postContentTotalLen + post.content.length;
}
const pages = hexo.locals.get('pages').toArray();
const pageAsset = hexo.model('Asset');
let numOfPageAssets = 0;
let pageContentTotalLen = 0;
for(let page of pages) {
const dir = page.path.slice(0, page.path.lastIndexOf("/"));
const assets = pageAsset.filter(x => x._id.includes(dir));
numOfPageAssets = numOfPageAssets + assets.length;
pageContentTotalLen = pageContentTotalLen + page.content.length;
}
const tags = hexo.locals.get('tags').toArray();
const categories = hexo.locals.get('categories').toArray();
const routes = hexo.route.list();
console.log(`Number of posts: ${posts.length}`);
console.log(`Number of post assets: ${numOfPostAssets}`);
console.log(`Avg of post content length: ${Math.floor(postContentTotalLen / posts.length)}`);
console.log(`Number of pages: ${pages.length}`);
console.log(`Number of page assets: ${numOfPageAssets}`);
console.log(`Avg of page content length: ${Math.floor(pageContentTotalLen / pages.length)}`);
console.log(`Number of tags: ${tags.length}`);
console.log(`Number of categories: ${categories.length}`);
console.log(`Number of routes: ${routes.length}`);
});
}); Appendix 2. (How to get framegraph)
|
caused by hexo/lib/plugins/processor/post.ts Line 282 in 90b107c
|
Hi guys,
I have a big list of posts that I converted to markdown files from my previous web site. My post count in
_posts
directory now is near 10000 posts.I try
hexo server --debug
but it's not running after 15 minutes processing on a machine with 32 gig RAM and a SSD hard drive.I also try
hexo clean && hexo generate
but it's also not finish after 25 minutes.Now my question are:
The text was updated successfully, but these errors were encountered: