0

i have an application that runs normally in my first website.

If i move this applicatio to another server, but i don't move db (that remains to server 1), it runs very slowly to retrive data from sql.

The problem is only network or is there any issue in my code? I use ADO.NET with LINQ...

Thank

2
  • This is why you should develop in a similar environment as what you expect to have in production. Commented Oct 14, 2011 at 15:16
  • my app was developed in the same environment as production but now i have to separate db and app Commented Oct 15, 2011 at 15:27

2 Answers 2

1

If they were residing on the same server before and now their not, then yeah it's almost certainly a network issue. Are the servers housed in the same location? I'm taking a guess here since I don't have adequate information, but there's a chance that your intranet isn't configured correctly or you're using an external IP's. In that case one or both of the request and response are being sent out over the internet when they could be using your or your company's internal network to communicate.

Sign up to request clarification or add additional context in comments.

1 Comment

yes this is my situation. i only can try to improve my network speed. my query are very small... i use external ip. thanks
1

Profile your queries. See how much time it takes to execute each. If your queries return fast, the problem might be your front-end code or the network.

You can log your Linq queries to console (or a Textwriter, for example). Something like:

dataContext.Log = Console.Out;

Then run the queries in SQL Server and see how efficient they are. Do they use indexes? Do they perform table scans? etc.

2 Comments

Are they returning more fields and/or more records than you actually need? The more data flows across the network the slower it is. Any query with a join and select * for instance is wasting server and network resources.
no, my querys are like "var q = (from c in db.Table where c.Attivo = 1 select new { ... });" or this "P_FTIC.entities.Contatti C = db.Contatti.Where(x => x.IDContatto == _id && x.Attivo == 1).SingleOrDefault();"...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.