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

Infinite loop / stuck process printing response to stdout / console #124

Closed
steakchaser opened this issue Mar 9, 2017 · 3 comments
Closed
Assignees
Labels

Comments

@steakchaser
Copy link

Hi. We have a content structure that contains possible circular references. i.e. Entry 1 -> related entries -> Entry 2 -> related entries -> Entry 1

In the API call, we are specifying an include = 3, so technically this circular referencing should be terminated after 3 levels deep. The API call works fine and we can parse the response fine in code. BUT, if you attempt to puts the response object client.entries to the console, it hangs.

Any thoughts?

@dlitvakb
Copy link
Contributor

dlitvakb commented Mar 16, 2017

Hey @steakchaser,

Which version of the SDK are you using? If using master, please update to the latest version of master, and reduce the client configuration parameter max_include_resolution_depth to a value equal or greater than your maximum include level. This will avoid resolving circular references for a long time.

The current default level is 20, and if you have circular references, on just 2 entries, this process can take up to 6 seconds, if the circularity is more complex, the time grows exponentially, and that's why you seem to notice the process being "stuck". I did a benchmark with 30 entries all pointing to each other with the default value, and took over 6 minute on a 2015 MacBook Pro with all maxed out specs to finish resolving the tree. When changed the default value to 5, thus limiting greatly the size of the resolution tree, the resolution took less than 3 seconds on average.

This only occurs when having circular references, on any other case, the value of 20 as a default is a completely sane default, which allows elements on the max API-level include (10) to have back references and have the SDK properly resolve them. Having no performance issues in several load tests.

If you are using a lower include level (but have circular references), feel free to reduce it to a number that makes sense to you, and this will drastically improve performance.

Please let me know if this helps,

Cheers

@steakchaser
Copy link
Author

@dlitvakb Thanks for that! Works great. Definitely looking forward to this being in the next release. Nice work.

@dlitvakb
Copy link
Contributor

dlitvakb commented Apr 4, 2017

This has now been released.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants