Ryan,
Well, if you do some sort of monitoring, it will make your server
slower. By how much is impossible to say, depending on the method you use
to monitor the performance of your server. The simple act of monitoring
anything will have the effect of changing what you are monitoring.
I would say that forcing a GC is a bad idea, since it will typically do
a good job of that for you. There are exceptions to this though, but they
are rare. In a server environment, or any environment where you have a
consistent, almost predictable use, it's definitely a bad idea.
As for not having memory leaks, you are right, managed code doesn't have
memory leaks, but that doesn't mean you don't have to pay attention to what
you are using. Anything that implements IDisposable definitely needs
special attention, as you need to make sure you call Dispose (or you should,
at least) on those instances when you are done, as the IDisposable interface
indicates that the instance in question is holding onto something which
should be disposed of when done (as opposed to waiting around for it to be
disposed of, like file handles, sockets, database connections, etc, etc).
Of course, the most important thing to do is really look at what your
server is doing. I know that sounds broad, but you didn't indicate anything
about what your server does, so it's impossible for anyone to comment on
what might be making it slow. Are you executing a massive stored procedure
which processes five billion rows for each of your 100 clients? Are you
writing out 20GB of files for each client at the same time? There are many
things that could indicate performance problems, but you can't even begin to
diagnose them unless you know what the app is doing (or supposed to do) in
the first place.
That being said, can you shed some more light on what your app does?
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Ryan Liu" <rl**@PowerCATI.comwrote in message
news:Oo**************@TK2MSFTNGP03.phx.gbl...
Hi,
I use C# wrote an Client/Server application. In production environment,
will be 130 clients (Windows XP) connect to a Server (Windows 2000/2003
Server) thought TCP/IP socket in a local 100M LAN. "Server" is running as
a Windows service. The is one thread running for one clinet in the server.
Sometime the user tells me the Sever will be slow after it runs for 1-2
days.
Usually what will be the cause? Managed code won't have memory leaking,
right? And how efficient is the garbage collection in .NET? Should I force
garbage collection once a while in my code?
And if I want to use the performance counter to check the problem, what
usually are the objects/parameters I should look at? How many threads are
running for my service? Memory used by the service or each server thread
in my service? Thread idle time ..? I just see too many things in the
performance counter.
And if I write code to sample those performance parameters, will it make
the service runs even slower?
Thanks!
Ryan