Data readback delay

njhansennjhansen Member Posts: 37
edited 2012-12-14 in NAV Three Tier
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?

Answers

  • jglathejglathe Member Posts: 639
    Hi,

    do you issue a selectlatestversion before reading back?

    with best regards

    Jens
  • njhansennjhansen Member Posts: 37
    I think SelectLatestVersion is a NAV function only; we are querying the SQL Server data directly from the web site, and I'm not aware of a corresponding function in SQL Server queries.

    We write through the WS version of the page, we read through a direct connection to SQL Server (bypassing the service tier).
  • njhansennjhansen Member Posts: 37
    Never mind, we found it.

    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.
Sign In or Register to comment.