This is a very common asp.net interview question asked in many interviews. There are several reasons for the page being slow. We need to identify the cause.
1. Find out which is slow, is it the application or the database : If the page is executing SQL queries or stored procedures, run those on the database and check how long do they take to run. If the queries are taking most of the time, then you know you have to tune the queries for better performance. To tune the queries, there are several ways and I have listed some of them below.
a) Check if there are indexes to help the query
b) Select only the required columns, avoid Select *.
c) Check if there is a possiblity to reduce the number of joins
d) If possible use NO LOCK on your select statements
e) Check if there are cursors and if you can replace them with joins
2. If the queries are running fast, then we know it is the application code that is causing the slowness. Isolate the page event that is causing the issue by turning tracing on. To turn tracing on, set Trace="true" in the page directive. Once you have tracing turned on you should see trace information at the bottom of the page as shown in the image below. In this case Page Load event is taking the maximum time. So we know, the code in Page_Load event is causing the issue. Once you look at the code, you should be able to nail down the issue.
nice explanation its very easy to understand thank you
ReplyDeleteYou are wonderful teacher. Bless your heart. You are doing a great service for un-employed programmers who is trying to get a job by learning fundamentals from your posts and Videos. God Bless You.
DeleteAnother factor to slow down asp page is view-state. so developer should check view state of each control and possibly turn off unnecessary view state from certain controls. specially gridview control's view state will take much time to reload.
ReplyDeleteHI i have some question of .net which are asked to me in the interview :
ReplyDelete1. How to redirect to next page from J query.
2. What are triggers.
3. What is Form Authentication and how we use an implement it.
4. what is passport authentication.
Hi Atul, I have asp.net, sql server and c# video tutorial for beginners and uploaded to youtube. Triggers and Forms authentication is clearly explained in these videos. Please check the link below.
DeleteSql server, asp.net and csharp video tutorial
What is GACUTIL
ReplyDeleteIt is used to add or remove assembly from GAC(Global assembly Cache)
DeleteNice way of explaining..
ReplyDeleteThe explanation is very good and crystal clear.. Thanks.
ReplyDeleteEXPLANATION IS GOOD
ReplyDeleteOther factors that may make the page slow are
ReplyDeleteIncluding lots of unnecessary huge files in the page (JS/CSS)
Use of lots of images in the page without optimizing them
Use of unnecessary tags (div etc)
Avoid to use HTML table or Table span , in place of HTML table use DIV and class for design
ReplyDeletevery nice concept + example
ReplyDeleteeasy to understand
ReplyDeleteGreat Explanation...I want to add something more..
ReplyDeleteFollowing are the other factors which slows down the web page.
1. View state-If not required, disable it.
2. Always use minified javascript.
good useful for interviews as well as fine tune the application...
ReplyDeletei add two more thinks,
ReplyDelete1.check if any logs occur in sql database by using who2 stored procedure.
2.check if more worker processor(w3wp.exe) are created in iis by using right click Taskmanger
in web server.(kill some w3wp.exe)
sorry,some changes in first point.
ReplyDelete1.check if any (locks or blocking) occur in sql database
by using
i) who2 stored procedure.
ii) SQL Server Management Studio Activity Monitor.
2.check if more worker processor(w3wp.exe) are created in iis by using right click Taskmanager
in web server.(kill some w3wp.exe)
plse answer the question which is asked in above.
ReplyDeleteits so easy language, thanks
ReplyDeleteits really nice example just try it once Trace="True"....
ReplyDeleteCool.. this Qn was asked to me too in an interview!!
ReplyDeletethis is really helpful site Venkat. keep up the good work.
ReplyDeleteMr.venkat you are realy super, excellent explanation in very easy manner to understand . your videos will become popular and you are the best asp.net trainer. Thank you a lot for your teaching & helping to the people. i would like to say i became fan of you .
ReplyDeleteMr.venkat doing good job. i more learned from your videos. Thanks.
Deletewhat are use of web services,WPF,WCF and MVC?How?
ReplyDeleteHi venkat,
ReplyDeletei have went thru you sql tutorial and asp.net tutorials as well...
thanks for sharing the info along with small basics...
Really grt work
Thanks . you video helped me alot
Sir Really u done good job.. your video really help full for my type of beginners.
ReplyDeleteI have one problem sir can u upload DataGridView control more example with all type of query like select,join, innerjoin result for C#.net desktop application. some time i want to display 2 join table in DataGridView query through is it possible.. ??
Hi Nilesh, there are lot of videos on asp.net gridview tutorial that explains the concepts you mentioned. Here is the link
Deletehttp://www.youtube.com/user/kudvenkat/videos?view=1&flow=grid
Tips to effectively use my youtube channel.
http://www.youtube.com/watch?v=nT9uF09RMkw
If you want to receive email alerts, when new videos are uploaded, please feel free to subscribe to my youtube channel.
http://youtube.com/kudvenkat
If you like these videos, please click on the THUMBS UP button below the video.
May I ask you for a favour. I want these tutorials to be helpful for as many people as possible. Please free to share the link with your friends and family who you think would also benefit from them.
Good Luck
Venkat
Hi, I was asked in the interview. what are the advantages and disadvantages of Entity Framework? Also when using entity framework, it causes severe load on the server, then y did you chose entity framework? Can you please explain with real time example. Thanks.
ReplyDeleteAdvantages:
DeleteOne common syntax (LINQ) for all object queries whether it is database or not , Pretty fast if used as intended , easy to implement SoC , less coding required to accomplish complex tasks.
Its fast and straight forward using LINQ/FE objects For Add/Modify/Delete/Update.
Easy to map business objects (with drag & drop tables on environment). It keeps a good performance when you work with a small / middle domain model.
Disadvantages:
You have to think in a non-traditional way of handling data , not available for every database.
If there is any schema change in database FE won’t work!!! You have to update the schema in solution as well!!!
It's limited when you work with a huge domain model. -Scalability.
Hello Venkat,
ReplyDeleteFirst of all thanks a lot for providing such a great material for .net,
I am finding an issue ADO.net code in SQL server and ASP.net connectivity, getting an System.NullReferenceException with detail
'Object reference not set to an instance of an object'. Kindly help me on this. Thank you
Hello Sir,
ReplyDeleteCan u tell me the process for hosting asp.net website? what changes we have to make in 'web.config' file?
venkat is the best ex planer of .net very nice sir good job
ReplyDeleteWhen queries are taking time, check if the joins are correct. That is the tables involved in the joins must be joined on the key columns.If some joins are missing then the queries will be slow as it produces huge recordset. Also pay attention to the type of joins (inner join, left-right outer join,cross join) and choose the appropriate one as per your scenerio.
ReplyDeleteThanks
I have read all the comments posted above.your material is very good.
ReplyDeleteI have not found anwers for this two Questions .Can you please help .
Hi, I was asked in the interview. what are the advantages and disadvantages of Entity Framework? Also when using entity framework, it causes severe load on the server, then y did you chose entity framework? Can you please explain with real time example. Thanks.
And Usually my users get a error in my website
the state information is invalid for this page or might be corrupted.
Can you please explain why this error and the solution to it ..pls reply
Mr.venkat you are realy super, excellent explanation in very easy manner to understand . your videos will become popular and you are the best asp.net trainer. Thank you a lot for your teaching & helping to the people. i would like to say i became fan of you .
ReplyDeleteHello Sir,
ReplyDeleteFirst off all I want thanks to you for your great work....keep on continue and help others...god bless you...
I have some interview questions which I faced in some interview...
1.What is binding in web services.
2.How to access databases which is there in another machine to our database connected each other through lan(that machine is not a server machine).
3.What is database mirroring....
1.Binding is where you connect your web service (what you are doing) to an endpoint location (where to execute it). A Web Services Definition Language (WSDL) binding looks like this.
Delete2.exec sp_addlinkedserver @server='IP'
EXEC sp_addlinkedsrvlogin 'IP', 'false', NULL, 'sa', 'password'
3.SQL Server database mirroring is a disaster recovery and high availability technique that involves two SQL Server instances on the same or different machines. One SQL Server instance acts as a primary instance called the principal, while the other is a mirrored instance called the mirror.
what is difference between page life cycle stages and life cycle events?
ReplyDeletewhat is daba abstraction?
ReplyDeleteReally venkat sir, You are giving very nice information ..which i never get before.. Thanks a ton for that ..keep it up..
ReplyDeleteAwesome explanations .....thank u so much....I dint learn in class that much I learn by watching your video....thank so much sir....its vry help ful ....I shared ur video to my frnds n they are learning with out class.
ReplyDeleteReally venkat sir, You are giving very nice information ..which i never get before.. Thanks a ton for that
ReplyDeletesir i have one question why we need iis to restart or application pool when service unavailable problem occurs..
why service unavailable problem occuring what setting to be impemented for that pls reply its very urgent
Really venkat sir, You are giving very nice information ..which i never get before.. Thanks a ton for that
ReplyDeletesir i want to ask one question in every 6hr or 5 hrs service unavailable problem occurs and we have to restart iis for that website or application pool recycle..what setting to be done to solved that issue
Hi! Venkat I am really thankful for your videos that helped me a lot in getting job as a fresher, I was previously working on windows based application and now I am facing issue to crack asp.net interview as they are not considering my experience for windows? How should I prepare so that I can crack the interview fast as asp.net is too vast and now i am finding difficult to learn mvc so fast.
ReplyDeleteHi, Thanks Venkat, I am really thankful to you for uploading such great tutorials on YouTube, I learned a lot from it.
ReplyDelete"Knowledge for all"
Hey Venkat,
ReplyDeleteI am full time follower of yours. Thanks a lot for the Video tutorials . helps a lot.
Could you please make video tutorial of Winforms.. waiting for it..
Thanks a lot again