Long back, I was working on a desktop application which handles lots of data. That application connects to a web service to get the data. Once the data is downloaded, the user works on the data offline, and then uploads the updated data.
One fine day, I got a mail from the web service team that, I was using one web service call which gets the data for all the entities in a given component. They were planning to remove that web service, and asked to me to use two other web service calls. First web service gets me the ids of all the entities in the given component, and the second web service gets me the data for a given entity. So, I need to call the first web service and gets the ids of all the entities, and for each id, I need to call the second web service to get the data. If there are 100 entities in the component, then there would be 101 web service calls. The reason that they gave for this change was, the web service was taking lot of time, and taking lock on SQL Server for a long time, which is blocking other transactions.
As usual, I did not agree with their proposal. My arguments were,
One fine day, I got a mail from the web service team that, I was using one web service call which gets the data for all the entities in a given component. They were planning to remove that web service, and asked to me to use two other web service calls. First web service gets me the ids of all the entities in the given component, and the second web service gets me the data for a given entity. So, I need to call the first web service and gets the ids of all the entities, and for each id, I need to call the second web service to get the data. If there are 100 entities in the component, then there would be 101 web service calls. The reason that they gave for this change was, the web service was taking lot of time, and taking lock on SQL Server for a long time, which is blocking other transactions.
As usual, I did not agree with their proposal. My arguments were,
- There will be too many web service calls from the client to the server. Performance of the client would go down.
- The performance of the server also would go down. If they have single stored procedure/web service, the server would do much less work than 100 web service calls/stored procedures.
- If they are worried about SQL Server taking locks, they can have another wrapper web service which does all this work, and send it to the client, so that, client does not need to worry about the changes in the server.
- The stored procedure for the original web service is very expensive, and taking huge time to execute. Till then, it is holding the lock and other transactions are blocked till that time.
- Eventhough, with the proposed changes, the performance of this operation would go down, but, overall performance would increase, because, other transactions would not be blocked for a long time.
- All the web service calls map to a stored procedure in the DB. Creating another web service which does not have any corresponding stored procedure does not look good. This would be the only web service call that would be odd, and they do not want to pollute the web service.
Till, I was in that project, I have not done what they had asked. I don't know what happened, after I moved out of that project.
Who is wrong in this case?
[Of course, even if you say that, I am wrong, I may not accept. Because, I still feel that, Webservice should be driven by the requirements of the user rather than the DB design.]
No comments:
Post a Comment