The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Hierarchical binding is slow

Last post 05-02-2008, 7:51 AM by Mike.Griffin. 7 replies.
Sort Posts: Previous Next
  •  05-01-2008, 3:14 AM 9125

    Hierarchical binding is slow

    My hierarchical binding is very slow, because my hierarchical data come from web service. Whether hierarchical binding is one by one?  When parent collection has loaded, whether child collection has loaded at the same time?  Or child collection begins to load when user click "+" in grid control?

    Is there any idea for performance of hierarchical binding?

     

     

  •  05-01-2008, 3:54 AM 9126 in reply to 9125

    Re: Hierarchical binding is slow

    Hi

    I'm sure one of the EntitySpaces team will reply to this but to the best of my knowledge the child collections are lazy loaded and will therefore only be loaded when you try to access them (otherwise you could end up bringing huge amounts of data back from the DB that is never used) - for example:

    Customer table

    Orders table

    Order details table

    If you were to load all of these at once you'd end up with all of your customers, and all of their orders, with all of the order details (which may involve info from a products table which would also need to be loaded, where the product table may be linked to a Supplier table, so you'd need to load all suppliers too) etc etc.  If you wanted to look at the orders of a single customer in your grid (or whatever) you'd end up loading huge amounts of info that simply doesn't get used in this instance, so I think it makes sense to lazy load in these instances.

    As for speeding it up, you may want to look into some form of caching if that helps, but if your web service is slow there may be other reasons (EntitySpaces itself is very fast so is unlikely to be your bottleneck in this instance).

    Hope that helps

    Martin

  •  05-01-2008, 4:43 AM 9127 in reply to 9126

    Re: Hierarchical binding is slow

    Martin


    Thanks for your detailed reply.


    Lazy loading is very good.


    When I bind parent collection, if entityCollection.EnableHierarchicalBinding = false,binding is quick, but EnableHierarchicalBinding = true, binding is slow.

     

  •  05-01-2008, 5:55 AM 9128 in reply to 9127

    Re: Hierarchical binding is slow

    Hi

    You'll need one of the ES guys to answer this but it may be that ES is "walking the tree" in order to work out column names etc for binding.

    Are you saying that it is slow when you first display the screen or when you walk through the hierarchy using your UI?

    Thanks

    Martin

  •  05-01-2008, 10:16 PM 9151 in reply to 9128

    Re: Hierarchical binding is slow

    Thank you Martin.

    Yes,it is slow when I first display the screen.

    I have tested it._collection.EnableHierarchicalBinding = false take 2 second. _collection.EnableHierarchicalBinding = true take 6 second.

     

    I am using ES2007.1.1210.0 and Binary serialization and DevExpress.XtraGrid.

  •  05-02-2008, 6:07 AM 9155 in reply to 9151

    Re: Hierarchical binding is slow

    You said:

    I am using ES2007.1.1210.0 and Binary serialization and DevExpress.XtraGrid.
    One thing about our Binary Serialization is that it produces a very big packet and is slower than the XML serialization.  Unless you need Binary I would use XML, in fact, our Xml Proxies would be very fast. They do not do hierarchical serialization however. 
    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-02-2008, 7:11 AM 9157 in reply to 9155

    Re: Hierarchical binding is slow

    I do not think Binary Serialization is why first Loading is slow, because there are only 10 rows in the parent collection.

    I use Binary because there is not yet ES WebService Template and in order to shorten my code I serialize entity and collection on ES base class level. All of entity and collection use one simply webservice that supply WebMethod as follow, but Xml proxy can not do like this.

     

    Code:
    [WebMethod]
    public DataSet LoadDynamicQuery(byte[] esDynamicQueryBinary)
    
    [WebMethod]
    public byte[] LoadEntityCollection(byte[] esEntityCollectionBinary, int queryType, string query, byte[] parms)
    
    [WebMethod]
    public byte[] SaveEntity(byte[] esEntityBinary)
    
    [WebMethod]
    public byte[] SaveEntityCollection(byte[] esEntityCollectionBinary)
    

    Another question, does Xml proxy support hierarchical binding?

    thanks.

  •  05-02-2008, 7:51 AM 9158 in reply to 9157

    Re: Hierarchical binding is slow

    Here's how you use the Proxies ...

     

    Code:
    [WebMethod]
    public string GetEmployee(int i)
    {
        Employees emp = new Employees();
        if (emp.LoadByPrimaryKey(i))
        {
            // The Generated Proxy class
            EmployeesProxyStub proxy = new EmployeesProxyStub(emp); 
    
            // Manually Serialize into string form (we want to deserialize it on the other side)
            XmlSerializer sf = new XmlSerializer(typeof(EmployeesProxyStub));
            StringWriter sw = new StringWriter();
            sf.Serialize(sw, proxy); 
    
            return sw.ToString();
        }
        else
            return null;
    }
    

     They currently do not do hierarchical, but I don't recall the binary doing that either, it's been a long time though, I could be wrong.

     


    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML