Hi.
I have an web application with serious performance problems.
I the AspxGridview a lot and I connect the gridview to my business objects trough objectdatasource.
I think objectdatasource always transfer all data. No paging support…
I have spend a lot of time testing other ORM tools. Entity Framework(EF) and XPO.
I created a testproject that displays the same data. A table with 4000 records and 14 columns.
One grid with XPO, one with EF and one with Objectdatasource.
! place one of the columns(lookup combobox) in the group panel.
Objectdatasource is very slow. about 15 sec.
XPO and EF is both around 1 sec.
If I on the comboboxcolumn change the sortmode = displaytext
XPO takes around 8 sec
EF takes around 2 sec
Why this big difference?
If the performance of EF is so much better than XPO, then my choice of ORM tool is easy?
thanks
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Magne,
The question about performance is very delicate, and it is not possible to answer it without additional information. I think that ObjectDataSource is the fastest data-binding control comparing to XPO and Entity datasources. However, its implementation is so simple, so it will not suit you well in complex scenarios (where grouping and filtering are used).
The page might be slow because of multiple reasons (Performance - How to improve the page rendering speed).
If possible, please provide me with an example (with a database that contains fake records), so I can examine your code and explain what was wrong.
Thanks,
Vest
Hi.
I have attached an sample project to demonstrate.
Please notify me if you encounter any problems with the project.
Run Default.aspx. It contains 3 links. XPO, EF and ODS
When I created this project I stripped down my origional business classes.
And suddenly the ODS processing time went down from 15n sec to 8 sec. About the same as XPO use.
Origional the Equipment class contained a couple of custom properties that look up their values from another table.
Maybe this is not an good aproach in web applications?
I also notice if I on the grouped column (LokalitetId) switch sortmode to value insted of displaytext the ODS is very fast.
thanks
Hello Magne,
Thank you for the application. I will try to optimize it to make it fast :)
If you enable the XpoDataSource.ServerMode property, the grid will be bound to XPO objects in a Server Mode:
<dx:XpoDataSource ID="EqXpoDS" runat="server" TypeName="UtstyrsIntra.Equipment" ServerMode="true"></dx:XpoDataSource>
Please note that combo boxes cannot be bound to XPO datasources in a Server Mode.
2. The Entity Framework
Instead of EntityDataSource, please use the LinqServerModeDataSource component with the following layout:
<cc1:LinqServerModeDataSource ID="EqEntityDS" runat="server" ContextTypeName="XPO_vs_EF.UtstyrsIntraEntities" TableName="Equipments" />
Unfortunately, editing operations will not work without additional code. You have to handle necessary events manually.
3. ObjectDataSource
I will not modify your code, because it requires significant changes. However, your code gave me a clear idea why ObjectDataSource is slow. You accidentally forgot to enable the paging feature.
Please take a look at the Bind a grid to a ObjectDataSource with EnablePaging example that demonstrates how to speed up such a datasource.
P.S. Just in case, I have attached the modified application without the database.
Thanks,
Vest
Thanks for the modified application.
With your modifications both XPO and EF is very fast.
But I notice that sortmode= displaytext does not work with XPO and servermode= true
Neither with LinqServerModeDataSource.
thanks
Magne,
This is a side effect of the Server Mode concept. The database server cannot process data that is accessible from .NET code only.
Is it necessary for your application to sort values by the displayed text? It is not easy to do this for all scenarios, but for some tasks it is possible to implement such sorting.
Thanks,
Vest
Hi.
Yes it is necessary.
If you look at the grouped column in the sample you can see that it is a combobox.
It should be sorted alfabeticaly by displaytext so users easily can locate the LokalitetId group they are looking for.
If the groups are sorted by value (GUID) the users have to look trough all groups to locate the group they are looking for.
I have tried this approach earlier, but I got complaints .
I assume this is a common problem. I wonder how other people solve this?
Do you thin it is bad design to use lookup comboboxes in an web application, maybe the grid should work against an prepared
DB view insted? But what about editing then?
Do you have any thoughts on this?
thanks
Hello Magne,
Thank you for your response. We need some additional time to review this scenario to provide you with a precise answer.
We appreciate your patience while we are working on finding a solution to your inquiry.
Regards,
Mike
Hello Magne,
Thank you for your patience. ASPxGridView can create columns and sort them when you define a complex field name. For example, let us assume that you have a composite object. One of its properties is an association with a different object:
<code lang="cs>
public class CompositeObject {
public OtherObject Obj { get; set; }
}
public class OtherObject {
public String Name { get; set; }
}
</code>
When you bind the grid to a set of CompositeObject objects, you can refer to their nested properties using the following signature: Obj.Name. You see that I use the Obj property and then obtain its Name property value.
For you, it looks like a displayed text, and you can sort such records easily.
Please create an <helplink href="ms-help://DevExpress.NETv11.2/DevExpress.Xpo/clsDevExpressXpoAssociationAttributetopic.htm">association</helplink> in your XPO classes and then use the nested property as a column field name.
Thanks,
Vest