Disable search result in dropdown due to poor DB performance


#1

Is there any way we can disable search results in dropdown as you are typing? Tried to locate if there’s any setting in admin, but found none.


(Jeff Atwood) #2

No – why would you want to disable basic expected functionality?


#3

Because while you type and pause, it queries database. We don’t want that. We want users to complete typing and press enter so they land in Search results for ‘***’ - Discourse Meta page. We don’t want them to directly go to the topic page. It also creates extra load on servers. For example, I want to search for “wordpress plugin issue”. I type “wordpress plugin” and wait few seconds and it queries database, then again I type “issue” and wait for few seconds, it queries db again and then I press enter! There’re thousand of reasons someone might wait few seconds before typing whole search term.


(Jeff Atwood) #4

There are no plans for this change at the moment.


(Ultra Noob) #5

I love this Auto complete style feature, help me to find any useful content quickly while interlinking for better SEO. I do not support change for this.


(Mittineague) #6

I don’t think I would want it eliminated either. True, it does increase resource use. But the convenience it provides is well worth it IMHO. And the behavior has become standard to the point were I think users expect it.

Perhaps a compromise could work? i.e. instead of doing the magic after a few characters have been entered into the input, hold off until more have been entered?

My question is, has this feature been shown to be an actual problem, or is it only an imagined problem?


#7

I’m just trying to find out if there’s any way to disable it. Maybe by using a plugin? We have a very high traffic site and our site is highly dependent of search. It crashed under load so we thought if we can disable it, it might help a little bit.

We are also trying to figure out if we can integrate Elasticsearch with Discourse. Any suggestion regarding that will be highly appreciated.

@Gulshan_Kumar
I’m not requesting Discourse guys to remove that ajax style dropdown completely from Discourse for everyone! Just asked if there’s any option to enable/disable it.


(Mittineague) #8

Not in any Core code. But that doesn’t mean there can’t be a plugin or custom code that would alter the functionality of the feature.

I would not want to do this so it isn’t something I’ve looked into doing. My guess is it might be as simple as swapping out one event for another.


(Sam Saffron) #9

Technically this can be done in a theme component, if you really want this open a post in #marketplace

I guarantee someone can do it for $10,000, someone may be able to do this for $500 it is highly unlikely anyone would do this for $50


#10

Thanks for mentioning #marketplace. I will try there.

Here’s some info about my site and server.

Discourse 2.1.1 (Docker installation)
System OS: Ubuntu Server 16.04 LTS

Searching with small word (4 to 8 chars) takes longer time to return result compared with long words/sentences.

This is the error: “Due to extreme load, this is temporarily being shown to everyone as a logged out user would see it.”.

Dedicated server configuration:
Intel® Xeon® CPU E5-1650 v3 @ 3.50GHz
Cores : 12
RAM: 128GB
Disk: 450GB

app.yml params:
db_shared_buffers: “16384MB” (I just reduced it to 4096MB to check if it’ll do any good)
db_work_mem: “64MB”
UNICORN_WORKERS: 18

Any help/suggestion will be highly appreciated towards overcoming this issue.


(Jay Pfaffman) #11

I think that you want to increase db_work_mem, perhaps to 128MB.


(Rafael dos Santos Silva) #12

Is this fast SSDs or slow spinning disks?

How big is the database?


#13

Thanks, Jay. Just did that.


#14

Hi Rafael, thanks for your reply. Yes, it’s Fast SSD. DB size is 70GB!!


(Rafael dos Santos Silva) #15

I recommend:

  • min search term length increase this to 4 or 5

  • search prefer recent posts enable this

If the problem persists:

  • search recent posts size try making this smaller

And if you wanna go nuclear and get rid of all this search-related load:


#16

“min search term”, I already increased it to 5.
“search prefer recent posts”, enabled that too before.
“search recent posts size”, didn’t modify that before. Setting it to 50000.

Looking into Algolia. Thanks again for so much info. :heart_eyes:


#17

After adjusting all these settings, it’s still not helping. CPU usage is very high and database is using all CPU power. I am looking for alternative. Thanks, everyone.


(Jeff Atwood) #18

Did you try rebuilding your database indexes? We have seen some databases get into a bad state perf wise when the indexes / statistics are poor. Try Postgres vacuum full as well.