Are your services scalable ?
Actually I know this for a quite sometimes, but didn’t have a chance to post it.
When we are building service that can be consume by our client apps. We want it to be scalable. Whether it’s a windows service, web service, WCF hosted in IIS etc. But to make the service scalable, we have to know the underlying concept of where the service resides. How the operating system really works. How process and threads are involved in the process.
Everyone is so crazy about the cloud bla bla bla, but seems forgot a tiny things. Operating System concept, Computer Architecture. It’s really needed to build a high scalable and performance service.
I found an interesting talks in Channel 9 presented by the expert Jeffrey Ritcher about threading and it’s really important. Please watch this stuff before you continue read all my opinion.
Have you watch it all ? Great. Take a look at this simple diagram.
This is a very common architecture used nowadays. WPF apps will call WCF services and will then retrieve data from Database then give the result back to the client.
Now my question are ?
Have you create WCF asynchronous proxy for your WPF application ?
Have you use ADO .NET async feature for database connection ?
If you creating TCP/IP Client server application then …
Have you create your TCP client and server asynchronous ?
Maybe you have already read about Asynchronous Programming Pattern and Event Asynchronous Programming. But you decide to use the blocking API because it’s complex ?
Another thing to learn is to differentiate I/O bound operation and Compute bound operation.
Well. Take a look at .NET 4.5 and c# 5.0. async await feature. Everything async is simple now. A lot of API is async now. You can use it for scalability.
If you are still using .NET 4, you can still using asynchronous programming. Wrap it with task. You can use Microsoft.Async.BCL with Visual Studio 2012 targeting .NET 4.0.
When you think that your code is doing I/O or network operation.
WCF ADO .NET TCP/IP ASP .NET Web API
async it when you can ! don’t tell me it’s hard. it’s there for you to use.