locked
One svc with many methods or many svc with few methods RRS feed

  • Question

  • User-1350042179 posted

    Hi

    I don't know what is the best option about: performance, scaling and use of memory..

    Monday, May 6, 2019 3:37 AM

Answers

  • User-893317190 posted

    Hi neoaguil17,

    Generally speaking , many methods in one svc is not a good practice.

    This will make your service has too much code that is not necessary.

    If you want to modify your service , others that rely on your service may   need to change too.

    For example, if you have a service with 100 method, all the clients refer to this service will need to generate a service proxy with 100 method.

    When one of the method changes , all the clients should also change.

    If you extract related method with related logic into a new svc , if you want to change this svc, because it is smaller , it will have smaller effect.

    Many smaller services are easy to work with each other and provide service and  svc with too many methods is hard to work with each other and relates to too many clients.

    For performance and memory , it depends on the code you write and how many clients call your service and others.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 6, 2019 5:55 AM

All replies

  • User-893317190 posted

    Hi neoaguil17,

    Generally speaking , many methods in one svc is not a good practice.

    This will make your service has too much code that is not necessary.

    If you want to modify your service , others that rely on your service may   need to change too.

    For example, if you have a service with 100 method, all the clients refer to this service will need to generate a service proxy with 100 method.

    When one of the method changes , all the clients should also change.

    If you extract related method with related logic into a new svc , if you want to change this svc, because it is smaller , it will have smaller effect.

    Many smaller services are easy to work with each other and provide service and  svc with too many methods is hard to work with each other and relates to too many clients.

    For performance and memory , it depends on the code you write and how many clients call your service and others.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 6, 2019 5:55 AM
  • User1120430333 posted

    I have seen it done both ways. It doesn't matter as long as the methods are using objects in a classlib project the WCF service project has reference to that is doing the actual work/functionality  with the WCF service just being passthrough logic. 

    This allows the classlib project that has classes/objects that implement an Interface to be unit or integration tested without the WCF service being involved.

    Monday, May 6, 2019 6:45 AM