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

Are Contentful::File instances bloated? #224

Open
0xStarcat opened this issue May 15, 2020 · 2 comments
Open

Are Contentful::File instances bloated? #224

0xStarcat opened this issue May 15, 2020 · 2 comments

Comments

@0xStarcat
Copy link

Hello,

I noticed a potential issue when I was trying to debug a slow cache retrieval.

I accessed an instance of Contentful::Asset and called .file on it. The call returned a gigantic wall of text (longer than my console limit) which seemed entirely composed of references to other assets and entries in my contentful space. If these references are being cached / loaded, this could be a huge problem and maybe why my cache retrievals are slow.

Do you have any idea what this wall of references might be?

Using 2.13.3 of the gem

@0xStarcat 0xStarcat changed the title Are @asset.file objects bloated? Are Contentful::File instances bloated? May 15, 2020
@MGPalmer
Copy link

@0xStarcat Hello :) I've also been working recently on improving caching contentul data in our project. In our case, a big issue was that we had content that had self-references (i.e. a news article would have links to other news articles, which also linked news, etc.), and sometimes these unintentional "graphs" could grow to over 30MB of marshalled data :/

And of course it's hard to say what your output looks like without an example, but could it be that you're seeing the "ContentTypes" which are loaded automatically when you use "dynamic_entries: :auto"? If you have a big data model, those can look like a lot of data when you inspect the client.

@0xStarcat
Copy link
Author

I tried to parse my console output a bit more -- I can't pretty print it because it just goes off the end of my console screen! lol. It looks like the the big list of entries is under a key called :_entries_cache which is under a key :includes_for_single which is connected somehow to my gigantic file instances.

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

No branches or pull requests

2 participants