.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

Using a database to synchronize and co-ordinate processes on a web farm and avoid race conditions

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Sql Server
 

A lot of actions in my ASP.NET app happen asynchronously (i.e in background threads without any access to HttpContext). Let me take an example of one such action. The app would be deployed to a web farm soon.

The background threads would be processing files deposited to a network share location. So, when the app starts, I create a FilesystemWatcher to monitor activities on the desired network share folder.

As soon as a new file arrives, the code processes it and marks it as completed processing.

The problem is with multiple servers watching the same network share, the same file might get processed on different machines, meaning redundant results. On a single server, I use locking mechanisms to prevent race conditions.

Now how to prevent the same on a web farm??

I was thinking of using a database to avoid such race conditions. So, when a server gets notified of a change to the network share, it requests a lock on a database object. Having granted the lock, it checks if the file has been processed and if not processes it, marks it as being processed and releases the lock. As all servers would be doing the same, they would not get into the processing logic for a file once it has been processed by another se


View Complete Post


More Related Resource Links

Toolbox: Database Documentation, API for Pre- and Post-Conditions, Blogs and More

  

In this month's column, Scott explores one-click database documentation, covers an API for pre- and post-conditions, takes a look at an interesting blog, and reviews the latest book about the ASP.NET MVC Framework.

Scott Mitchell

MSDN Magazine November 2009


synchronize two table in two database

  
i have two same database on two server in one network. each database works with own application in own subnet. the records of two tables in two database must have same information. insert, update and delete the records in these two tables (each one is in one database) must do same, ie. the records in two tables must be same completly. please guide me how i can do it. thanks amin gholizadeh

Synchronize SSAS database

  
Hi All, When I synchronize SSAS database, I get the following error message. Either the '' user does not have permission to synchronize objects on the source or target instance, or the objects do not exist on the source instance.   Anyone know?  

SharePoint Version 2.0 (WSS 2.0 SP3) Content Database restore to new farm

  
Is it possible to use an SQL backup from a sharepoint Version 2 SP3 database to restore the content on a new server farm and attach to a new web applicaiton. NOTE: This is WSS 2.0. In WSS 3.0 this is a very simple task, but it is not the same in WSS 2.0 (the add content database option CANNOT be used to attach to an existing content database like it does in WSS 3.0). The options I have found appear to say you need the configuration database from the old server then it can be done. I am migrating from an outsourced deployment, so I do not have access to that. Plan B is to do a sharepoint STSADM backup. THis seems to be a more likey way to do it.

Full Farm Backup Fails on Windows Sharepoint Services Search Database

  
I am just now starting to us central administration to backup the entire sharepoint farm.  All content backups fine except for the Search Database.  In looking through the backup log, it appears that the search database may not exist.  How can I determine if the search database actually does exist and if it does not can it be recreated?

SharePoint Userprofile synchronize with mysite userinfo in different farm

  
I am using Sharepoint 2007.... we have 2 userprofiles 1 userprofile for my intranet application in Farm1 2nd Userprofile for mysite in Farm2 both the userprofiles fetch data from same AD.  Onclick of mysite user is redirected to mysite in farm2 which fetches userinfo from farm2 If user updates any Sharepoint information (like picture, about me these are not from AD but stores in Sharepoint userinfo table) from mysite this information is not updated in farm1 intranet sites, this is because both farms use different unserinfo tables   is there any way i can update my intranet farm1 userinfo table with mysite userinfo        

Scaling Single Server Farm by adding a seperate Database server

  
Hi, Right now, I am having a sinle server farm SharePoint 2010 installation. Now I need to seperate out the SQL server from the same box and want to move it to the new SQL server. In short , I need to have a seperate SQL server in my current farm (which is single server farm installtion). Can some one point me to the steps for the same ? Thanks.

Users, Sessions, Processes, Instances, Database Engine

  
Can you depict me the existing relation between Users, Sessions, Processes, Instances and Database Engine of SQL Server?
MJ_Developer.

Issue when using Distrib.exe to synchronize database with SQL Server 2008 Express

  

Hi

I am using SQL Server 2008 Express. I created a new DB and then used Distrib.exe to create and populate the tables. It worked fine. However then I deleted one of the tables and ran the command again from command prompt. It did not pick up the table that I had dropped.  I did not get any error messages but just a message saying, No replicated transactions are available. I checked the snapshot. The table I dropped is in the Snapshot. I am using a transactional Publication and Pull Subscription.  Any ideas why the the deleted table is being missed by Distrib??

Any help will be much appreciated.

Thanks


Synchronizing and co-ordinating processes on a web farm

  

A lot of actions in my ASP.NET app happen asynchronously (i.e in background threads without any access to HttpContext). Let me take an example of one such action. The app would be deployed to a web farm soon.

The background threads would be processing files deposited to a network share location. So, when the app starts, I create a FilesystemWatcher to monitor activities on the desired network share folder.

As soon as a new file arrives, the code processes it and marks it as completed processing.

The problem is with multiple servers watching the same network share, the same file might get processed on different machines, meaning redundant results. On a single server, I use locking mechanisms to prevent race conditions.

Now how to prevent the same on a web farm??


Adding an SP 2010 server to an existing farm. "Failed to connect to the configuration database." dur

  

I have an existing sp 2010 enterprise server hosting websites and central administration.  I have a seperate sql 2008 r2 server holding the databases.  My goal is to setup another sp 2010 enterprise server to provide redundancy for the websites and central admin.  I believe I am able to accomplish this by adding another web front end to the farm.  On the second server, I install sp 2010, run the config wizard and connect to the config database located on the sql server, however, I am interrupted at step 3 when I am notified of the following:

Failed to connect to the configuration database.
An exception of type System.InvalidOperationException was thrown.  Additional exception information: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
System.InvalidOperationException: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
   at Microsoft.SharePoint.Administration.SPEncryptedString.CheckCredentialLock()
   at Microsoft.SharePoint.Administration.SPManagedAccount.Deploy(SPApplicat

Attaching a 2007 content database to a 2010 Farm

  
I attached a 2007 content database to a 2010 farm. Is it possible for me to get the 2010 site templates on the sites in that content db?
James Grizzle
---
http://www.linkedin.com/in/jamesgrizzle

Using Conditions in InfoPath - How do I avoid getting NaN

  

Hi guys, I follow this article "Auto-numbering InfoPath forms when they are submitted to a SharePoint form library" to create an auto-numbering form. The tutorial is great but if the library is empty I received a "NaN".  They provide a solution but I don't know how to implement it. This is:

 

Add a Button to the form with the following 4 rules:

1.       Query the RetrieveIDs data connection

Migrating content database to farm with different build number

  

Is it possible to attach a MOSS content database from FarmA (SP2) to FarmB (SP2 + Oct Cumulative) when both farms are on different builds? Will FarmB automatically upgrade the content database schema to the new build when I run the stsadm addcontentdb comman? Or do I need to upgrade FarmA to match FarmB in build number first?

Thanks.


Multiple database support with Entity Framework

  
One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend