OutOfMemory Issue - Entity with Binary Data 

Hello everyone

We are facing a problem of OutOfMemory, and apparently is caused by some aggregates which use an entity with Binary data field. 

The idea is to isolate this field in a separated entity, but my question is if we can apply a temporary workaround using Advance Queries, to select only the fields that will be used removing the Binary Data Field.

Do you know if this approach could solve the performance issue?


Rank: #24

Hi Rafael, it's a matter of view state, the content that is used by the Application to control the state of the page. The less you bring to the browser to process the better, as a big view states demand time for the browser to process it.

When you include a Binary content, for instance a field in the DB, to an Aggregate and map it to a structure / list / local variable, it will bypass the platform's optimizer and be included in the view state, thus consuming resources. If you map the aggregate directly to a Table Records, the optimizer will do its job and discard the binary content from the view state. But I understand this not always is possible.

Best practice is to isolate the Binary field on a separate table, which is retrieved only when downloading the binary content to a file. Bear in mind that you wil need to build a Timer to transfer the content from the original table, and plan a future version to get rid of the current binary field from the DB after having refactored the application to stop using it.

As a work around, yes, an advanced query would avoid the binary field being loaded along with the view state. But, you know, someone else will build another aggregate and make the same mistake in the future... ;)

You can check it by analysing the size (number of characters) of the view state hidden field in the page's html source code.