Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep. 02, 2014, 04:57:05 PM
56607 Posts in 12738 Topics by 18788 Members
Latest Member: dityhecor
News:
 
The PRADO Community » Prado v3.x » General Discussion » Active Controls (Ajax) » Performance of Prado Callback !! « previous next »
Pages: [1] 2 Print
Author Topic: Performance of Prado Callback !!  (Read 6117 times)
trann
Junior Member
**

Karma: 0
Offline Offline

Posts: 7


View Profile
« on: Mar. 19, 2007, 06:10:18 PM »

Hye, I got performance problem with my PRADO application, specially for Callback (I use PRADO V3.1.0a) !
Excuse me for my english !!!

I have a page with about 10 input fields, labels, images , ...

Each input field have a button which display a list of available values when the user click it. The list can have severals orderable columns.

I used PRADO ActiveControls not to reload the entire page at each list displaying.

First, I develop list in Template contained in the input page. On Callback on the TActiveImageButton, I call a PHP function in the Template. This function read the database, databind it in a DataList, and display the list in a TActivePanel.
That works, but the list is displayed after 4 or 5 seconds, and it's the same for ordering columns and rendering the selected value.

After tests, it appears that "TPage->processCallbackRequest" is very long, and specially "TTEmplateControl->initRecursive".
If I test my list in a page with only 1 input field, the list is displayed after 2 seconds.

I tried to develop another list with an Ajax Call, not a Prado Callback. That call a php file which read the database and create a xml file.The xml file is traited on the client side by Javascript.
Fonctionnality is the same, but thise list take less than 1 second to render.

Can you tell me if I have to develop again all of my lists with an Ajax Call or is there a way to reduce the execution time of TTEmplateControl->initRecursive to make it acceptable ?

test_page.page
Code:
<com:TActiveTextBox id="acperso" Columns="5" maxLength="5"  cssClass="valeur_champ_dans_panel"/>
<com:TActiveImageButton id="boutAcpers" ImageUrl="images/liste.gif" CssClass="imag_liste" AlternateText="Ouvrir la liste"
onClick="Page.ListeAcpers.choix_acpers" onCallback="Page.ListeAcpers.aff_acpers">
<prop:ClientSide OnLoading="$('loading').show();" OnComplete="$('loading').hide();"/>
<prop:Attributes.onmouseover>MM_swapImage('<%=$this->boutAcpers->UniqueID%>','','images/liste2_01-over.gif',1);</prop:Attributes.onmouseover>
<prop:Attributes.onmouseout>MM_swapImgRestore();</prop:Attributes.onmouseout>
</com:TActiveImageButton>
<com:ListeAcpers id="ListeAcpers"/>

ListeAcpers.tpl
Code:
<com:TDataList id="ListAcpers"
HorizontalAlign="Left"
Cellpadding="0"
Cellspacing="0"
DataKeyField="Coacpe"
OnSelectedIndexChanged="selectItemAcpers"
ItemStyle.BackColor="#FFFFFF"
HeaderStyle.cssClass="invite_champ_left"
AlternatingItemStyle.BackColor="#f3f1f1">
<prop:HeaderTemplate>
Code&nbsp;
<com:TActiveImageButton
id="triCoacpe"
ImageUrl="images/tri_on.gif"
AlternateText="Trier sur le code"
CommandName="Coacpe"
CommandParameter="Coacpe"
onCommand="Page.ListeAcpers.TrierAcpers"
onCallback="Page.ListeAcpers.aff_acpers">
<prop:ClientSide OnLoading="$('loading').show();" OnComplete="$('loading').hide();"/>
</com:TActiveImageButton>
</td>
<td class="invite_champ_left">Libell&eacute;&nbsp;
<com:TActiveImageButton
id="triLiacpl"
ImageUrl="images/tri_off.gif"
AlternateText="Trier sur le libell&eacute;"
CommandName="Liacpl"
CommandParameter="Liacpl"
onCommand="Page.ListeAcpers.TrierAcpers"
onCallback="Page.ListeAcpers.aff_acpers">
<prop:ClientSide OnLoading="$('loading').show();" OnComplete="$('loading').hide();"/>
</com:TActiveImageButton>
</prop:HeaderTemplate>
<prop:ItemTemplate>
<a href="#" onclick="javascript:selectAcpers('<%#$this->DataItem['Coacpe']%>','<%#$this->DataItem['Liacpl_sansquote']%>');" class="sans_soulign"><%#$this->DataItem['Coacpe']%></a>&nbsp;</td>
<td class="pasWrap">&nbsp;<a href="#" onclick="javascript:selectAcpers('<%#$this->DataItem['Coacpe']%>','<%#$this->DataItem['Liacpl_sansquote']%>');" class="sans_soulign"><%#$this->DataItem['Liacpl']%></a>&nbsp;</td>
</prop:ItemTemplate>
<prop:AlternatingItemTemplate>
<a href="#" onclick="javascript:selectAcpers('<%#$this->DataItem['Coacpe']%>','<%#$this->DataItem['Liacpl_sansquote']%>');" class="sans_soulign"><%#$this->DataItem['Coacpe']%></a>&nbsp;</td>
<td class="fond_gris">&nbsp;<a href="#" onclick="javascript:selectAcpers('<%#$this->DataItem['Coacpe']%>','<%#$this->DataItem['Liacpl_sansquote']%>');" class="sans_soulign"><%#$this->DataItem['Liacpl']%></a>&nbsp;</td>
</prop:AlternatingItemTemplate>
</com:TDataList>

ListeAcpers.php
Code:
public function choix_acpers($sender,$param)
{
$datacti = $this->Page->DPC_Daacti->getText();
$dateTS = $this->Page->Master->calc_dateTS($datacti);
$agent = $this->Page->coAgent->getText();
$lignesAcpers = $this->chargeAcpers($agent,$dateTS);
$lignesAcpers = $this->Page->Master->columnSort($lignesAcpers,'Coacpe');
$this->setViewState('mesLignesAcpers',$lignesAcpers);
// Affectation du resultSet à la dataSource
$this->ListAcpers->setDataSource($lignesAcpers);
$this->ListAcpers->dataBind();
//Affichage du placeholder
$this->panelAcpers->Style="display:block;position:absolute;height:450;background-color:white";
$this->placeHolderAcpers->Visible = true;
}
function aff_acpers($sender,$param)
{
$this->Page->ListeAcpers->panelAcpers->render($param->NewWriter);
}
Logged
wiktor
Senior Member
***

Karma: 3
Offline Offline

Posts: 55



View Profile
« Reply #1 on: Mar. 19, 2007, 11:02:54 PM »

is it an execution time problem or execution+download ?
I've had a big performance problem on my second test server: this server is much faster and has about 5x faster connection than my primary test server, but every callback took about 2 times longer. I've found that pagestate was more than 20x larger ( about 90k vs 4k ). After few tests I realized that compiling php --with-zlib solves the problem. (zlib is marked as optional in PRADO requirement check) Check if you have this compression enabled. I send a lot of data (change a lot of contols) during callback, but my application works really fast.
Logged
trann
Junior Member
**

Karma: 0
Offline Offline

Posts: 7


View Profile
« Reply #2 on: Mar. 20, 2007, 01:36:36 PM »

Thanks for your answer !
The problem is execution time.
zlib compression was not active in my PHP.
I will turn it on and test.
Logged
trann
Junior Member
**

Karma: 0
Offline Offline

Posts: 7


View Profile
« Reply #3 on: Mar. 20, 2007, 08:27:19 PM »

I  have tested with "zlib.output_compression = On" and "zlib.output_compression_level = 5" in my php.ini, but that doesn't change anything.
I always have to wait at least 4 seconds before my list display, even if there is only 1 element in my list.
Pagestate is 12K.
I dont know whate else to do.

Logged
d3lt49
Senior Member
***

Karma: 1
Offline Offline

Posts: 104



View Profile
« Reply #4 on: Mar. 20, 2007, 08:59:13 PM »

Maybe run YOUR_PRADO_DIR/requirements and look is zlib correctly compiled with php?
Logged
trann
Junior Member
**

Karma: 0
Offline Offline

Posts: 7


View Profile
« Reply #5 on: Mar. 20, 2007, 11:53:38 PM »

I run PRADO Requirements Checker.
I had a problem with PDO extension check, I solved it, but it doesn't solve my problem !
The following extension are not activated : SQLite extension, Memcache extension, Mcrypt extension check, XSL extension check and SOAP extension check.
All other requirements are ok.
Logged
christocracy
Senior Member
***

Karma: 2
Offline Offline

Posts: 95


View Profile WWW
« Reply #6 on: Mar. 23, 2007, 10:55:28 PM »

you have to be careful with prado viewstate.
forget about binding TDataGrids / TRepeaters with data.
let the client hold the ViewState in the form of javascript ui widgets, a la Jack Slocum's Ext http://www.jackslocum.com library.

I wrote a series of prado wrappers for Ext components instead.
RWebControl, RDataGrid, RDragDropGrid, RDialog, RBorderLayout.

I have now a language-neutral javascript library for generating Ext components.

I recently got into RoR.  this prado-inspired Ext wrapper works great there too.  in fact I've got a very prado-like callback-handling mechanism going on in RoR.  I use the same name for the callback url, even.  my WebControls are defined serialized YAML objects and simply inherit from ruby's base Object class, rather than the longer chain of inheritance in Prado (TComponent > TControl > TWebControl > TCallback > RMyExtension)

In RoR, I'm back to response-times in teh order of 125-500ms, usually.
I was getting into the 1 - 2s for some actions.
Prado has much more parsing to do, when it rebuilds the whole page tree on each callback request.

a guy needs to be able to pump callback requests into a simple prado JSON Server and revive page components on request.

it's way too expensive to send callbacks to a page laden with TDataGrid / TRepeaters.

view the docs on slocum's site for the component Ext.data.Store.
see the examples!

« Last Edit: Mar. 23, 2007, 11:13:11 PM by christocracy » Logged

derryl
Newbie
*

Karma: 0
Offline Offline

Posts: 3


View Profile
« Reply #7 on: Mar. 26, 2007, 02:13:35 PM »

Hi,

there is some cool solution to store the pagestate right on the webserver instead of serving it to every page. Look here: http://www.pradosoft.com/forum/index.php/topic,6515.0.html
But I did not tried this yet with active controls.

greets,
Derryl
Logged
Urkman
Senior Member
***

Karma: 2
Offline Offline

Posts: 186


View Profile WWW
« Reply #8 on: Mar. 27, 2007, 07:01:21 AM »

Hello,

I think I join here with my Performance Problem...

I made my own Ajax Style DataTable and everything works fine. There is no problem paging through all Records( using Callback ) and searching ( using Callback ).

But now I need to display 500 - 1000 records in my Table. And now I have a problem :-( My Page Execution Time is less then one second, but the Time to display the next Page takes more than 5 Second on my Client ( Firefox 2.0.0.3 ). I made some profiling using FireBug and I found that more than 75% of this time is used by "extractContent"...

Is there a way to speed up this Funktion?

Thanks for your Help,
Urkman
Logged
christocracy
Senior Member
***

Karma: 2
Offline Offline

Posts: 95


View Profile WWW
« Reply #9 on: Mar. 27, 2007, 04:02:51 PM »

you mustn't ever load 500 - 1000 records into ViewState.

you have to use paging (LIMIT & OFFSET)

Logged

Urkman
Senior Member
***

Karma: 2
Offline Offline

Posts: 186


View Profile WWW
« Reply #10 on: Mar. 28, 2007, 06:00:38 AM »

Hello,
you mustn't ever load 500 - 1000 records into ViewState.

I don't load any Record into Viewstate. My Tables get rendered using plain HTML and no PRADO Components.
I use FileCaching to access the Data... My PageState is never bigger than 150k. And I think this is OK...

you have to use paging (LIMIT & OFFSET)

As I wrote, I use paging. I have to display Datasets of about 20.000 - 30.000 rows. And my users want to see 500 - 1.000 rows per Page...

My Problem is not ViewState, it is the JavaScript Function "extractContent" which eats 75% of the Time( 5sec ) to display the next Page...

Greetings,
Urkman
Logged
vincedev
Senior Member
***

Karma: 12
Offline Offline

Posts: 349


Weather seems cold today...


View Profile
« Reply #11 on: Mar. 28, 2007, 03:22:53 PM »

Hi,
I look at this function extractContent, can someone explain me this part of the regex : ([\\s\\S\\w\\W]*) , because, firstly i think that replace ([\\s\\S\\w\\W]*)  by (.*) will be the same but no....
Logged

.......Vince.......
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2869



View Profile
« Reply #12 on: Apr. 01, 2007, 03:20:37 AM »

Quote
JavaScript Function "extractContent" which eats 75% of the Time( 5sec )

damn, i hoped that i could get away using just regexp to get the data. Looks like a custom text parser is required... i was hoping Wink

Please submit a ticket for this (and some sample test code would be nice too). If you are returning 150k page state, may be store the page state on the server side. Remember that 150k page state means more than 150k of data going both ways (and often), may be disable some of the viewstate.

Now regarding, the "initRecursive", could you post a sample for this please (email me if you need to)? please remove database access from the sample.
Logged
wei
PRADO v3.x Developer
Diamond Member
*****

Karma: 65
Offline Offline

Posts: 2869



View Profile
« Reply #13 on: Apr. 01, 2007, 03:23:13 AM »

may be change, ([\\s\\S\\w\\W]*) to ([\\s\\S\\w\\W]*)?+ for non-greedy search
Logged
Urkman
Senior Member
***

Karma: 2
Offline Offline

Posts: 186


View Profile WWW
« Reply #14 on: Apr. 02, 2007, 11:54:05 AM »

Hello Wei,

when I try this:

may be change, ([\\s\\S\\w\\W]*) to ([\\s\\S\\w\\W]*)?+ for non-greedy search

I get a lot of errors:
Code:
invalid quantifier +(<!--\/\/X-PRADO-DATA-->)

With this Line of Code:
Code:
var f = RegExp('(<!--'+boundary+'-->)([\\s\\S\\w\\W]*)?+(<!--//'+boundary+'-->)',"m");

Greetings,
Urkman
Logged
Pages: [1] 2 Print 
« previous next »
Jump to: