I am designing a library which client side could use it to retrieve content
from a remote cache server, through Http/Web Services communication.
My current issues and concerns are,
- I want to let client side library to start multiple threads to work
efficiently to request for multiple content at the same time other than a
single thread pattern;
- But I do not want to hit the server too hard and I also do not want to the
library to consume too much resources (memory/threads) on client side to
block other work of the client. The library is delivered as a DLL, so loaded
into client side process, and will compete for resources of the same process.
Are there any good design patterns for such issues?
thanks in advance,
George
The common solution for this problem is to use I/O Completion
Port. Read more about IOCP here:
"I/O Completion Ports"
http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx
Very nice IOCP sample:
"A simple IOCP Server/Client Class"
http://www.codeproject.com/KB/IP/iocp_server_client.aspx
HTH
Alex
To a certain extent, this is a problem that solves itself. If your server
gets too many requests, it won't be able to serve them all, and things will
slow down.
Remember that web servers can handle hundreds of requests per second. It
takes an awful lot to bring down a server.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
As far as I know, IO completion port is server side solution to serve client
request efficiently.
What I am doing is at client side. I am not sure whether IO completion port
serves my needs. Any comments?
regards,
George
I read your reply but confused -- "this is a problem that solves itself".
Could you clarify what is your solution please? In my original reply, I only
states my concerns and problems, no solution from my mind -- and this is why
I come here to ask experts like you. :-)
regards,
George
What I'm suggesting is that you take a straightforward approach and see
what the impact is. You are trying to optimize things before you know
whether you have a problem. Assuming you are writing a real program, I
doubt that your application will be able to swamp one of today's web
servers.
I totally agree, I just want to read more from best practices before my work
and I also want to see whether there are any existing samples or something --
so that I do not re-invent the wheel.
Any recommended documents?
regards,
George