This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I'm running into a fairly strange performance issue when using Lightspeed. I have the following linq statement:
I basically return an IQueryable
This produces reasonably nice sql (there is more columns that I need for my select, but it isn't a terrible query):
And in the output window (with a trace enabled on the context), I see reasonably small timings (under 10ms). If I run this query in SQL Management Studio, I get a similarly quick response. There are a significant amount of records in the tables (approx ~500k). Now where I run into problems is on my website. I have MiniProfiler setup (as per the blog post instructions) and I get a noticeable 900-1100ms timing for this query (and the page does take this long - it's not an error in reporting). I've attached a partial screenshot to demonstrate this. Is there something I'm doing stupid that could be causing these performance issues? Is there any options I can set to tune this query? I basically don't need any caching - I simply want to results into my TransactionInfo objects so I can show info on a page. Cheers & thanks, -Brad |
|
|
Are you connecting to the same database server in all cases? From your troubleshooting it sounds like you've eliminated everything except connection and network overhead to the database server. Or you could be running low on RAM on the web server and this page is thrashing the disk. Can you do a .ToList() on the query or do you really need to append? |
|
|
I'm definitely pointing to the same database - what's strange is that the Output window in VS is showing a query time of 4ms for one particular query - but the mini profiler (and a System.Diagnostics.Wtopwatch instance which I've wrapped around the execution of the query) are both showing 950ms+ (for the same query). SQL Profiler is showing 2ms for that instance of the query. I've tried taking off the Take() & Skip(), and have removed the AddRange() from my original post. Unfortunately, this didn't make any positive difference. |
|
|
It shouldn't be this expensive, but could you check how the performance is when you turn off the logging on the LightSpeedContext? Historically this has been an area where some folks experience perf problems because logging is actually relatively expensive compared to a query. It's just a guess at this stage without seeing a code snippet to reproduce it :-) Let me know if that helps, John-Daniel |
|
|
I turned off all logging. I'm still getting very similar timings (it's slightly better at around 850ms to 950ms) which is still around 800ms to 900ms longer than it should be. Looks like it's time to try and reproduce in a solution I can share with you guys. :-( Cheers & thanks, Brad |
|
|
minor point [especially as I don't use/understand the ORM product!] I notice that your original C# constructor has a trailing comma. HTH Dick |
|
|
Hi Brad, If you are able to reproduce the same timings in a console/windows application rather than a web application then that sounds like the cost would be in handling the response from the database and performing the object materialization, which would be slow unless we are talking about a very large number of objects. If that is the case would you be able to send through the console/windows application version which would allow us to reproduce the problem here and have a look into what is going on.
|
|