laravel-mongodb-sentry icon indicating copy to clipboard operation
laravel-mongodb-sentry copied to clipboard

Resource Usage / Large Document Size

Open hackel opened this issue 6 years ago • 0 comments

The way Sentry works with Laravel-MongoDB is not very efficient for storing group membership because of the way the belongsToMany relationship is handled without using a pivot table. This is a rather serious flaw in this combination. For example, one of my projects has a default user group that has over 150k elements in its "user_ids" array. The document size is already up to 5 MB, and eventually might hit the MongoDB hard size limit of 16 MB per document. In addition, it requires loading the entire document at once, as opposed to being able to only load those records we are concerned with. Presumably this all is getting cached in RAM as well, leading to excessive memory usage.

The best solution is probably to change the relationship to User hasMany Groups, which means any search for users in a particular group is going to be slow, but seems like a worthy trade-off. Indexing might even mitigate this issue.

Is there any interest in working on this? Sentry is very old and unsupported now, but until I can get a budget to replace it, I'm stuck. I welcome any thoughts on this issue.

hackel avatar Mar 17 '18 23:03 hackel