Service Dependency and Multi-user

Topics: Web Client Software Factory, Project Management Forum, UIP Application Block discussion, User Forum
Oct 25, 2007 at 4:03 PM
Hi All

Will Service Dependency has a performance impact if multi-user access the same function since only one instance exists in the application?

Regards
Alex
Oct 26, 2007 at 7:34 PM
Hi

There’s no performance impact inherent to the use of Service Dependency, as Web applications are multi-user by nature (service dependency only provides the proper object instance using dependency injection).

However, the usage of a service (with ServiceDependency) by multiple users could cause a concurrency issue, if the accessed service holds result variables. This could result in not producing the results expected by the user. Moreover, if the service contains critical sections, concurrent calls would cause performance decay. For example, if a code part or a resource is locked by one client, another one should wait until it is released.

Nevertheless, a service generally provides only a certain functionality and does not contain a state. It performs a specific task and the returns control to the invoker. This doesn’t cause any performance decay.

You can find some info on Web Client and Services in this WCSF Help topic:
  • Composite Web Client Applications.

Please let me know if this helps.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/
Oct 28, 2007 at 12:43 PM
Thanks.

But I still have one question. Is it better to use "CreateNew" to prevent the performance decay from concurrent calls if that function is accessed by many user at same time?

Regards
Alex
Oct 30, 2007 at 5:13 PM
Hi

When you use CreateNew, a new instance of whatever it is you need is created. Therefore, every call will be done to the corresponding instance, so there shouldn’t be any concurrency problems. However, consider using CreateNew only if the object being created holds a specific state, as if too many instances of the object are created (due to multiple requests) you could have a memory run-out issue.

Now, if you are intending to provide a specific task or behavior (a service) for everyone to use, you should consider using ServiceDependency injection.

For more info on this, have a look at the following WCSF Help Topic:
  • Working with ObjectBuilder.

There’s also some references at this WCSF Forum Topic:

Please let me know if this helps.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/
Nov 1, 2007 at 1:55 AM
Thanks for your clear explanation. It is very useful.

Besides, any performance difference between CreateNew and normal New instance approach?

Regards
Alex
Nov 5, 2007 at 3:27 PM
Hi

We haven’t detected considerable performance differences between creating instances with new and CreateNew. Take into account that if you used new (instead of CreateNew), you have to provide all the dependencies that the object being created needs manually.

Please let me know if this helps.

Ignacio Baumann Fonay
http://staff.southworks.net/blogs/ibaumann/