Hello all
We have a problem in my project, that I would like some advice on how to slove using LLBLGen and SQLServer.
We have a cluster server setup with two loadbalanced servers (A and B). Requests are comming in through web services.
In part of our application, we need to read some data from the database, and based on the incomming data and the data read from the database, write some new data. In this situation, we never changes existing data.
We have a concurrency issue here. We may end up in a situation where server A receives a request, and while it is processing it, server B receives another request. The request that server B receives depend on the outcome of the data that server A will eventually write to the database.
How do we make sure, that server B waits until server A is finished with its processing, so that server B can make use of the data stored by server A?
Can transactions slove our problem? Assume that server A starts its transaction before server B, but it does not necessarily finish its transaction first, unless we make sure that server B waits for server A to complete.
Our first thought was that server A writes a "lock" in the database saying that it has now started processing. Server B will detect this "lock" and waits for server A to finish.
We don't like this solution from a performance standpoint, but also because these servers are running under IIS, and you never know if somebody decides to do a iisreset after server A has written the "lock", so the "lock" is left in the database.
Do any of you have a better solution?
It sounds like a fairly standard problem, so I would like to hear if any of you have had similary problems, and how you solved it.
Thanks.
Regards
Anders