XF 2.3 Problems rebuilding search index on a large site

Jon12345

Well-known member
Licensed customer
I just completed a migration from an old Knownhost server to a new Knowhost server. The elasticsearch was setup on the new server. But, when I try to rebuild the search index via cli or the Xenforo backend, it ends up crashing. It could be a RAM issue perhaps.

I've been using: /usr/local/php83/bin/php cmd.php xf-rebuild:search

Is there any way to do this without running out of RAM? Or is it some other issue?

I have 1.7M posts.
 
Is there any way to do this without running out of RAM? Or is it some other issue?
Probably would be a good idea to include how much ram you've allocated and perhaps the settings you're using for Elasticsearch. (total ram on server and what you have allocated in the ES server config, etc.) And what's the evidence of the crash? A log entry? or are you observing the ES instance crash out directly?

It very well could be a ram issue, it can get quite thirsty. And just to check all of the boxes, double check your available disk space.
You'll see in other information that the recommendations for ram are 50% of the server's memory with a max heap size of about 31gb.
 
I just completed a migration from an old Knownhost server to a new Knowhost server. The elasticsearch was setup on the new server. But, when I try to rebuild the search index via cli or the Xenforo backend, it ends up crashing. It could be a RAM issue perhaps.

I've been using: /usr/local/php83/bin/php cmd.php xf-rebuild:search

Is there any way to do this without running out of RAM? Or is it some other issue?

I have 1.7M posts.
Yeah this is pretty normal on a big site rebuilding the search index is one of the heaviest jobs XenForo does, so it can feel like it’s crawling or even stuck when it isn’t.

First thing I’d say is don’t run it through the browser. Use CLI instead

Code:
php cmd.php xf-rebuild:search

That alone usually makes a big difference as it avoids timeouts and overhead from the web side.
If it’s still slow, try increasing the batch size a bit.

The default is quite low, so on decent hardware you can push more items through each run and speed it up.

Also depends what you’re using for search. If it’s just MySQL fulltext and you’ve got a large amount of posts, it’s always going to be slow. That’s where most larger forums switch to Enhanced Search (Elasticsearch) because it handles indexing way better at scale.

If you’re already on Elasticsearch and it’s struggling, I’d be looking at server resources or timeouts (memory, CPU, or even connection issues if it’s not running locally).

Other than that, it mostly comes down to size of the forum + server performance. On big installs it can just take a while to pass through everything.
 
Probably would be a good idea to include how much ram you've allocated and perhaps the settings you're using for Elasticsearch. (total ram on server and what you have allocated in the ES server config, etc.) And what's the evidence of the crash? A log entry? or are you observing the ES instance crash out directly?

It very well could be a ram issue, it can get quite thirsty. And just to check all of the boxes, double check your available disk space.
You'll see in other information that the recommendations for ram are 50% of the server's memory with a max heap size of about 31gb.
My hosts support team says there isn't enough RAM. I currently have 6GB. Since I only really need to build it once, I presume I can just upgrade my hosting to 8b RAM, rebuild the cache, and then downgrade again to 6gb RAM. Or at least I hope that would work. Crash evidence is in terminal it says killed. And site freezes, until killed appears. I used AI to reduce the amount of RAM elasticsearch uses, but it was not enough.
 
Yeah this is pretty normal on a big site rebuilding the search index is one of the heaviest jobs XenForo does, so it can feel like it’s crawling or even stuck when it isn’t.

First thing I’d say is don’t run it through the browser. Use CLI instead

Code:
php cmd.php xf-rebuild:search

That alone usually makes a big difference as it avoids timeouts and overhead from the web side.
If it’s still slow, try increasing the batch size a bit.

The default is quite low, so on decent hardware you can push more items through each run and speed it up.

Also depends what you’re using for search. If it’s just MySQL fulltext and you’ve got a large amount of posts, it’s always going to be slow. That’s where most larger forums switch to Enhanced Search (Elasticsearch) because it handles indexing way better at scale.

If you’re already on Elasticsearch and it’s struggling, I’d be looking at server resources or timeouts (memory, CPU, or even connection issues if it’s not running locally).

Other than that, it mostly comes down to size of the forum + server performance. On big installs it can just take a while to pass through everything.
Yes, done via CLI. Need to upgrade the RAM just to do the rebuild. Then lower it again.
 
what does your jvm.options look like? there's probably ways to not have to buy resources. you just need to spread the load out over more time and less concurrency.
 
Back
Top Bottom