-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
(A) Search drop-down [incl 10 suggested article titles] (1) never appears, or (2) appears many seconds later, or (3) appears nearly instantly if you type BACKSPACE — or if you hit ENTER, ERR_CONNECTION_REFUSED is very common (B) SEARCH FAILS when search query is a Greek letter like "pi", "alpha", "beta" ETC #769
Comments
The problem is probably io speed, not cpu or ram size. On wikipedia_en_all_maxi_2020-08.zim the title xapian database is 2692521984 bytes so 2.5 GB. Xapian doesn't load all the database in memory. It loads a first part, start interpret it and load another part and so.... So the total time is probably less than 7 seconds but you need several seconds just for the IO. During this time, the frontend is waiting a answer and do not show the dropdown. It appears many second later, when the search complete and the frontend has results to show.
Xapian somehow have to load data for "AID" first to search (and load data) for "AIDS". So when you remove the S, the request for AID is faster as the AID "data" is already loaded.
You do another request for "AIDS". All the data is already loaded so the request is fast. What can we do ? Recent works on libzim API and libkiwix cache the searchers and searches. It helps to keep the parsed data in memory. But the loading of the "raw" data in ram is not really impacted. Even if create a new searcher, we can assume that kernel know what pages are loaded in ram and doesn't load them again. And if the memory is full (or any other reason), the kernel will discard pages even if a searcher is in cache on our side. Stop using cheap hardware :) (Yes, I know this is not the answer you want to hear, but it is an answer anyway) We can stop using xapian database for suggestion. We introduce xapian database here to have better results. But if user never see the results, they are not better. |
@mgautierfr that's a really great explanation (series of explanations!) Thank you. Xapian's entire ~2.5 GB doesn't need to be loaded into memory as you say — but if indeed Xapian requires large subsets of that to be moved across the computer's internal bus(es) that would indeed explain a lot 🤔 (And on the bright side, the better the pattern is understood, the more schools can try to adapt with such realities.)
Certainly the list of 10 suggested article titles will never be perfect — however this evolves year-by-year, as we know from things like kiwix/kiwix-tools#513 — and we will live with that, whatever's decided! 👍 |
@mgautierfr this might be unrelated — but schools perceive this to be very much related: Would you happen to know why about 30% of full-text searches (on Raspberry Pi, as described above, in essentially every school that uses them) fail completely, with the following message if using Chrome browser:
Reloading the page a couple times often works, i.e. forcing a 2nd attempt, or a 3rd attempt. This happens when there is no load on the Raspberry Pi 4 server, which has many GB of RAM available, and no other users during testing (which has reconfirmed this). In any case the failures appear to occur very consistently about 30% of the time — at completely random intervals. FYI this has been reconfirmed using unproxied URL's like the following example: NOTE: during testing it's important to use a new search query (search string, a.k.a. search pattern) every time, to avoid caching of prior search results. |
I propose to wait the libkiwix 10.2.0 release and test again with it. If it still fail, then we will try to investigate to get a clear reproduction case. |
I don't know why the connection is refused but there is another cause of slow down. By default, kiwix-serve use only 4 threads to answer requests. If the thread pool is full, connection are accepted by the httpd library but directly put in "wait state" until a thread is freed. I've just tested with several fulltext search (changing the pagination) on a zim file on a usb drive (for long io) and on the 6 requests with only 2 threads available, I've "succeed" to have one 500 error (to investigate) |
@mgautierfr We should implement #395 to avoid one thread to be occuped too long and assure a better distribution of threads usage. |
Thank you for the explanations & suggestions! Quick questions below:
Do you know if that applies when the user types in their search string very slowly — does this effectively launch 4 Xapian Title Searches — i.e. using up all 4 threads? Search strings longer than 4 letters might use up all threads if so, causing serious resource starvation — if slow typing really does exacerbate these problems ? (e.g. Is it important not to pause between each letter while typing in a search string?)
Good to know. Roughly when is that (likely) expected? |
I expect within a week. |
Just FYI all testing mentioned above was reconfirmed with kiwix-tools 3.2.0-4:
|
@holta Would you be able please to provide an update with kiwix-tools 3.3.0? Does it works better? |
For the moment I cannot reproduce the search drop-down's severe slowness on Raspberry Pi 4 with these 2 different versions of kiwix-tools — those were kiwix-tools 3.2.0-1 from 2022-02-02...
And kiwix-tools 3.3.0 from 2022-06-15...
On the own hand this appears to be good news. On the other hand, I'd like to understand why I (and others) had so much trouble with kiwix-serve 3.2.0-4 back in early May. I'll try to do more tests in coming days to see if this can be better understood. FYI both above tests used http://box/kiwix/wikipedia_en_all_maxi_2021-12/ |
@holta Do you use the same hardware (rpi+sd) as a few months ago? |
Yes. Strangely I also cannot reproduce the slowness when using kiwix-tools 3.2.0-4 just as in early May. But am using a different OS today: for the moment anyway I'm using the 32-bit Raspberry Pi OS on Raspberry Pi 4, whereas in early May I was using the 64-bit version of Raspberry Pi OS on Raspberry Pi 4. So hypothetically the slowness flaw might be arising from using armhf builds of kiwix-tools on 64-bit Raspberry Pi OS?? |
@holta Quite impatient to know more about your investigations :) |
The above symptoms are essentially/exactly as described in early May 2022, further up on this ticket (#769). Here is an ADDITIONAL (RELATED?) ISSUE... that appears extremely similar: (but might have a different root cause?)
RECAP / CLARIFICATIONS:
|
@mgautierfr Do you have all the material you need to try a reproduction case? |
@holta latest libzim/libkiwix/kiwix-tools are still not released yet, but will have to tackle this in the next months. Do you know at least if this still appear with latest nightly of kiwix-serve? |
Quick Tests: I can't reproduce the above with kiwix-tools nightly build 2022-10-24, with the latest Raspberry Pi OS: Search query "AIDS" is slow to appear, but appeared every time within about 5-10 seconds.
The above failure however DOES occur every time — EXAMPLE:
|
@mgautierfr Might that be that this ticket has been a duplicate of kiwix/kiwix-tools#573? For latest "pi" stuff stringly suspect a stopword on steeming which fails, what donyou think? |
@mgautierfr A feedback? |
I had a look to the problem with "pi" and the problem is related to wrong json escaping, see this:
and here with json integrety check:
@veloman-yunkan Would you be able to quickly fit that (and adapt the test)? In general I wonder that we have this kind of bug, we don't use an external primitive to do the json escaping?! |
@veloman-yunkan Any feedback? this seems to me to be a blocker for |
Everything should works fine now |
This irritating problem (appears) to affect all schools and everyone using very large ZIM files (on Raspberry Pi's especially?)
Specifically, this severe UX glitch occurs very often with very large ZIM files like https://download.kiwix.org/zim/wikipedia/wikipedia_en_all_maxi_2021-12.zim
What happens is that users browse to type in a search query into the top-right (e.g. of http://box.lan/kiwix/wikipedia_en_all_maxi_2021-12/) but the search drop-down menu very often never appears.
Or the drop-down appears Many Seconds Later — for no obvious reason (zero CPU load, and many gigabytes of RAM available, even when no others users are using kiwix-serve).
The problem occurs with any version of kiwix-tools (kiwix-serve) from recent years (including the very latest 3.2.0-4).
The problem occurs regardless if the https://internet-in-a-box.org is proxying kiwix-serve or if kiwix-serve if being accessed directly over port 3000.
Very Strange Workarounds:
While very useful, not every teacher and student can handle the above quirky workarounds :/
Does anybody have any idea what the root cause might be — for this very common usability glitch? Apologies I'm not sure exactly what the pattern is! But certainly it occurs very consistently and commonly despite the intermittent/random nature of the problem — this seems to affect all schools using very large ZIM files under these common conditions (on Raspberry Pi servers, no matter how recent or how old, the delay does not seem the be affected very strangely...)
BACKGROUND: This longstanding problem has been ongoing in recent years. I told schools that faster CPU's, more RAM and newer OS's would probably speed things up, such that this irritating delay (or the drop-down never appearing at all!) might effectively cease to be a problem.
I Was 100% Wrong: this confusing problem remains just as severe today in May 2022, even with massive amounts of RAM, fast SSD's instead of microSD cards, the fastest Raspberry Pi — and no matter whether using 32-bit or 64-bit Raspberry Pi OS Lite.
SIDE EFFECT: Many/most users end up doing Full-Text Search by accident. As they don't realize there's any other option — i.e. users often hit "Enter" after typing in a search query — as a result of the "10 suggestions" drop-down never having appeared.
The text was updated successfully, but these errors were encountered: