Click here to Skip to main content
15,887,410 members

Comments by NuttingCDEF (Top 131 by date)

NuttingCDEF 7-Apr-12 15:24pm View    
First, this is large, but unless your app needs to retrieve significant portions of the data at once I wouldn't have thought that it should be unmanageable.

Is your server 32-bit or 64-bit? If 32 bit, have you considered going 64 bit and adding more RAM (AFAIK 32 bit can only use 4GB)? I presume that this is at least a moderately fast multicore server - and that network bandwidth isn't the issue (are you on at least Gigabit?).

How many clients do you have? Is the problem a few clients that each put huge load on the database or lots of clients with a small load each? Are you retrieving more data than you actually need?

General rule: adding indexes helps with performance of SELECT - but slows down INSERT - so you want to have only those indexes that actually help with the specific queries that you actually use - so knowing whether the real issue is your SELECTs or your INSERTs might help - which is actually taking the bulk of the time?

DETA can help a lot with this - maybe kill a few indexes, then use DETA to see what it suggests adding back

For INSERT, the performance difference between lots of individual inserts, one row at a time (which is what LINQ generates) and BULK INSERT is typically massive (can be a couple of orders of magnitude) - SQL Profiler has helped me identify this and other issues.

With LINQ I've also found that iterating through result sets can be slow as it may only retrieve data on demand one row at a time - adding things like .ToList() at the end of queries can force LINQ to retrieve the entire result set in one go, which can be hugely faster. Again SQL Profiler can identify what queries are actually being fired at the database. Using this I've taken code that generated 10s of 1000s of queries and made minor changes that have reduced it to a few 10s only and achieved exactly the same.

I'd also look at your queries. Are you always querying on exact matches for fields that have been indexed? If not (especially if you are doing anything like WHERE [Field] CONTAINS "some text") then think how you might restructure your queries - or do an efficient retrieve of some dataset and then subquery it client side in memory.

Personally, I'd try the above before looking at partitioning.
NuttingCDEF 6-Apr-12 11:50am View    
That must be some size database or you are hitting it very hard! Or there's a design issue in the way it's built or being used . . .

Have you tried using the SQL Server Profiler and Database Engine Tuning Adviser?

What languages / technologies are you using? Personal experience is that the tools mentioned above can give a lot of help in sorting out performance issues. I use .NET and LINQ and what look like innocuous code changes can have a huge effect. If you're doing lots of inserts, making sure you are doing BULK inserts (which AFAIK LINQ never does!) is also important.

Are your hits primarily Select, Insert, Update or Delete?

Can you give any examples that might help?
NuttingCDEF 6-Apr-12 11:40am View    
3G key will go via internet / your external IP / router etc. But that doesn't explain why direct LAN connection isn't working. I think the video showed your WP7 emulator connecting - so if it works to another PC on your LAN and not to your PC then the issue is your PC.

If emulator is running on same PC as your RDP server then have you tried connecting to loopback (127.0.0.1) or localhost? Never tried it, but maybe worth a go.

What options did you pick to enable RDP connections to your PC? What security / authentication options? What does your client use? Any issues over encryption of the link? What do the server / client require / expect?

You say you've used a packet sniffer and there are no relevant packets being detected. If the WP7 emulator client and server are physically on the same PC that might be a red herring. Can you try it over the LAN (preferably something very simple - 2 PCs hooked up to a router / DHCP server with nothing else connected?) between 2 separate PCs? Can you then check at both client and server end to see what packets are being sent / received?
NuttingCDEF 6-Apr-12 8:04am View    
OK - so is your Win7 connection going over the internet? Or is that an internal / LAN connection only? If internal, is there any way you can test it externally over the internet?

I think you are saying that your WP7 app can connect over the internet to other RDP servers - so it is just the connection to your own PC that doesn't work - is that right?

If so, what is the external / public (fixed) IP address on your internet connection? That's the IP address that you need to connect to if you are connecting from WP7 over the internet. Your firewall / router should map a port on the external / public / internet side through to the RDP port on your PC that sits on the internal side. Presumably the 10.x.x.x IP address is the INTERNAL IP address of your PC - so known only to devices on the internal LAN - and never directly accessible from the external / internet side - which is why you need port forwarding set up on the firewall / router - e.g. public / external address 88.89.90.91 port 3389 mapped to private / internal address 10.11.12.13 port 3389 - note also that the public and private port numbers don't necessarily have to be the same either - this is something you can configure - and for RDP we are talking TCP only here, not UDP.

Apologies if any of this is just telling you stuff you already know, but from what you've said so far this sounds more like a routing issue than a code problem.
NuttingCDEF 6-Apr-12 7:13am View    
A few suggestions . . .

Can you connect to your RDP server using any other RDP client (not your WP7 app)?

Is Windows Firewall (or any other firewall) blocking inbound connections on the RDP port?

Are you using the standard RDP port? If not which port is configured?

Have you tried putting Wireshark on your RDP server to see if packets from the WP7 app are even reaching the server?

How do you connect to your RDP server? Over the internet? Is it behind a router / firewall? Do you need any port forwarding set up? 10.x.x.x is a private IP address, so shouldn't be directly reachable from the internet without some sort of forwarding from the public side of your router.

Can you add anything to your code to give you a more detailed error message?