In our environment we have our externally-facing Web servers off-site (same city). Then internally we have our SQL server, which is being called from the above Web servers. (We do have a SQL server off-site, but it’s being used less and less now.)
I’ve heard that SQL calls (we’re using Microsoft SQL Server) have (rather wasteful) network overhead associated with them, but outside of this question, I’m not finding much about that online.
Given the situation above, where we have:
- off-site (external) Web servers querying a SQL server on-site (internal)
- a 3-5+ MB connection between the off-site and on-site facilities
- differing levels of caching on the Web server, due to need
does it make sense to continue with SQL calls, or is it more efficient to create a Web service on an on-site (internal) Web server that is then called by those off-site servers?
We’re moving 100% to ASP.NET, so we’d probably go WCF for the services, since that’s what we’ve used for third-parties, but I assume performance differences to be the same whichever language is used.
Thanks!
Edit 1: Attempting to clarify: I’m asking about the efficiency of SQL calls across a network connection, as opposed to using a Web service. I’m aware that adding a Web service that makes SQL calls is adding complexity, but if what the Web service returns is more efficient than what SQL returns (for the same data set) … For example, the difference between sending XML and JSON.
To me, it seems that the SQL call would be much more efficient from a programming standpoint. I can directly query the data that I want/need for particular cases, instead of creating a service method for each, or having a method that returns more information than I need, so it can be used for multiple cases.
If ‘using Web services to return data across the network is more efficient than directly calling SQL’ is just marketing, and there’s no practical impact, then so be it.
Looking at what Microsoft provides, it seems that ‘only use a Web service if communicating with third-parties or if you’re programming in something that does not easily allow for SQL access’ is the suggestion/guideline.
I wouldn’t have thought that using a web service would be a very fast solution either. The main benefit I would see in using a web service is that you wouldn’t have to expose the SQL server directly to external networks. This would potentially make the web service option more secure.
I think you need to ask yourself a couple of questions such as: