| Digg it UP |
Hubs | Hubbers | Topics | Request |
| #1 in Business | Subscribe Email Print |
|
You are here: Home > Internet and Businesses Online > Web Development > Optimizing Your Asp.Net Pages For Faster Loading And Better Performance |
|
Digg it UP - Optimizing Your Asp.Net Pages For Faster Loading And Better Performance
Case Study: An eBook Online Business Plan lt set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set:Success online depends on having a plan, or more specifically a business plan. Often, very often actually, clients contact a designer with a burning passion to have a new web site online, and fast. Success takes more than waking up bug-eyed at 2:00am with the brainstorm of the century. You need to outline (and fill in) a real business plan and make adjustments before the official launch.Citing an actual case for an online eBook business, I advised the aspiring entrepreneur to provide more information. Thinking through the questions and answers is a vital step towards developing a good business plan.- Do you have a logo for your company? - If no logo, what color schem Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that ha What Makes A Great Ad? If you read the internet and all of the websites dedicated to Asp.Net you will inevitably read about the wonders of the DataGrid, DataList, and Repeater controls. While each of these has its place, if you are only displaying data there is a much faster and more efficient means to do so.Three things you might want to try in your ads.After writing thousands of ads for people all over the world, and for just about every type of product and network marketing opportunity out there, I have come to notice a few things. Most notable is what works and what doesn't in putting together a really great ad that will create a desire in the reader to visit your site. After all, that's the goal. You don't want to sell something through the ad (which is what so many people try to do), but rather be a catalyst for them to visit your site open to the possibility of buying something.How do you do that? What makes a great ad? Here's three things I've learned that are not what Let's say you have a page that displays articles based on a query string. Take my article pages for instance. Each article is stored in a database and displayed on the page based on the unique id of the article as stored in the database. A normal asp page execution procedure goes something like this. The code queries the database based on the Article I.D. and then brings back that information to the page where you display it in the fashion that you would like. This is a fairly straight forward approach with asp and is done all the time. So how do we speed up our asp.net pages? Number 1: Use Asp.Net Caching! This is a no-brainer, and I won't go into the brilliance or details of asp.net caching here because at the time of this writing Google has 2,780,000 articles on the topic. Basically instead of querying the database each time the page is loaded you only query the database once and load that result into the system cache. Subsequent calls to load the page retrieve the data from the cache as opposed to the database which gives you an instant and considerable performance boost. You can then set the cache for how long the cache should store the information as well as many other features. If you are not using the cache, you should be whenever possible! Number 2: If possible, do NOT use the standard Asp.Net controls. That's right. The standard asp.net controls are designed for rapid development and not page performance. They allow you to design pages that grab and display data very quickly but their actual performance suffers because of the extra overhead which is there for ease and speed of development time and not page execution speed. Instead, create either a User Control or even better yet a Web Custom Control which is by far the fastest performance wise and really quite easy to create and use. Number 3: Use an SqlDataReader or even better yet use a set based command for Sql Server data retrieval and simply execute that one command against the database. An asp.net SqlDataReader is a fast forward only datareader that closes the connection after it reads the last set of results. Now for my article pages we are only returning 1 particular result. In this case we would opt for the set based command. If you had more than 1 result returned, in your table of contents for instance, you would use the SqlDataReader because you are returning multiple sets of results. Set based commands are stored procedures that bring back data through parameters as opposed to a result set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set: Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that ha How Do You Make Money From Google Adwords? lay it in the fashion that you would like. This is a fairly straight forward approach with asp and is done all the time.Can you really make money from this?Late 2003, I think was the first time an ebook popped up that claimed that one could make money from Google Adwords.The main method that was revealed involved combining Google Adwords and the Clickbank affiliate program, to make money, online, everyday almost on autopilot.Please allow me to very quickly outline how you can make money on the internet, using this system.Here are 2 things you need to get started...1) You need a Google Adwords account.=> http://adwords.google.com2) You also have to sign up as a Clickbank affiliate=> http://www.clickbank.comOk, so how does it work? So how do we speed up our asp.net pages? Number 1: Use Asp.Net Caching! This is a no-brainer, and I won't go into the brilliance or details of asp.net caching here because at the time of this writing Google has 2,780,000 articles on the topic. Basically instead of querying the database each time the page is loaded you only query the database once and load that result into the system cache. Subsequent calls to load the page retrieve the data from the cache as opposed to the database which gives you an instant and considerable performance boost. You can then set the cache for how long the cache should store the information as well as many other features. If you are not using the cache, you should be whenever possible! Number 2: If possible, do NOT use the standard Asp.Net controls. That's right. The standard asp.net controls are designed for rapid development and not page performance. They allow you to design pages that grab and display data very quickly but their actual performance suffers because of the extra overhead which is there for ease and speed of development time and not page execution speed. Instead, create either a User Control or even better yet a Web Custom Control which is by far the fastest performance wise and really quite easy to create and use. Number 3: Use an SqlDataReader or even better yet use a set based command for Sql Server data retrieval and simply execute that one command against the database. An asp.net SqlDataReader is a fast forward only datareader that closes the connection after it reads the last set of results. Now for my article pages we are only returning 1 particular result. In this case we would opt for the set based command. If you had more than 1 result returned, in your table of contents for instance, you would use the SqlDataReader because you are returning multiple sets of results. Set based commands are stored procedures that bring back data through parameters as opposed to a result set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set: Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that ha List Building Using Forums (Part 3, List Building Strategies) e cache for how long the cache should store the information as well as many other features. If you are not using the cache, you should be whenever possible!Forums are another big key to building a quality list. I think that this is one of the most overlooked methods of list building. All too often, people use forums to try to sell something, right there in the forum. But the key with forums is to establish yourself as an expert. Once you are an expert, then people will be interested in your web site and product--not for the product, but for your expertise.One thing to note here: if you are using multiple sources for your list building, track every source. Not just for traffic, but for source-specific sign-ups and for sales. You might find that one list source gives you 3x the number of sign-ups, which is exciting. But if you ar Number 2: If possible, do NOT use the standard Asp.Net controls. That's right. The standard asp.net controls are designed for rapid development and not page performance. They allow you to design pages that grab and display data very quickly but their actual performance suffers because of the extra overhead which is there for ease and speed of development time and not page execution speed. Instead, create either a User Control or even better yet a Web Custom Control which is by far the fastest performance wise and really quite easy to create and use. Number 3: Use an SqlDataReader or even better yet use a set based command for Sql Server data retrieval and simply execute that one command against the database. An asp.net SqlDataReader is a fast forward only datareader that closes the connection after it reads the last set of results. Now for my article pages we are only returning 1 particular result. In this case we would opt for the set based command. If you had more than 1 result returned, in your table of contents for instance, you would use the SqlDataReader because you are returning multiple sets of results. Set based commands are stored procedures that bring back data through parameters as opposed to a result set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set: Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that ha How to Have A Recruiter Find You - FAST asy to create and use.You are in a panic. You need a job fast and recruiters won't return your call. You don't have anything on the back burner because you thought you could just call the recruiter and get set up. After all everyone knows a recruiter or two. Well, times have changed. Recruiters hold the cards now. So how can you prevent this from happening to you? How can you achieve the star status necessary to ensure that recruiters are calling you before you need them to?First, it's important to understand the recruiter mindset. A recruiter makes money through placements. Translation - they make their living by placing you in the highest paid position possible - the higher the level of the plac Number 3: Use an SqlDataReader or even better yet use a set based command for Sql Server data retrieval and simply execute that one command against the database. An asp.net SqlDataReader is a fast forward only datareader that closes the connection after it reads the last set of results. Now for my article pages we are only returning 1 particular result. In this case we would opt for the set based command. If you had more than 1 result returned, in your table of contents for instance, you would use the SqlDataReader because you are returning multiple sets of results. Set based commands are stored procedures that bring back data through parameters as opposed to a result set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set: Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that ha The Success Factor: Finding Your Niche on eBay lt set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set:You’ve spent a day or maybe two or three cruising around eBay. You even registered and bought that iPod skin your niece wants for her birthday. Now it’s time to get down to business; that is, your business. Just exactly what is it that you are going to sell on eBay? The right choice of product is one of the most important decisions you will make when you become an eBay seller. If you are already successfully selling products in a different environment, it is still important to select that perfect product from among your wares that is best suited to your eBay audience.It is true that many people clean out their closets and turn a tidy penny auctioning off their loot on eBay. Select Title, Body, Author We can write it using a set based command like this. Create Procedure mysp_GetArticle @Title varchar(200) Output, As Select @Title = Title, @Body = Body, @Author = Author GO The above query will return only the three parameters called for and not a result or record set so you don't have to then walk through the returned record set that has only 1 result in it anyway. This second little process of work decreases your performance so you should avoid it whenever possible. Combine this technique with the asp.net cache. Number 4: Use Classes and ArrayLists as opposed to returning an SqlDataReader. Create a class and then if there are more than one set of results store those results into individual instantiations of that class. Finally store each of those classes into an ArrayList. You can then store only that ArrayList into the asp.net cache. So instead of getting the results back from a SqlDataReader when loading your page you get them from the ArrayList which is stored in the cache. Nice huh? Finally... you want to incorporate all of these techniques into your final results which would be performed in the following manner and sequence. On the first time the page loads, query the database and return all of your data storing it into individual classes. Then store each of those classes into an ArrayList. If you only have one single result you may store only the class into the cache. Then take your ArrayList and store it into the cache. Next create a Web Custom Control and pass the cached ArrayList to the custom control and loop out your data using the HtmlTextWriter which is very fast. Remember each subsequent call to load the page will be called from the cache which stores your ArraList of classes or your single class. Certainly it takes a significant amount of additional coding to do it in this fashion, especially when you take proper error handling into consideration, but if you follow this approach your pages will be screeching fast, you will immediately notice the difference, and your asp.net pages will execute in the proper sequence - Data handling in the Page_Load function and the html display in the Page_Render function. Further, you will be glad you did and so will your visitors. Happy Programming!
HTTP = HTML link (for blogs, profiles,phorums):
Related Articles:Myspace Friends- Know How To Market To Them: Part-2 7 Tools Of Intelligent Internet Marketers
|