Hi Nicolas,
Thank you for your reply, I'll add more details to my query.
For my first question, I want to write some software specification and I
need to know if the number of threads will make increase the amount of
used RAM by the application.
-If I have 50 running threads (one thread for each client connection in
a server), how can I theorically evaluate the performance impact of that
on the system (at least RAM)?
-Does Microsoft can guaranty a specific amount of RAM per thread? (just
the thread object itself idling).
For my second question, I'll explain what I am doing right now.
1- A client connect to the server.
2- The server accept the connection and create a thread that will handle
this new client connection.
3- The thread will pool a queue created for that client.
4- When server sends messages to client, messages are firstly queued in
this queue (the flow is heavy, 100-1000 message per sec. (each msg = up
to 100bytes)
5- The thread will dequeue each message in the queue and send it to the
client through the socket.
6- When the thread dequeued all pending message, it sleep for 10ms.
7- Then thread awake and check if there is message to send to client.
Then do step 5, 6, 7 until the client disconnect or the server is closed.
The server can handle case 1 to 7 for 50 clients. Each client connection
has its own thread that has its own queue. Each client does not receive
the same message from the server.
Should I use a thread.timer instead of the current thread for step 1 to
7 to dequeue, in order to get full speed/performance of the server ?
Maybe the thread.timer will start/stop faster than the thread.sleep()?
I appreciate your suggestion.
Marty
Nicholas Paldino [.NET/C# MVP] wrote:
Marty,
What kind of relation are you looking for? You can't say the OS can
handle X number of threads based on the amount of ram and CPU, or anything
of that nature. The best you can do is guess, and you also need a good deal
more information to make that guess anywhere close to accurate.
As for using a Timer instead of a thread, both do different things. The
timer will fire a notification after a certain period of time has elapsed.
A thread is a unit of execution which will be performed separately from
other threads. They have different purposes, so I am not quite sure what
your question is.