CSLA mobile objects network transmission

CSLA mobile objects network transmission

Old forum URL: forums.lhotka.net/forums/t/10636.aspx

Direvius posted on Thursday, August 25, 2011

Good day everyone!

We have a webapp based on Silverlight, WCF and CSLA. I've done some performance optimization for the app and the bottleneck for now is CSLA. I've analyzed the request, it was a search by UID operation.

UID is 10-digit decimal. CSLA had serialized an object (FindByUIDCriteria) with a huge amount of additional data (state stack for example) resulted in message size of 50 KB. We have to make about 850 similar requests per second which is obviously can make our 8-core CPU to cry (and the network).

Is there a way to reduce the message size (maybe by disabling the undo history or global and client contexts transmission)?

Thnx, Alexey.

RockfordLhotka replied on Thursday, August 25, 2011

If you are doing hundreds of requests per second you will probably have issues even if you reduce the message size.

To directly answer your question, there is no practical way to reduce the message size while using the data portal. The data portal clones the object graph over the wire, and that incurs some overhead.

One option is to make a direct service call (don't use the data portal) for this particular request. In other words, for this particular business object, use the local data portal, and make a direct WCF service call. That can reduce the message size quite a bit, because you won't be moving entire objects over the network.

I suspect you'll still have issues though, so here's my suggestion: use time-boxed batching.

Most high volume network implementations (including TCP, etc) combine numerous small messages into a single message as an important optimization. The performance difference is so dramatic it is one of those things we couldn't live without (literally - the Internet wouldn't work without this technique).

If you are doing hundreds of requests per second, you can probably combine these requests into 1, 2, or 4 server calls - each of these server calls containing several hundred requests.

The efficiencies gained by doing this are important, because each request has TCP, network latency, HTTP, IIS, ASP.NET, WCF, and .NET overhead. Even if you get your request size very small, every one of your hundreds of requests incurs all this overhead - and that adds up.

If you can make 1 server call per second, with that server call containing all 850 UID values, then you incur all that overhead exactly one time per second, and that'll make a huge difference.

Direvius replied on Thursday, August 25, 2011

Thanx for the answer, it's all clear for me now.

Unfortunately, we can't use time-boxed batching as the requests are coming from different users (Silverlight clients). We'll try WCF calls.

Copyright (c) Marimer LLC