0

I have an application with two AppDomains. One of these AppDomains dynamically loads DLLs which do some calculations and produce a large amount of output data (stored in an EntityFramework EntityObject).

Thus far, I have just been "returning" this EntityObject to the other AppDomain when it calls the appropriate method. Of course, in reality, this is serializing the EntityObject and all of its data. As the amount of data this object holds has grown, this process has become a huge bottleneck in the application (sometimes taking minutes to serialize and deserialize).

I've seen in another StackOverflow post that the MemoryMappedFile might be a solution, but I'm not sure of the semantics to serialize and deserialize an object this way, and even if this is the best solution. I've also seen elsewhere that wrapping in an ObjectHandle supposedly allows the data to be shared in memory, but that didn't work when I tried it.

Thanks for any help.

MgSam
  • 12,139
  • 19
  • 64
  • 95

1 Answers1

1

As this answer suggests, serialization/deserialization generally cannot be avoided without a lot of refactoring. If your bottle neck is I/O, memory mapped files can help. However, if the bottle neck is CPU time spent serializing and deserializing, then try using a faster serialization method, such as Protobuf.Net.

Community
  • 1
  • 1
Diego
  • 18,035
  • 5
  • 62
  • 66
  • How can I move the data across AppDomains using this serializer? Do you have an example? – MgSam Mar 21 '12 at 14:09
  • I know this is old, but here is new sights on this problem. Try to use WCF services or depracticated MarshalByObjectRef. In case of WCF you would probably use named pipes service/client endpoint configuration with bidirectional communication (I presume that you want to keep sync objects)... on other hand MarshalByObjectRef is kept for backward compatibility and there is nothing wrong continue using it, and I doub't that it will be removed from any new .NET framework. WCF named pipes example http://goo.gl/vEo74e and for MarshalByRef http://goo.gl/JdJViR – Milan Jaric Aug 03 '13 at 14:39