I'm building a network server and starting a lot of AppDomains on the server to which requests are routed. What will be the fastest way to send off a request payload to one of the AppDomains for processing?
- Read in the payload from the socket into a byte array and marshal it.
- Marshal the network stream (inherits from MarshalByRef) to the AppDomain.
- Read the payload. Decode it into objects. Marshal the decoded objects.
- Use named pipes to transfer the byte array.
- Use loopback sockets.
- Maybe there is a way to marshal the actual socket connection?
The decoding mostly creates immutable objects that are used to determine how to fulfill the clients request and the AppDomain then creates a response and marshals it back to the host AppDomain which sends it back through the socket.
The method should prefer less memory over less CPU.
WCF is not an option.