c# - Entity framework remove object from context, but not from database -


i working on batch process dumps ~800,000 records slow legacy database (1.4-2ms per record fetch time...it adds up) mysql can perform little faster. optimize this, have been loading of mysql records memory puts usage 200mb. then, start dumping legacy database , updating records.

originally, when complete updating records call savecontext make memory jump ~500mb-800mb 1.5gb. soon, out of memory exceptions (the virtual machine running on has 2gb of ram) , if give more ram, 1.5-2gb still little excessive , putting band-aid on problem. remedy this, started calling savecontext every 10,000 records helped things along bit , since using delegates fetch data legacy database , update in mysql didn't receive horrible hit in performance since after 5 second or wait while saving run through update in memory 3000 or records had backed up. however, memory usage still keeps going up.

here potential issues:

  • the data comes out of legacy database in order, can't chunk updates , periodically release objectcontext.
  • if don't grab of data out of mysql beforehand , instead during update process record, incredibly slow. instead grab beforehand, cast dictionary indexed primary key, , update data remove records dictionary.

one possible solution thought of somehow free memory being used entities know never touch again since have been updated (like clearing cache, specific item), don't know if possible entity framework.

does have thoughts?

you can call detach method on context passing object no longer need: http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.detach%28v=vs.90%29.aspx


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -