Skip to content
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

Use batch processing methods in Hierarchy Maintenance when looping through database records #258

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

nbekirov
Copy link

The problem

I'm migrating from system where my model already has aparent_id column so following the documentation when I tried running Tag.rebuild! to have my tag_hierarchies table truncated and rebuilt I got an error.

Initially this resulted in Java::JavaLang::OutOfMemoryError: GC overhead limit exceeded (with the default JVM heap size of 512MB).

A solution

Expanding the memory via JRUBY_OPTS=-J-Xmx32G did the trick and rebuild! passed successfully but with ever expanding heap.

You can take a look of this jvisualvm screenshots made before the proposed change:

local-32g-monitored-index

and after:

local-32g-monitored-index-limit

This even allows my 512MB setup to succeed:

local-512mb-default-index-limit

Context

  • My test database is populated with ~49k nodes that results in ~240k rows hierarchy and is roughly 10 times smaller than production.
  • The setup:
    • macOS Sierra 10.12.3, 3.5 GHz Intel Core i5, 8 GB 1600 MHz DDR3
    • jruby-9.1.2.0
    • PostgreSQL 9.6.2

@mceachen mceachen merged commit 1a847c3 into ClosureTree:master Mar 17, 2017
@mceachen
Copy link
Collaborator

This was so nice I pushed a new version. Thanks for v6.5.0!

@nbekirov nbekirov deleted the rebuild_in_batches branch March 20, 2017 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants