Developer forum

Forum » Development » RE: Performance and issues with database

RE: Performance and issues with database

Jan Sangill
Reply
This problem below is something I am encoutering after some custom code and play with the database:
[InvalidOperationException: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.]
   Dynamicweb.Database.CreateConnection(String database) +3234
   Dynamicweb.Content.Items.Activation.ActivationManager.CreateDatabaseBuilder() +138
   Dynamicweb.Content.Items.Queries.Repository..ctor(ItemType metadata) +83
   Dynamicweb.Content.Items.Queries.StorageFactory.CreateRepository(ItemType metadata) +34
   Dynamicweb.Content.Items.Queries.StorageManager.Open(ItemType metadata) +21
   Dynamicweb.Content.Items.Queries.StorageManager.Open(String systemName) +70
   Dynamicweb.Content.Items.Queries.StorageManager.GetByPageId(String systemName, Int32 pageId) +103

 

What I am doing is this:

  1. Using itempublisher to fetch item-pages based on an boolean item value.
  2. Loop through each page
  3. using (var command = Dynamicweb.Database.CreateConnection().CreateCommand()){ to fetch all item paragraphs on the page
  4. Dynamicweb.Content.Items.ItemManager.Storage.GetById(item_type, item_id) to get the item and its content
  5. if its an itemlist I am again contacting the database to get the independant items from that itemlist by a custom sql
    using (var command2 = Dynamicweb.Database.CreateConnection().CreateCommand()){

 

This seems to create an issue with the database.  Any way this can be done better to achieve the same.
 

regards


Replies

 
Mikkel Ricky
Reply
This post has been marked as an answer

I have a suspicion that you may not be releasing your database connections. You could try to use the Dynamicweb API rather than querying the database directly.

Use Dynamicweb.Content.Paragraph.GetParagraphsByPageID to get the paragraps on a page. See this thread for suggestions on how to get the items in an item list: http://developer.dynamicweb.com/forum.aspx?ThreadID=38852&PID=48.

Best regards,
Mikkel 

Votes for this answer: 1
 
Jan Sangill
Reply

Testing that out. All done via API now - so I hope this resolves this:)

 

You must be logged in to post in the forum