V8-archive: Updating translations extremely slow

Created on 11 Nov 2019  ·  11Comments  ·  Source: directus/v8-archive

Bug Report

Hi, I am having some trouble with the response times saving translation interface.
I have a collection with translation interface (13 translations) each with cca 15 fields and updating the collection takes really long time. I was able to locate the major slowdown in the call $relationalCollectionData = $this->findByIds(...) in two nested foreach loops in validateAliasCollection(...) function in ItemsService.php. I didn't get much further from here, is there some way to optimize this? I also noticed that the APP sends to update array of all the translations and all their fields even though they didn't update (only one field in one translation updated for example)

Steps to Reproduce

I am attaching whole directus DB dump of a MWE setup, login is: [email protected] / directus
DB dump to download: http://bit.ly/2Cynbes

Login, go to Country collection, select Portugal, update one translated field (any) and press save.

Expected Behavior

Collection to be saved in reasonable time

Actual Behavior

Saving takes over a minute (can timeout on webserver if not configured for longer timeout)

Other Context & Screenshots

DB Dump to download: http://bit.ly/2Cynbes

Technical Details

  • APP Version: 7.11.0
  • API Version: 2.6.0
  • Device: Desktop
  • OS: Windows 10.1803
  • Web Server: nginx 1.17.5
  • PHP Version: 7.3.10
  • Database: MySQL 5.7.22
  • Install Method: docker
bug

Most helpful comment

Can confirm, I updated the pods to 8.3.1 and while in some pages still takes a bit to change, it works flawlessly. Looks like @rijkvanzanten job paid off :) good job!

IMO we can close this.

All 11 comments

How did you configure the webserver to avoid timeout @blackfox00 ?
I'm trying adding this to my k8s, but the error only changed to the following screenshot:

          lifecycle:
            postStart:
              exec:
                command: ["/bin/sh", "-c", "php-ini-add 'upload_max_filesize=20M' && php-ini-add 'post_max_size=20M' && php-ini-add 'max_execution_time=360'"]

image
This is a big issue for us, at the beginning we didn't have any errors but now almost every collection suffers from it and we cannot use the app.

Any suggested workarounds @rijkvanzanten ?

There are too many variables in web server configuration for me to have a catch-all answer for your specific timeout issue. As for the OP, I've updated the translations interface to be better optimized in v8.3 on the front-end, but that doesn't touch the recursive loops in the API.

@bjgajjar could you research what's going on in there and how we can optimize this? Saving the amount of data mentioned shouldn't cause any slowdowns in the API.

If you need more details, feel free to reach me on the slack. This is one of our main pain points.

While we can and will look into optimizing the API, I'm afraid there's nothing we can do to help debug your specific load balancer setup in k8s.. There must be something going on where your load balancer quits the request on a very small timeout, or maybe stops the request because it notices a spike in CPU usage.

You're too quick :P, I came back to delete the comment because it doesn't work via cURL either, looks like either someone else updated it or it got updated after some time :/

In k8s we use a pretty simple config but will keep looking into it to see if we can fix it from our end

@blackfox00 - Can you please provide the SQL dump again?

DB dump to download: http://bit.ly/2Cynbes

This link has been expired.

I also have the same situation.

Steps to Reproduce
login is: [email protected] / @admin
DB dump to download: https://gofile.io/?c=VPOLcm

Login, go to About collection (Về chúng tôi), select 'Tiếng việt', update one translated field (any) and press save.

Technical Details
APP Version: 7.11.0
API Version: 2.6.0
Device: Desktop
OS: Mac Os
Web Server: Apache
PHP Version: 7.1
Database: MySQL 5.7.22
Install Method: Mamp Pro

@bjgajjar can you help me?

@s5k - I'm not able to download the SQL dump. Can you please provide it on slack?

image

I just wanted to say that using version 8.3 solves this for me. The saving time is now about 2 seconds which is good enough for me

Can confirm, I updated the pods to 8.3.1 and while in some pages still takes a bit to change, it works flawlessly. Looks like @rijkvanzanten job paid off :) good job!

IMO we can close this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwkellyiii picture jwkellyiii  ·  3Comments

24js picture 24js  ·  3Comments

gitlabisbetterthangithub picture gitlabisbetterthangithub  ·  3Comments

benhaynes picture benhaynes  ·  4Comments

ondronix picture ondronix  ·  3Comments