This project is read-only.

Learn to Develop for BlogEngine

Topics: ASP.NET 2.0
Mar 15, 2010 at 10:06 AM

Hi, I am John

I am learning to use BlogEngine and found out that it is quite difficult for me, such as I don't know event order (PreInit, Load, RenderComplete, etc), can you give me reference where to learn this (book etc).

And I found out something, everytime the default.aspx is load it will query all Posts in the database and store it in Post.Posts property, isn't this make the loading slow if the blog has a lot of posts? Or is there any trick around that I haven't notice?

Thank you

John Kenedy

Mar 15, 2010 at 10:10 AM

ASP.NET Page Life Cycle

All the posts are read from disk (or DB), and stored in memory the first time any post is needed.  After that, Posts are coming directly from memory -- they are not being re-read from disk/DB each time the page loads.  So the page loads should be pretty quick since working from memory is fast.

Mar 15, 2010 at 10:19 AM

Hi Ben, thanks for replying

Btw, how to store the Post.Posts object in memory? I notice that it is Serializable but which code keep it in memory, can you show me (I can't find the code that stored it and re-load it)?

Thank you

John Kenedy

Mar 15, 2010 at 7:42 PM

In the BE core, there's a file named Post.cs.  In there, is a property named "Posts".  The posts are stored in a static list, at this line of code:

_Posts = BlogService.FillPosts();

The static list is a list of data (in this case Posts) that stays in memory while the application is running.

Apr 12, 2010 at 2:02 PM

Have any of us tested the maximum load it takes initially when it reads from the DB / file to memory?

How long it takes to the maximum?

Appreciate your response.


Thank you.

Apr 13, 2010 at 10:52 AM

The time it takes for the posts to get loaded into memory is directly related to the number of posts.  If you only have 1 post, it will take 1 or 2 seconds.  If you have 50,000 posts in a DB (which I've seen), it will take around 5 minutes for all that data to get loaded.

Apr 13, 2010 at 3:36 PM

Thanks Ben.

If want to test loading directly from DB per need instead of loading all messages, where would i make the change? is it a big change in the core?

Personally, I feel 5 mins to load is bit too long, can't expect the visitor to wait for that long.


Appreciate your response.

Thank you.

Apr 13, 2010 at 9:18 PM

5 minutes would be if you had somewhere in the neighborhood of 50,000 posts.  The 5 minutes would only be one time -- not per visitor.

But, unfortunately, there is no easy way to change it so it only loads one message at a time.  MANY pieces of functionality within BE expect all the messages to be available in memory.  This is just how it is structured.

Apr 13, 2010 at 11:56 PM

Ok. thanks.

Apr 15, 2010 at 12:33 AM

So, let me ask this question then, what triggers BE.NET to look for new posts?

Apr 15, 2010 at 4:23 AM

If you update the data store directly (DB or the XML files), then BE won't be aware of any new posts.  It'll continue using it's "outdated" set of posts.  That's why updating the data store directly isn't the typical or recommended way to update data.

But when adding/updating posts the normal way -- either thru the Add Entry page, or thru WLW, the new post is added to the list of posts in memory at that time.  And BE doesn't re-retrieve all the posts.  It just adds the new post to the existing list of posts cached in memory.