pokrate
pokrate

Reputation: 3974

Singleton issue of provider model

Is the singleton requirement of a provider is a performance hit ? Because all the database read/write opertions must be taking place through that singleton. Wouldnt it be an issue with multiple users doing read/write operation in a site like Blogger.

Upvotes: 0

Views: 110

Answers (2)

stacker
stacker

Reputation: 68962

You should definitly use a connection pool, and limit the max number of connections to say 200 depending on hardware and traffic.

http://ondotnet.com/pub/a/dotnet/2004/02/09/connpool.html

const string connString = "server=localhost;" +
                             "uid=user;" +
                             "pwd=secret;" +
                             "database=Northwind;" + 
                             "Min Pool Size=50;" +
                             "Max Pool Size=200";   

Further tips regarding performance:

http://msdn.microsoft.com/en-us/magazine/cc163854.aspx

Upvotes: 1

calico-cat
calico-cat

Reputation: 1322

Instead of using a Singleton to access your database directly, have your Singleton manage a pool of connections. Use the Singleton as a global access point. That way, you can then avoid the bottleneck of a single connection, while still being able to manage the connections.

Upvotes: 0

Related Questions