Search code examples
asp.netweb-servicesasmx

Webservice performance - Separate ASMX for each function or both functions inside the same ASMX?


I am using ASMX web services.

I have two functions so, should I create two functions in a single ASMX or should I create separate ASMX for each function?

Does that impact performance? Which choice will have the highest performance?


Solution

  • With all things performance you need to profile it before making changes to increase performance otherwise you could end up optimizing the wrong thing.

    Most of the times the Pareto principle applies, a small portion of code or a few modules in the entire application are responsible for most of the execution time. Making optimizations there will have the greatest impact on performance.

    Have you optimized everything that could be optimized and drawn the conclusion that the service endpoint can cause performance issues?

    You should write the code how it's easier to maintain. Do those two functions belong together or are they completely unrelated? Does it make sense to have them exposed through one ASMX or two? That should be your criteria for how to define your endpoints.

    My guess is that both choices will have similar performance but if you absolutely need to know build them both ways, profile them, and see which one performs better.