Thursday, March 22, 2012

site slow / viewstate problems?

hi, ive created a music player app with the silverlight control and ajax. when i search for files and get alot of results (you can do this with an empty search string), subsequent requests to the server seem to take an excessively long time. for example, if you click up next after queueing up some of the songs, you can see how long it takes to just set the visibility of a panel. what could i do to make it run faster?

http://modesty84.dyndns.org

user: shawn

pw: partyb123

also let me know what you think of the site as it is, id be willing to show off the code :>

thanks

What exactly makes you think the ViewState might have something to do with the problem you're facing? I mean, couldn't you just take a look at its size and see if it even could be the problem? Have you monitored all the possible perf monitor while such jam happens?


well i think it is the view state because the site only seems slow when my search result listbox is full. theres really not a whole lot of code in this page, except for the generated ajax. i guess i could try tracing


EDIT: Sorry. Posted to the wrong window.

But as long as I'm here, let me weight in the issue at hand. It is very possible that ViewState could be part of the problem here (in a way) if you're updating the listbox on your Ajax requests. As you know. ASP.NET AJAX includes ViewState in normal Ajax requests so the ASP.NET page lifecycle does not break. When you've got hundreds of items in your list box representing about 75 KB of data, that's going to slow your application down. Perhaps you should put some validation on your textbox to reduce the number of results that can be returned and see if that helps.

On a side note, you should probably warn people that your site is possibly NSFW. If not for the background image than for the names of the songs/directories you load. :)

-Todd


is there anyway to disable my searchresults listbox from being posted back when i click up next?


It all depends on how you've laid out your UpdatePanels. Ideally, you should wrap update panels so they only update the smallest number of items possible. If an update needs to update multiple areas of the screen, use Triggers to handle the interaction.

That said, as long as your "Up Next" button is in a separate UpdatePanel from your ListBox, you should have no trouble updating it and a panel (or whatever) separately from your listbox.

Thanks~
Todd


they are in different updatepanels, but it looks like by default they are refreshing eachother. it seems like i need to set its updateMode to conditional and add a trigger.ill try this when i get home

Mod-

Yes, you need to set UpdateMode to conditional to update panels independently from each other. Check out this excerpt from the ASP.NET Ajax documentation for more details:

How UpdatePanel Controls Are Refreshed

The following list describes the property settings of theUpdatePanel control that determine when a panel's content is updated during partial-page rendering.

If theUpdateMode property is set toAlways, theUpdatePanelcontrol's content is updated on every postback that originates fromanywhere on the page. This includes asynchronous postbacks fromcontrols that are inside otherUpdatePanel controls, and postbacks from controls that are not insideUpdatePanel controls.

0 comments:

Post a Comment