Onlyoffice slow to open documents from Nextcloud

I’m running Nextcloud 20.0 from the nextcloud:fpm docker image. It is connected to Postgres and Redis, with nginx in front of it acting as a reverse proxy. All of this works fine. (Note: I can successfully open and edit the example Markdown files included in Nextcloud by default.)

I am also running a container with the onlyoffice/documentserver:latest image. It is also connected to Postgres (same server as above, but different database) and RabbitMQ. The container is up and running and does not report any errors in the logs.

Now, I try to open the 25KB Documents/Welcome to Nextcloud Hub.docx file that is present by default in my Nextcloud installation. OnlyOffice does load in a new tab, and shows me a “Loading document” spinner for a long time, then loads 6%, 13%, 25%… and there it hangs. I hit reload a few times, and it eventually opened the document. It was slow to open even with my earlier Nextcloud 19.x setup (I upgraded just a few minutes ago), but now it’s even slower.

Another problem: once the document is open, most of the words are underlined in red (see attached screenshot below). I assume these are to indicate spelling errors—but the documentserver’s spellchecker/*.log shows that spellchecker is running with no errors. Do I need to do something extra to make it work? (Note that some words like Hub, all, Access, manage are not underlined.)

On the index.php/settings/admin/onlyoffice page, I tried the “Connect to demo ONLYOFFICE Document Server” option. However, that makes it even slower, and I still have not been able to load more than 25% of the same 25KB document despite, again, waiting for several minutes and hitting reload a few times.

I am new to Nextcloud and OnlyOffice, but I have tried to find anything online that could help me with this problem, without much success. I would be grateful for any suggestions to debug and solve this problem.

Thank you.

Hi @Sei3aeng, please send your server specification.

It’s an i7-6700 CPU with 64GB of RAM running Debian, with the nextcloud:fpm container running under Docker 18.03.0-ce. The document that takes >5 minutes to open is only 25KB, so I very much hope my server specification is not at fault here.

Another observation: once the file opens, it’s relatively fast to close it and reopen it.

I uploaded a different .docx file to Nextcloud (21KB), and it was stuck at “27%” for a long time, but then completed after a few minutes, and now reopening takes only a few seconds.

Does that ring any bells for anyone? Is there a good way to tell exactly what documentserver is doing while it’s “Loading document”?

“Connect to demo ONLYOFFICE Document Server making it slower…” is strange. I would invetigate into your php “cache” and memory_size configuration. Did you check the log-file? Which webserver is running and are you able to send the php.ini ?

I’m using the default nextcloud:fpm docker image behind nginx, with php-fpm 7.4.11. Inside the nextcloud container, I see that memory_limit=512, and (builtin) opcode caching is enabled:

Other than this, it is using redis for caching:

root@cbc5dd7b7d25:/var/www/html# grep cache config/config.php
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',

There is no single php.ini file, but many files in /usr/local/etc/php/conf.d:

root@cbc5dd7b7d25:/usr/local/etc/php/conf.d# grep -h '^[^;]' *.ini
session.save_handler = redis
session.save_path = "tcp://redis:6379"

There are no error messages in the nextcloud or documentserver logs as far as I can see. Let me try to raise the log level.

Ok, now I remember. Please disable memcache in the nextcloud config.php and look what happens :wink:

I disabled memcache.local (but not memcache.distributed/locking), and the document loading did indeed become much faster. Thank you, @sambilanet! What is the explanation for this magic?

To be honest I don’t know. I’ve faced this problem and found a Link after days. Good Luck :slight_smile:

@sambilanet Unfortunately, although this seemed to help the problem initially, it has not actually solved it. I am still experiencing consistently slow initial loading times.

Is there any documentation about how exactly the document is loaded from Nextcloud?

Hmm… What is your actual Nextcloud Version ? As it is running stable, maybe you can upgrade to 20.0.1 first before we go any further?

Sorry, I forgot to mention that I had already upgraded to 20.0.1 and the latest version of OnlyOffice.