Closed Bug 1191718 Opened 9 years ago Closed 9 years ago

The new sync_projects.py script is slow

Categories

(Webtools Graveyard :: Pontoon, defect)

defect
Not set
normal

Tracking

(firefox42 affected)

RESOLVED FIXED
Tracking Status
firefox42 --- affected

People

(Reporter: mathjazz, Assigned: osmose)

Details

Attachments

(2 files, 1 obsolete file)

Attached file timings.txt
There's only one project using the new sync script that is big enough to measure timing (Mozilla.org). It takes 7-8 minutes to sync with the old method and more than double the time with the new one.
Assignee: nobody → mkelly
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/88af74b2549217370e2ed065d234782ba1fdfa63
Bug 1191718: Track Entity.has_changed status in the database.

Instead of querying for translations every time we need to see if an entity has
changed for a particular locale, we instead store whether the entity has changed
in the database whenever translations are saved. This significantly speeds up
sync_projects by removing a ton of unnecessary database queries.

Since this replaces what Project.last_synced was used for, we remove that field.
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/2ef6a9dc0d800c2328e2f42489901d3d433a851f
Bug 1191718: Only update DB during sync when necessary.

Uses django-dirtyfields to determine if an Entity or Translation has actually
changed, so that we only update the database in cases where changes are
necessary rather than blindly updating all the time.
According to mathjazz the sync time for Mozilla.org went down to as low as 3 minutes, but that may be dependent on how many strings are being updated or committed. Either way there's been improvement.

The last fix I'm working on before calling this bug resolved is to avoid updating a project/locale altogether by tracking the last VCS revision checked per project (or per locale for projects with multiple repos) and skipping sync if the project has no changes and the revision hasn't changed.
Attached image timings2.png (obsolete) —
Yes, the entire sync time for all 7 .lang projects has been reduced significantly. Great work!
Attached image timings2.png
I meant this.
Attachment #8644822 - Attachment is obsolete: true
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/53529a8fac1a9724c60d68a39eef9743e408a978
Fix bug 1191718: Don't sync when there are no changes.

Now we track the revision number/hash from the last time we synced, and
use that to determine if VCS has changed since the last sync. If not,
and there are no changes in the DB, we can skip syncing completely.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: