locked
Performace when we call WEB API services RRS feed

  • Question

  • User-1350042179 posted

    Hi

    I don't know what is the best option,

    We can call one method with all the information or we can call many methods an join all the informacion when we try to connect to web api.

    Tuesday, July 30, 2019 2:20 PM

Answers

All replies

  • User753101303 posted

    Hi,

    It would be somewhere in between ie you don't want to have to do multiple calls each time you want to do something or to discard most of what you get each time. Depending on the siutation it could goes up to using https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint

    Tuesday, July 30, 2019 2:33 PM
  • User475983607 posted

    I don't know what is the best option,

    We can call one method with all the information or we can call many methods an join all the informacion when we try to connect to web api.

    What are the performance benchmarks you are trying to improve exactly? 

    I think you are asking about architecture and if you building a facade pattern is better than several Web API endpoints that target a single table.  Every project will have a mixture of both approaches and it depends on your requirements.  I prefer to invoke an endpoint that does everything I want rather than moving the logic to the client.

    Tuesday, July 30, 2019 2:40 PM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 17, 2019 4:52 AM
  • User475983607 posted

    How do you know the SO response is a good answer?  Because it matches your expectation?

    IMHO, the actual answer is, it depends on your requirements.  First, let's take a look at understanding the building blocks of an HTTP service.

    HTTP service endpoints (URLs) are nothing more than a class containing methods.  A service can have many classes and each class can have many methods.  Organizing classes and method is a standard programming problem every OOP developer must solve regardless of the framework or platform.  It does not matter if you are invoking a class library or making an HTTP request.  The concept is exactly the same.  The physical difference is invoking a library looks like this...

    mynamespace.classname.method(input)

    ...while invoking a service looks like...

    https://www.mydomain.com/classname/method/1

    These days we have microservices and serverless functions.  At a highlevel these tools are just another way organize code but the concept of classes and methods remains.

    Saturday, August 17, 2019 11:43 AM
  • User1474841173 posted

    I totally agree, Performance is based on WEB API Services but you can improve the performance by using these factors:

    Use fastest JSON serialize
    Manual JSON serialize from Data Reader
    Use other formats if possible
    Implement compression
    Use caching
    Use classic ADO.NET if possible
    Implement a sync on methods of Web API

    For more concern contact us on https://www.arcsolutions.site/intros

    Wednesday, August 21, 2019 6:47 AM