rebuild_artefact_parent_cache_complete running out of memory

Bug #820727 reported by Richard Mansfield
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Richard Mansfield

Bug Description

See the following thread: http://mahara.org/interaction/forum/topic.php?id=2645

That rewrite held the memory limit problem at bay for a little while, but now with a bigger artefact table (~300000 rows) cron.php is running out of memory again.

rebuild_artefact_parent_cache_complete() should be modified so it reads the artefact table a bit at a time, instead of all at once.

Changed in mahara:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Richard Mansfield (richard-mansfield)
milestone: none → 1.5.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/561
Committed: http://gitorious.org/mahara/mahara/commit/28599c24a22d6a5b09b972ecbd68793ce16dc7aa
Submitter: Hugh Davenport (<email address hidden>)
Branch: master

commit 28599c24a22d6a5b09b972ecbd68793ce16dc7aa
Author: Richard Mansfield <email address hidden>
Date: Thu Aug 4 15:21:30 2011 +1200

    Read artefact table in chunks when rebuilding parent cache (bug #820727)

    The cron job to rebuild the artefact_parent_cache table uses all the
    available memory when the artefact table gets big, so it needs to read
    it in in smaller chunks.

    This version of the function ensures that all artefacts with the same
    owner are read in at the same time, which means all artefact parent
    relationships are available.

    See http://mahara.org/interaction/forum/topic.php?id=2467 and
    http://mahara.org/interaction/forum/topic.php?id=2645 for more
    details.

    Change-Id: I459a2d4a9637716809476c5547bdf1ab7e81f0d4
    Signed-off-by: Richard Mansfield <email address hidden>

Changed in mahara:
status: Confirmed → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/918
Committed: http://gitorious.org/mahara/mahara/commit/042f0da9f4ce0cfd4f1b2e7806fa36ca90fde541
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 042f0da9f4ce0cfd4f1b2e7806fa36ca90fde541
Author: Richard Mansfield <email address hidden>
Date: Fri Dec 9 14:02:09 2011 +1300

    Limit parent cache artefacts processed at one time (bug #820727)

    In commit 28599c24a22d6a5b09b972ecbd68793ce16dc7aa, the
    rebuild_artefact_parent_cache_complete cron job was rewritten to
    process artefacts in groups of 5000 owners. This limit is too high;
    I've seen the cron script run out of memory when trying to process
    ~50000 artefacts in memory at once.

    This change makes the memory usage more predictable by trying to limit
    the number of artefacts pulled into memory rather than the number of
    owners, which is often not a good approximation.

    Change-Id: If63dec213e9794e86f37461166eb0530a407e086
    Signed-off-by: Richard Mansfield <email address hidden>

Melissa Draper (melissa)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.