Basic problem:
When we read data from the SQL Server under NAV, it is occasionally wrong (as in old data that should have been very recently updated).
Architecture:
Web site (IIS 7.5, .Net 4) uses NAV pages exposed as web services to write data to NAV. For performance reasons, it reads most of its data directly from SQL Server, instead of reading pages. The service tier is running on a separate VM from the SQL Server.
SQL Server has snapshot as its default isolation mode.
Just recently, we noticed that a particular web page was responding slowly, and at the same time, noticed that part of the time, when it reads back the data from the SQL Server, it gets the old values instead of the new values it just wrote through the page. (After the page calls the WS to write the data, it reloads and displays the current data, which should be the same as what the user just entered.) Sometimes it gets the correct data immediately, and if you wait a bit and reload the page, it always works.
My first suspicion was, since SQL Server has snapshot isolation enabled, that the data from the WS write was still being copied from tempDB to the main database when the query arrived; however, changing the query to be in serializable (instead of snapshot) mode did not resolve the issue.
I suspect that solving the performance problem with the page / service might hide the issue again, but I'd like to solve whatever the basic problem is.
Presumably, data is either cached somewhere, or not written yet, but I don't know where. Ideas?
0
Answers
do you issue a selectlatestversion before reading back?
with best regards
Jens
We write through the WS version of the page, we read through a direct connection to SQL Server (bypassing the service tier).
It was indeed caching, and it was on the .Net side, not the NAV side, so this is off topic for this forum. An admin can feel free to move or remove it.