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

Document problems #448

Merged
merged 1 commit into from
Apr 6, 2020
Merged

Document problems #448

merged 1 commit into from
Apr 6, 2020

Conversation

kirs
Copy link
Contributor

@kirs kirs commented Apr 3, 2020

There's some context around "what's bad with IDC" at Shopify. I wanted to take a step at documenting some of those to make it easier to pass to other people on the team. I preferred to have it as a markdown file within this public repo for better discoverability, compared to having it as a private doc at Shopify that might get lost.

I also tried not to get into what would be solutions for those problems because there's too many possibilities :)

Copy link
Contributor

@hkdsun hkdsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for this.

PROBLEMS.md Outdated

For [god objects](https://en.wikipedia.org/wiki/God_object) (like the Shop model at Shopify), it’s typical to have many associations. It’s for developers appealing to embed many of those associations into the god model’s IDC blob with `cache_has_many :images, embed: true`. As a side effect, over time the god model’s IDC blob may grow over the top. It gets even worse when some of the embedded records get larger, and the total IDC blob gets into as much as a megabyte in size. This puts pressure on both the application and memcached, because the blob needs to be serialized and unserialized each time and transferred over the network.

## Overfetching
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a separate issue? It seems like another issue that comes from embedded associations.

Another possible issue that can come from embedded associations is that cache invalidations for a model can be amplified by the number of models that embed them. This can further aggravate the large cache blob problem by embedding an association that gets invalidated more frequently.

PROBLEMS.md Outdated

If that key associated with a record becomes busy and hot, that memcached instance will become saturated on the network and the number of bytes that it can send out. In cloud environments, it’s a limit that is easy to hit.

## Thundering herd
Copy link
Contributor

@dylanahsmith dylanahsmith Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one seems like it is more clearly just an issue that needs fixing. We even have a pull request with a possible fix (#373). So why document it here instead of as a github issue? You can always reference issues from the documentation

Co-Authored-By: Hormoz Kheradmand <[email protected]>
@kirs
Copy link
Contributor Author

kirs commented Apr 6, 2020

Thanks for feedback, I've addressed all points.

I also renamed the file to CAVEATS.md (thanks to Hormoz for helping me to pick a better word)

Copy link
Contributor

@hkdsun hkdsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to have these documented 👌

@kirs kirs merged commit aaa3f4e into master Apr 6, 2020
@kirs kirs deleted the problems-doc branch April 6, 2020 14:29
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems April 6, 2020 14:36 Inactive
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