3

What is considered good practice with client/server comms on a client's pc. My app "logs" certain things to a wcf server. My server can run locally on LAN, or somewhere on the internet (port forwarding on server side etc).

Overhead does not really concern me, as I am logging minuscule amounts of data, but I will be logging it frequently... lets say every 10 seconds or so.

Do I instantiate my WCF object once (connect from client to server on app startup), or do I instantiate a new wcf connection (wcf derived call) every 10 seconds.

What is considered good practice. I concerned with applying proper etiquette with client resources.

Any good reading material you can point me to?

1 Answer 1

7

The best practice that all the WCF gurus like Michele Leroux Bustamante (author of Learning WCF - A Hand's On Guide) and Juval Löwy (author of advanced Programming WCF Services) preach is to use the per-call activation: each request creates its own instance of the service class, handles the request, and throws away the service instance again after the call.

This is by far the most scalable scenario.

All other scenarios (per-session, using multi-threaded service classes, or using a singleton) have significant impact on overall system performance, or they cause significantly more complicated programming experiences (multi-threading safe service classes).

Unless you have a very compelling reason for another setup, I would recommend to use per-call WCF services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.