Running MS SqlServer from ASP.NET I have a visitors table with no unique开发者_JS百科 key.
Whenever user loads the page, I do perform an insert or update into visitors table with user's IP and Page Title as key.
1 - I read the table to find if a record already exists for that key, and according to no or yes, I do an Insert or Update statement.
Since the key is based on user's IP address, there is no risk of having several users trying to update the very same row at same time.
Now my question is: How well (or bad) will SQLServer behave if say 50 people try to update / Insert different rows in that same table concurrently? Will it support 1000 concurent writes? More?
Will SQLServer gently queue all the requests and proceed them one by one (which is fine for me) or will it enter into some page locking nightmare? Besides, I say there is no unique key because I do not wantthe server to lock the index during write operations.
Yes there will be a certain amount of queuing of requests as live-locks occur but inserts and updates are it's bread and butter. I suspect that only 50 users bumping into each other would be a very rare occurrence. Without knowing the details, it's difficult to predict what kind of locking behaviour you can expect. How many inserts versus how many writes.
I don't think there will be a page locking nightmare, but there could be some sleepless nights when you realize that an IP address presented to the server does not map one to one with individual users on different computers.
精彩评论