开发者

Blog Engine .NET with XML Data Storage How is it so fast?

I am looking for a way to embed a blog engine into my own application 开发者_开发技巧and I am too curious about Blog Engine algorithm.

This may not be the correct place to ask but, How is that possible to store blog entry data in an XML file like BlogEngine.Net with Default Configuration. It must be getting slower everyday while the file is getting larger and larger.

I am wondering the algorithm behind that. Is it loading with a different way ? Or Am I wrong with the time estimation ?

I know it is open source but I thought it would be better to see a discussion here for some others might be thinking the same and this thread can be a reference.


It loads posts into memory at startup.


How is that possible to store blog entry data in an XML file like BlogEngine.Net with Default Configuration. It must be getting slower everyday while the file is getting larger and larger.

Each post is stored as an individual xml file with a GUID file name.

When the system starts up or when it recycles if 30 mins of inactivity the system goes through all of the xml files and loads them up into the system memory "app_pool".

For the first visitor to visit on the "cold" boot will often experience a slower page load than visitors after them.

The 2nd visitor and others will experience a some what faster page load than the 1st visitor.

The reason why it is fast because it is stored in memory and does not require a connection to a database and the round trip process of accessing the database and returning with the requested page/post.

When the "app_pool" starts to get full because of too many posts/pages then it will start to slow down.

This is est to be around 150 posts/pages total.

When you reach about 151 posts/pages in total you will need to switch to using SQL database or some other provider other than xml.


To answer XML question you have asked,by extending ProviderBase class you can hook it any database including XML files.For more information see BlogProvider.cs class and Providers folder and it's sub folder XmlProvider in BlogEngine.Core folder. If you see the Web.Config file ,you can see the below code.

    <blogProvider defaultProvider="XmlBlogProvider">
        <providers>
            <add name="XmlBlogProvider" type="BlogEngine.Core.Providers.XmlBlogProvider, BlogEngine.Core"/>
            <add name="DbBlogProvider" type="BlogEngine.Core.Providers.DbBlogProvider, BlogEngine.Core" connectionStringName="BlogEngine" />
        </providers>
    </blogProvider>

by changing the defaultProvider to DbBlogProvider you can hook any RDBMS which are supported by BlogEngine.NET.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜