开发者

Moving data across the appdomain with good performance?

A little background

I'm working on an .net application that's uses plugins heavily, the application can request data from the plugins that is then sent back and displayed by the application.

First I implemented the plugin framework in MEF but feel that it was a bit limited for my purposes, I wanted to be able to isolate plugins and have some versioning and licensing support (since plugins can be written by thirdparty).

Then started looking at MAF which seems support just those scenarios, however I can see one thing that might be a problem, before I invest too much time changing everything to MAF it would be great knowing if someone has experience with this issue since I havent worked much with MAF.

The problem

Currently when data is sent back to the application you get the actual objects of the data along with an adapter that says which fields the object contains and you can use the adapter on the object to extract the fields you want. The good thing about this is that you don't have to generate any new results objects but can simply query the results data when you want it from each object.

Now with MAF there's the Appdomain issue, I can't freely send all the objects across the app domain and inheriting from marshalbyref for each object isn't viable.

I could generate a result object with the string fields for each object but from a performance standpoint it doesnt seem such a good idea, the interface might only show 10 of hundreds of objects so it seems smarter to do on demand.

The solution I'm thinking might work is generating a sequence of just object id's and let the interface fetch the fields from the plugin through the appdomain through a proxy. So the application says for instance it wants fieldname x from items [y] in the plugin and those strings is sent across the appdomain.

The Question

So my questions are, is this a good way to do it, is there a better way? I'm obviously going to take a little performance hit moving across the appdomain still but since it's on deman开发者_运维技巧d and only for a small number of objects it shouldn't be too bad right? How do I go about setting up a proxy object like that?

It's not the easiest question in the world to answer, sorry. I'll really appreciate any insight, the future of the plugin architecture depends on it :)


.NET Remoting is the fastest way to exchange information between code running in two appdomains within the same process. If your appdomains are running in two separate processes, use WCF to exchange binary over Named Pipes.

This paper (a more recent version of the one I originally wrote ;)) should answer questions about which comms mechanism to use for cross-process and cross-machine perf.


It's probably memory mapped files will help you. You could send messages across domains and place data in memory mapped files or a single file, it depends.

But, honestly, Remoting over IpcChannel seems preferable...


As far as I've read, MEF was only designed with a basic set-up, for us all to all build the features that we need on top of it. Have you considered adding the features, or are hard limitations forcing the change?

Admittedly I don't have experience of MEF in very large applications (where MAF is more suited), and I don't know the features you're missing, but with MEF I've yet to find something I couldn't add myself. At least then you have it just how you want/need it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜