Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryModify code to cache repository?Modify code to cache repository?
Previous
 
Next
New Post
5/2/2009 7:34 AM
 

Hi,

I am running DNN 4.5.3 with Repository 3.15. I have a repository with 500 entries. Each entry is simply a url to an MP3 recording on an FTP server. However, each entry has 4 custom attributes and a category. Some of the custom attributes have 20-50 available values.

I do not know why but the performance of the Repository is awful, even though I am on an expensive, high-level plan with Webhost4Life. I don't know if it's the number of entries in the Repository (unlikely), or possibly the number of custom attributes and their values. Often the main listing takes up to 1 minute to appear and the same for filtering on the attributes. Sometimes it just times out. All other pages on the site come up instantly.

Is there anything I can do to fix this other than modifying the Repository code? I am a .NET developer but only use C# so working with VB.NET will be a little cumbersome. Also I don't have much free time. However I'm willing to give it a go if it's my last resort.

If I go with modifying the code, what would be the simplest way to cache the Repository so that it does not have to go back to the database on every hit? I envision caching the entire Repository as a DataSet in the web cache. Then writing a singleton class that acts as the gatekeeper ("cache manager") to this cached DataSet. Instead of the page controls going off to the datalayer on every single hit, they would instead go through the cache manager. The cache manager would get the DataSet from the cache, do any sorting or filtering and return the values to the calling page control as an ArrayList (the page controls seem to be expecting an ArrayList back).

Any uploads or edits of any kind would also have to go through the cache manager so that the cached DataSet could be invalidated. Then the next request through the cache manager would cause the Repository to be refreshed from the database.

If anyone can point me to where in the code the best place to implement all this would be, or give me any other ideas, I would REALLY appreciate it.

Many thanks,

Simon.

 
New Post
5/3/2009 12:06 PM
 

Is an easier way to just use ASP.NET caching by query parameters? It has been a couple of years since I did ASP.NET development, but it appears I can use the OutputCache directive as follows: <%@ OutputCache Duration="" Location="" VaryByParam="" VaryByCustom="" VaryByHeader="" %>

I could then cache the page based on the dynamic form parameters of my respository: page number, category, each of my 4 custom attributes. Doing a view-source on my page, it seems that the category and attributes get passed as normal form parameters (Repository_ddlCategories, Repository_ddlAttribute_1 to Repository_ddlAttribute_4, etc). Would this work with the page numbers as well?

Thank you,

Simon.

 

 
New Post
5/3/2009 12:28 PM
 

Hi Simon,

I think that caching is much more simple than you believe with the standard DNN module pattern: all the data access is performed by the code through a CBO controller. I successfully tested caching this way:

  • Whenever performing a "read" action, check if the cache has already it available, if not, perform the db access, return the data and store it in the cache.
  • Whenever performing a "write" action, perform the db access and purge the cache.

You may end up with something like:

Imports System.Data
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Cache.FileBasedCachingProvider

Public Class ObjectController

    Private CachingProvider As New FBCachingProvider

    Public Function AddObject(ByVal myObject As ObjectInfo) As Integer
        With myObject
            Return DataProvider.Instance().AddObject(...)
        End With
        PurgeCache()
    End Function

    Public Function ListObjects(ByVal objectID As Integer) As List(Of ObjectInfo)
        Dim List As List(Of ObjectInfo) = CachingProvider.GetPersistentCacheItem("ListObjects", GetType(List(Of ObjectInfo)))
        If List Is Nothing Then
            List = CBO.FillCollection(Of ObjectInfo)(DataProvider.Instance().ListObjects(objectID))
            CachingProvider.Insert("ListObjects", List, True)
        End If
        Return List
    End Function

    Private Sub PurgeCache()
        CachingProvider.RemovePersistentCacheItem("ListObjects")
    End Sub

End Class

This is just my 2 cents...

Best regards,
Dario Rossa

 
New Post
5/3/2009 5:37 PM
 

I wouldn't even think about looking at the code. I would start with the database. Take a look at the stored procedure that retrieves the repository data. I am sure by adding some indexes, or re-structuring the stored procedures, you can significantly improve the response time. Please share any changes you make should they prove beneficial.

Thanks

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryModify code to cache repository?Modify code to cache repository?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out