CodeSmith Community
Your Code. Your Way. Faster!

First hit through Web Service to DAL takes 3 minutes!!

Latest post 04-22-2008 10:15 AM by SuperJeffe. 9 replies.
  • 04-17-2008 5:44 PM

    • belk
    • Not Ranked
    • Joined on 04-17-2008
    • Posts 5
    • Points 145

    First hit through Web Service to DAL takes 3 minutes!!

    Hi guys!

     We just start using NetTiers in a major production project. We liked the many features that it provides but we are "terrified" by the performance at start up. I hope this is only due to our ignorance!

    We are using a Microsoft Smart Client Software Factory application that initiate a web service call through HTTPS to a backend server that is exposing the database through NetTiers Data Access Layer. We are using the NetTiers serialization and the whole 9-yards. It's NetTiers 2.2.

    The first call to the database (no matter how small the data to be returned, in a case it's only one record, containing the string 'Global') is taking 3 minutes...after that; subsequent calls are pretty fast (even tons of data).

    Here is what we think is the hog:

     

    public override Cornerstone.BusinessLogicLayer.TList<NavTree> GetPaged(TransactionManager transactionManager, string whereClause, string orderBy, int start, int pageLength, out int count){

                            whereClause = whereClause ?? string.Empty;

                            orderBy = orderBy ?? string.Empty;

                WsProxy.dev1CurrentForecastServices proxy = new WsProxy.dev1CurrentForecastServices();

                            proxy.Url = Url;

                            WsProxy.NavTree[ items = proxy.NavTreeProvider_GetPaged(whereClause, orderBy, start, pageLength, out count);

                            // Create a collection and fill it with the dataset

                            return Convert(items);

                    }

     

    what are we doing wrong?

    Any help will be greatly appreciate, especially if it is ASAP...before we switch to other ORM mapper.

     

    Thanks

     

     

     

    • Post Points: 65
  • 04-17-2008 9:57 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 342
    • Points 8,610

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Well, maybe a little more background before i can answer.

    1.  Are you using your own web services and then calling Nettiers Data Layer?  Or are you using the generated web services?  I guess the question is which layers of nettiers are you using.

    2.  Where is the time taking.  I would guess the time is taking on the webserver, not the database server.  Not to sound trivial, but the first Web Service / ASP.NET server is very slow while the service is compiled.  Make sure your not running into the JIT compiler.

    I have done a TON of performance testing of Nettiers and I can tell you that the Business Layer (Service Layer) down through the Data Layer performs really well.  Everytime I update templates I run the performance app I wrote to verify the templates haven't changed negetively.  I have not tested the web service layer since I don't use it.

    One thing that I have not tested in my app is the way nettiers serializes objects in web services.  We use Nettiers through Remoting and WCF and use binary serialization.  I do know that Nettiers objects are pretty heavy when it comes to serialization.  Objects that hold collections of other objects and hold many sets of it's own data (Original Values) don't serialize all that well.  Of course, again, this really isn't a nettiers thing persay, it's the design pattern and the functionality that it holds.  In this area, I don't think any ORM is going to serialize any better unless they support fewer features.  Code is code and there is only so many ways to skin a cat.

    Let me know exactly how your using it, I would be interested to know.  I love performance testing this stuff and I might add it to my test app.

    Jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 04-18-2008 2:07 AM In reply to

    • brcvogt
    • Top 75 Contributor
    • Joined on 02-21-2007
    • South Africa
    • Posts 61
    • Points 1,445

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Hi,

    I don't use the web services, but I am also having a problem.  Sometimes when (actually most of the times) I start my application it takes a while to load up.  And I only have a repeater control on my page.  I am looking for really fast start up/loading pages.  Why does this take so long to load up?  Is it just me?  Or is there other people also that is having long page loads at start up of a web application?

    Thanks
    Brendan

    • Post Points: 35
  • 04-18-2008 8:36 AM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 342
    • Points 8,610

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Turn tracing on and put some tracing statements in some of your code and see where the time is taking.  The first page load of every .NET application takes a while.  I am sure there are lots of discussions on first page request out on the web.

    Here are some links I found with a quick google search.

    http://channel9.msdn.com/ShowPost.aspx?PostID=173509

    http://forums.asp.net/t/1092591.aspx

    Jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
  • 04-18-2008 3:24 PM In reply to

    • belk
    • Not Ranked
    • Joined on 04-17-2008
    • Posts 5
    • Points 145

    Re: First hit through Web Service to DAL takes 3 minutes!!

     

     Thanks Jeff,

    The answer to 1 is: generated web services

     The answer to 2: Either occurs when time instanciating the proxy web services classes on the client side, or the on the business layer on the web server! Don't think this is due to Database Server!

     We are doing serialization as provided by the generated web services (i.e., by NetTiers itself).

     

     

     

     

    • Post Points: 5
  • 04-19-2008 1:40 PM In reply to

    • belk
    • Not Ranked
    • Joined on 04-17-2008
    • Posts 5
    • Points 145

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Jeff I am still waiting for your input. Let me know if you need more about the backgound.

    • Post Points: 35
  • 04-21-2008 12:32 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 342
    • Points 8,610

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Well, it's really tough to be able to track this down.  My gut tells me that it's compiling.  I think there might be one way to test to see if this is a compiling thing vs a startup thing.

    After you run several tests, modify the web.config file in notepad.  Just add a blank space to it somewhere and save it.  This will force the App Pool to recycle and start a new one.  If after you do this, the time takes as long as the first request did, then it is something in the startup of the app pool, which could lead to the global.asax file maybe.  Just not sure.

    3 minutes is a long time but if they break out there web services per Entity, there are probably alot of things getting compiled.  I still think 3 minutes is rediculous but it depends on alot of things.

    Make sure the first call is compiled.  Build the project, clean out the Bin folder, and deploy the new website.  This should force the compile.  Then test it a few times, change the config, re-test.

    Try that.

    Jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 60
  • 04-21-2008 8:38 PM In reply to

    • belk
    • Not Ranked
    • Joined on 04-17-2008
    • Posts 5
    • Points 145

    Re: First hit through Web Service to DAL takes 3 minutes!!

    I will certainly try it write away. I'll let you know the outcome.

    • Post Points: 5
  • 04-22-2008 9:20 AM In reply to

    • belk
    • Not Ranked
    • Joined on 04-17-2008
    • Posts 5
    • Points 145

    Re: First hit through Web Service to DAL takes 3 minutes!!

    Jeff, here is the finding:

     

    Even a pre-JIT does not improve things...so that eliminate the compilation hypothesis.

     In fact, we have found where the problem lies, but we don't know how to solve it. The problem is related to creating proxy classes for the tables. The more tables you include, the slower it gets. One solution could be to try to break the web services into small calls that involves only small number of tables. We have not tried this yet. But we would like the hear the expert such as yourself on what's the best practices with this regard.

     

    Thanks.

    • Post Points: 35
  • 04-22-2008 10:15 AM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 342
    • Points 8,610

    Re: First hit through Web Service to DAL takes 3 minutes!!

    To call me an expert on Web Services is a stretch.  I deal with alot of ASP.NET sites but not Web Services.  The web services I have done are very small.  We use remoting for our main system.  It sounds like your on the right track.  It really sucks that the generated proxy is that inefficient.  I will generate the Web Services project on my Northwind database and connect to it just to see if I can see anything that is really unusual.  You have sparked my curiosity on how the web services project is laid out.

    jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
Page 1 of 1 (10 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems